summaryrefslogtreecommitdiff
path: root/git_command.py
diff options
context:
space:
mode:
authorConley Owens <cco3@android.com>2014-01-30 13:09:08 -0800
committerConley Owens <cco3@android.com>2014-01-30 13:26:50 -0800
commit1c5da49e6c0c2dd6a5f0ba6e5b57ecb783c27eea (patch)
treee2969c9777a1bf3227c1a49165eb1b16cb55eff8 /git_command.py
parentb8433dfd2f078617b724e4dc4f709330cc90f1e7 (diff)
downloadgit-repo-1c5da49e6c0c2dd6a5f0ba6e5b57ecb783c27eea.tar.gz
git-repo-1c5da49e6c0c2dd6a5f0ba6e5b57ecb783c27eea.zip
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
Diffstat (limited to 'git_command.py')
-rw-r--r--git_command.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/git_command.py b/git_command.py
index 51f5e3c04..58fc7518e 100644
--- a/git_command.py
+++ b/git_command.py
@@ -88,10 +88,14 @@ class _GitCall(object):
if _git_version is None:
ver_str = git.version().decode('utf-8')
if ver_str.startswith('git version '):
- _git_version = tuple(
- map(int,
- ver_str[len('git version '):].strip().split('-')[0].split('.')[0:3]
- ))
+ num_ver_str = ver_str[len('git version '):].strip()
+ to_tuple = []
+ 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:
print('fatal: "%s" unsupported' % ver_str, file=sys.stderr)
sys.exit(1)