Gracefully fail if branches have no tags

If some of the branches have no tags at all (like in the case
of feature branches or early master branches), the listing of
branches in list-changes fails.

This problem was introduced in I4f06d6cfaa8ea332d9326ccd8a5e69c749589529
since we switched to subprocess' check_output instead of call.

Change-Id: Id8c61662ecf3a9424c3b4e21fb36f0ed8c01d6b1
This commit is contained in:
Thierry Carrez 2017-03-20 11:17:19 -04:00
parent d725dd8a09
commit 845f0ca15e

View File

@ -63,10 +63,13 @@ def git_log(workdir, repo, title, git_range, extra_args=[]):
def git_list_existing_branches(workdir, repo):
header('All Branches with Version Numbers')
for branch in gitutils.get_branches(workdir, repo):
description = subprocess.check_output(
['git', 'describe', branch],
cwd=os.path.join(workdir, repo),
).decode('utf-8').strip()
try:
description = subprocess.check_output(
['git', 'describe', branch],
cwd=os.path.join(workdir, repo),
).decode('utf-8').strip()
except subprocess.CalledProcessError as exc:
description = exc.output
print('{:<30} {}'.format(branch, description))