Merge "decode command output in discover-branch-points"

This commit is contained in:
Jenkins 2017-03-13 12:18:02 +00:00 committed by Gerrit Code Review
commit 2f40d76edf

View File

@ -40,7 +40,7 @@ def _get_current_version(reporoot, branch=None):
if branch is not None: if branch is not None:
cmd.append(branch) cmd.append(branch)
try: try:
result = subprocess.check_output(cmd, cwd=reporoot).strip() result = subprocess.check_output(cmd, cwd=reporoot).decode('utf-8').strip()
if '-' in result: if '-' in result:
# Descriptions that come after a commit look like # Descriptions that come after a commit look like
# 2.0.0-1-abcde, and we want to remove the SHA value from # 2.0.0-1-abcde, and we want to remove the SHA value from
@ -75,7 +75,7 @@ def _get_branch_base(reporoot, branch):
cmd, cwd=reporoot, cmd, cwd=reporoot,
# Trap stderr so it isn't dumped into our output. # Trap stderr so it isn't dumped into our output.
stderr=subprocess.PIPE, stderr=subprocess.PIPE,
).strip() ).decode('utf-8').strip()
if not parents: if not parents:
# There are no commits on the branch, yet, so we can use # There are no commits on the branch, yet, so we can use
# our current-version logic. # our current-version logic.
@ -91,7 +91,7 @@ def _get_branch_base(reporoot, branch):
'{}^^!'.format(parent), '{}^^!'.format(parent),
] ]
try: try:
sha = subprocess.check_output(cmd, cwd=reporoot).strip() sha = subprocess.check_output(cmd, cwd=reporoot).decode('utf-8').strip()
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
return None return None
# Now get the tag for that commit. # Now get the tag for that commit.
@ -102,7 +102,7 @@ def _get_branch_base(reporoot, branch):
sha, sha,
] ]
try: try:
return subprocess.check_output(cmd, cwd=reporoot).strip() return subprocess.check_output(cmd, cwd=reporoot).decode('utf-8').strip()
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
return None return None