Merge "[list_changes] Handle non-numeric tags"

This commit is contained in:
Zuul 2019-05-07 19:10:55 +00:00 committed by Gerrit Code Review
commit 6ae844e745
1 changed files with 8 additions and 1 deletions

View File

@ -24,6 +24,7 @@ import json
import logging
import os
import os.path
import re
import shutil
import subprocess
import sys
@ -80,7 +81,13 @@ def git_list_existing_branches(workdir, repo):
['git', 'describe', branch],
cwd=os.path.join(workdir, repo),
).decode('utf-8').strip()
tag = description.partition('-')[0] # strip to the real tag value
# strip to the real tag value
match = re.match('^(.*)-[0-9]+-g[a-f0-9]+', description,
re.IGNORECASE)
if match:
tag = match.groups()[0]
else:
tag = ''
except subprocess.CalledProcessError as exc:
description = exc.output.decode('utf-8').strip()
tag = ''