diff options
Diffstat (limited to 'testing/tools/githelper.py')
-rw-r--r-- | testing/tools/githelper.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/testing/tools/githelper.py b/testing/tools/githelper.py index 42cc57d304..021ed4e61e 100644 --- a/testing/tools/githelper.py +++ b/testing/tools/githelper.py @@ -17,6 +17,10 @@ class GitHelper(object): """Checks out a branch.""" subprocess.check_output(['git', 'checkout', branch]) + def FetchOriginMaster(self): + """Fetches new changes on origin/master.""" + subprocess.check_output(['git', 'fetch', 'origin', 'master']) + def StashPush(self): """Stashes uncommitted changes.""" output = subprocess.check_output(['git', 'stash', '--include-untracked']) @@ -37,6 +41,14 @@ class GitHelper(object): return subprocess.check_output( ['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip() + def GetCurrentBranchHash(self): + return subprocess.check_output( + ['git', 'rev-parse', 'HEAD']).strip() + + def IsCurrentBranchClean(self): + output = subprocess.check_output(['git', 'status', '--porcelain']) + return not output + def BranchExists(self, branch_name): """Return whether a branch with the given name exists.""" try: |