summaryrefslogtreecommitdiff
path: root/testing/tools/githelper.py
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2017-08-15 14:37:58 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-08-15 20:02:20 +0000
commit0da39e6b62fe7dc0f40d5242325b3b2d5b2c9d96 (patch)
treed7d63a35b983e3c3b8a865c0fc97c9d762e74649 /testing/tools/githelper.py
parent5f7b8f4038d16d224cb070f08112aba5331bd094 (diff)
downloadpdfium-0da39e6b62fe7dc0f40d5242325b3b2d5b2c9d96.tar.xz
Make errors in called processes more evident and easier to debug.
Also trying to get unicode filenames right again. Change-Id: I501c94921b92b8a8cd6a10441aff1595fc6d878e Reviewed-on: https://pdfium-review.googlesource.com/10630 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'testing/tools/githelper.py')
-rw-r--r--testing/tools/githelper.py36
1 files changed, 20 insertions, 16 deletions
diff --git a/testing/tools/githelper.py b/testing/tools/githelper.py
index 021ed4e61e..2e94196e85 100644
--- a/testing/tools/githelper.py
+++ b/testing/tools/githelper.py
@@ -6,6 +6,8 @@
import subprocess
+from common import RunCommandPropagateErr
+
class GitHelper(object):
"""Issues git commands. Stateful."""
@@ -15,15 +17,17 @@ class GitHelper(object):
def Checkout(self, branch):
"""Checks out a branch."""
- subprocess.check_output(['git', 'checkout', branch])
+ RunCommandPropagateErr(['git', 'checkout', branch], exit_status_on_error=1)
def FetchOriginMaster(self):
"""Fetches new changes on origin/master."""
- subprocess.check_output(['git', 'fetch', 'origin', 'master'])
+ RunCommandPropagateErr(['git', 'fetch', 'origin', 'master'],
+ exit_status_on_error=1)
def StashPush(self):
"""Stashes uncommitted changes."""
- output = subprocess.check_output(['git', 'stash', '--include-untracked'])
+ output = RunCommandPropagateErr(['git', 'stash', '--include-untracked'],
+ exit_status_on_error=1)
if 'No local changes to save' in output:
return False
@@ -33,30 +37,30 @@ class GitHelper(object):
def StashPopAll(self):
"""Pops as many changes as this instance stashed."""
while self.stashed > 0:
- subprocess.check_output(['git', 'stash', 'pop'])
+ RunCommandPropagateErr(['git', 'stash', 'pop'], exit_status_on_error=1)
self.stashed -= 1
def GetCurrentBranchName(self):
"""Returns a string with the current branch name."""
- return subprocess.check_output(
- ['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip()
+ return RunCommandPropagateErr(
+ ['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
+ exit_status_on_error=1).strip()
def GetCurrentBranchHash(self):
- return subprocess.check_output(
- ['git', 'rev-parse', 'HEAD']).strip()
+ return RunCommandPropagateErr(
+ ['git', 'rev-parse', 'HEAD'], exit_status_on_error=1).strip()
def IsCurrentBranchClean(self):
- output = subprocess.check_output(['git', 'status', '--porcelain'])
+ output = RunCommandPropagateErr(['git', 'status', '--porcelain'],
+ exit_status_on_error=1)
return not output
def BranchExists(self, branch_name):
"""Return whether a branch with the given name exists."""
- try:
- subprocess.check_output(['git', 'rev-parse', '--verify',
- branch_name])
- return True
- except subprocess.CalledProcessError:
- return False
+ output = RunCommandPropagateErr(['git', 'rev-parse', '--verify',
+ branch_name])
+ return output is not None
def CloneLocal(self, source_repo, new_repo):
- subprocess.check_call(['git', 'clone', source_repo, new_repo])
+ RunCommandPropagateErr(['git', 'clone', source_repo, new_repo],
+ exit_status_on_error=1)