diff options
author | Conley Owens <cco3@android.com> | 2014-01-30 13:09:08 -0800 |
---|---|---|
committer | Conley Owens <cco3@android.com> | 2014-01-30 13:26:50 -0800 |
commit | 1c5da49e6c0c2dd6a5f0ba6e5b57ecb783c27eea (patch) | |
tree | e2969c9777a1bf3227c1a49165eb1b16cb55eff8 /git_command.py | |
parent | b8433dfd2f078617b724e4dc4f709330cc90f1e7 (diff) | |
download | git-repo-1c5da49e6c0c2dd6a5f0ba6e5b57ecb783c27eea.tar.gz |
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.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/git_command.py b/git_command.py index 51f5e3c0..58fc7518 100644 --- a/git_command.py +++ b/git_command.py | |||
@@ -88,10 +88,14 @@ class _GitCall(object): | |||
88 | if _git_version is None: | 88 | if _git_version is None: |
89 | ver_str = git.version().decode('utf-8') | 89 | ver_str = git.version().decode('utf-8') |
90 | if ver_str.startswith('git version '): | 90 | if ver_str.startswith('git version '): |
91 | _git_version = tuple( | 91 | num_ver_str = ver_str[len('git version '):].strip() |
92 | map(int, | 92 | to_tuple = [] |
93 | ver_str[len('git version '):].strip().split('-')[0].split('.')[0:3] | 93 | for num_str in num_ver_str.split('.')[:3]: |
94 | )) | 94 | if num_str.isdigit(): |
95 | to_tuple.append(int(num_str)) | ||
96 | else: | ||
97 | to_tuple.append(0) | ||
98 | _git_version = tuple(to_tuple) | ||
95 | else: | 99 | else: |
96 | print('fatal: "%s" unsupported' % ver_str, file=sys.stderr) | 100 | print('fatal: "%s" unsupported' % ver_str, file=sys.stderr) |
97 | sys.exit(1) | 101 | sys.exit(1) |