Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: gclient_scm.py

Issue 490021: gclient: Add a minimum git version check. (Closed)
Patch Set: Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient_scm.py
diff --git a/gclient_scm.py b/gclient_scm.py
index 034dc2df6c8bdef41dc7f8460bc8ca356036756a..aa5a05d33b6c60692382915553df50f92ab7e885 100644
--- a/gclient_scm.py
+++ b/gclient_scm.py
@@ -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('.'))
M-A Ruel 2009/12/11 19:51:54 Nice idea, I wouldn't have thought about that.
+ 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:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698