mirror of
https://gerrit.googlesource.com/git-repo
synced 2025-01-02 16:14:25 +00:00
Handle release candidates in git version parsing
Right now repo chokes on git versions like "1.9.rc1". This change treats 'rc*' as a '0'. Change-Id: I612b7b431675ba7415bf70640a673e48dbb00a90
This commit is contained in:
parent
b8433dfd2f
commit
1c5da49e6c
@ -88,10 +88,14 @@ class _GitCall(object):
|
|||||||
if _git_version is None:
|
if _git_version is None:
|
||||||
ver_str = git.version().decode('utf-8')
|
ver_str = git.version().decode('utf-8')
|
||||||
if ver_str.startswith('git version '):
|
if ver_str.startswith('git version '):
|
||||||
_git_version = tuple(
|
num_ver_str = ver_str[len('git version '):].strip()
|
||||||
map(int,
|
to_tuple = []
|
||||||
ver_str[len('git version '):].strip().split('-')[0].split('.')[0:3]
|
for num_str in num_ver_str.split('.')[:3]:
|
||||||
))
|
if num_str.isdigit():
|
||||||
|
to_tuple.append(int(num_str))
|
||||||
|
else:
|
||||||
|
to_tuple.append(0)
|
||||||
|
_git_version = tuple(to_tuple)
|
||||||
else:
|
else:
|
||||||
print('fatal: "%s" unsupported' % ver_str, file=sys.stderr)
|
print('fatal: "%s" unsupported' % ver_str, file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user