Commit 923a0373 authored by msb@chromium.org's avatar msb@chromium.org

gclient: Add a minimum git version check.

Review URL: http://codereview.chromium.org/490021

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@34377 0039d316-1c4b-4281-b951-d872f2087c98
parent ffe96f07
......@@ -115,6 +115,8 @@ class GitWrapper(SCMWrapper, scm.GIT):
if args:
raise gclient_utils.Error("Unsupported argument(s): %s" % ",".join(args))
self._CheckMinVersion("1.6.1")
url, revision = gclient_utils.SplitUrlRevision(self.url)
rev_str = ""
if options.revision:
......@@ -185,6 +187,18 @@ class GitWrapper(SCMWrapper, scm.GIT):
files = self._Run(['diff', '--name-only', merge_base]).split()
file_list.extend([os.path.join(self.checkout_path, f) for f in files])
def _CheckMinVersion(self, min_version):
version = self._Run(['--version']).split()[-1]
version_list = map(int, version.split('.'))
min_version_list = map(int, min_version.split('.'))
for min_ver in min_version_list:
ver = version_list.pop(0)
if min_ver > ver:
raise gclient_utils.Error('git version %s < minimum required %s' %
(version, min_version))
elif min_ver < ver:
return
def _Run(self, args, cwd=None, checkrc=True, redirect_stdout=True):
# TODO(maruel): Merge with Capture?
if cwd is None:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment