Fix compatibility with Xcode4.3 git
Xcode 4.3 git returns the version like below:
git version 1.7.7.5 (Apple Git-26)
Modify GIT.AssertVersion to accept such input.
Also modify tests/gclient_scm_test.py to pass tests, but not sure
the fix is collect.
BUG=chromium:115576
TEST=ran tests/gclient_scm_test.py
Review URL: http://codereview.chromium.org/9443047
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@123399 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/scm.py b/scm.py
index e58286c..2addcef 100644
--- a/scm.py
+++ b/scm.py
@@ -415,7 +415,9 @@
def AssertVersion(cls, min_version):
"""Asserts git's version is at least min_version."""
if cls.current_version is None:
- cls.current_version = cls.Capture(['--version'], '.').split()[-1]
+ current_version = cls.Capture(['--version'], '.')
+ matched = re.search(r'version ([0-9\.]+)', current_version)
+ cls.current_version = matched.group(1)
current_version_list = map(only_int, cls.current_version.split('.'))
for min_ver in map(int, min_version.split('.')):
ver = current_version_list.pop(0)