diff options
-rwxr-xr-x | repo | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -121,6 +121,7 @@ GITC_CONFIG_FILE = '/gitc/.config' | |||
121 | GITC_FS_ROOT_DIR = '/gitc/manifest-rw/' | 121 | GITC_FS_ROOT_DIR = '/gitc/manifest-rw/' |
122 | 122 | ||
123 | 123 | ||
124 | import collections | ||
124 | import errno | 125 | import errno |
125 | import optparse | 126 | import optparse |
126 | import platform | 127 | import platform |
@@ -377,18 +378,25 @@ def _Init(args, gitc_init=False): | |||
377 | raise | 378 | raise |
378 | 379 | ||
379 | 380 | ||
381 | # The git version info broken down into components for easy analysis. | ||
382 | # Similar to Python's sys.version_info. | ||
383 | GitVersion = collections.namedtuple( | ||
384 | 'GitVersion', ('major', 'minor', 'micro', 'full')) | ||
385 | |||
380 | def ParseGitVersion(ver_str): | 386 | def ParseGitVersion(ver_str): |
381 | if not ver_str.startswith('git version '): | 387 | if not ver_str.startswith('git version '): |
382 | return None | 388 | return None |
383 | 389 | ||
384 | num_ver_str = ver_str[len('git version '):].strip().split('-')[0] | 390 | full_version = ver_str[len('git version '):].strip() |
391 | num_ver_str = full_version.split('-')[0] | ||
385 | to_tuple = [] | 392 | to_tuple = [] |
386 | for num_str in num_ver_str.split('.')[:3]: | 393 | for num_str in num_ver_str.split('.')[:3]: |
387 | if num_str.isdigit(): | 394 | if num_str.isdigit(): |
388 | to_tuple.append(int(num_str)) | 395 | to_tuple.append(int(num_str)) |
389 | else: | 396 | else: |
390 | to_tuple.append(0) | 397 | to_tuple.append(0) |
391 | return tuple(to_tuple) | 398 | to_tuple.append(full_version) |
399 | return GitVersion(*to_tuple) | ||
392 | 400 | ||
393 | 401 | ||
394 | def _CheckGitVersion(): | 402 | def _CheckGitVersion(): |