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

Unified Diff: scm.py

Issue 8228017: Revert r104938 "Make svn update not prompt during a sync." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 2 months 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 | « gclient_scm.py ('k') | tests/gclient_scm_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scm.py
diff --git a/scm.py b/scm.py
index 875541ff8f52efbb0f5ec2f95ce544fafdae7617..fa738135b491790209bac6f7f6caba5b60af1752 100644
--- a/scm.py
+++ b/scm.py
@@ -86,16 +86,7 @@ def determine_scm(root):
return None
-def only_int(val):
- if val.isdigit():
- return int(val)
- else:
- return 0
-
-
class GIT(object):
- current_version = None
-
@staticmethod
def Capture(args, **kwargs):
return subprocess2.check_output(
@@ -379,19 +370,23 @@ class GIT(object):
root = GIT.Capture(['rev-parse', '--show-cdup'], cwd=cwd).strip()
return os.path.abspath(os.path.join(cwd, root))
- @classmethod
- def AssertVersion(cls, min_version):
+ @staticmethod
+ def AssertVersion(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_list = map(only_int, cls.current_version.split('.'))
+ def only_int(val):
+ if val.isdigit():
+ return int(val)
+ else:
+ return 0
+ current_version = GIT.Capture(['--version']).split()[-1]
+ current_version_list = map(only_int, current_version.split('.'))
for min_ver in map(int, min_version.split('.')):
ver = current_version_list.pop(0)
if ver < min_ver:
- return (False, cls.current_version)
+ return (False, current_version)
elif ver > min_ver:
- return (True, cls.current_version)
- return (True, cls.current_version)
+ return (True, current_version)
+ return (True, current_version)
class SVN(object):
@@ -928,19 +923,24 @@ class SVN(object):
directory = parent
return GetCasedPath(directory)
- @classmethod
- def AssertVersion(cls, min_version):
+ @staticmethod
+ def AssertVersion(min_version):
"""Asserts svn's version is at least min_version."""
- if cls.current_version is None:
- cls.current_version = cls.Capture(['--version']).split()[2]
- current_version_list = map(only_int, cls.current_version.split('.'))
+ def only_int(val):
+ if val.isdigit():
+ return int(val)
+ else:
+ return 0
+ if not SVN.current_version:
+ SVN.current_version = SVN.Capture(['--version']).split()[2]
+ current_version_list = map(only_int, SVN.current_version.split('.'))
for min_ver in map(int, min_version.split('.')):
ver = current_version_list.pop(0)
if ver < min_ver:
- return (False, cls.current_version)
+ return (False, SVN.current_version)
elif ver > min_ver:
- return (True, cls.current_version)
- return (True, cls.current_version)
+ return (True, SVN.current_version)
+ return (True, SVN.current_version)
@staticmethod
def Revert(repo_root, callback=None, ignore_externals=False):
« no previous file with comments | « gclient_scm.py ('k') | tests/gclient_scm_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698