diff --git a/gclient.py b/gclient.py index d2b8ee7a5..cbba142e6 100644 --- a/gclient.py +++ b/gclient.py @@ -49,7 +49,7 @@ Hooks ] """ -__version__ = "0.6.3" +__version__ = "0.6.2" import copy import logging diff --git a/gclient_scm.py b/gclient_scm.py index c33793c7d..95890a450 100644 --- a/gclient_scm.py +++ b/gclient_scm.py @@ -994,24 +994,8 @@ class SVNWrapper(SCMWrapper): new_command = command[:] if revision: new_command.extend(['--revision', str(revision).strip()]) - # We don't want interaction when jobs are used. - if options.jobs > 1: - new_command.append('--non-interactive') # --force was added to 'svn update' in svn 1.5. - # --accept was added to 'svn update' in svn 1.6. - if not scm.SVN.AssertVersion('1.5')[0]: - return new_command - - # It's annoying to have it block in the middle of a sync, just sensible - # defaults. - if options.force: - new_command.append('--force') - if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: - new_command.extend(('--accept', 'theirs-conflict')) - elif options.manually_grab_svn_rev: + if ((options.force or options.manually_grab_svn_rev) and + scm.SVN.AssertVersion("1.5")[0]): new_command.append('--force') - if command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: - new_command.extend(('--accept', 'postpone')) - elif command[0] != 'checkout' and scm.SVN.AssertVersion('1.6')[0]: - new_command.extend(('--accept', 'postpone')) return new_command diff --git a/scm.py b/scm.py index 875541ff8..fa738135b 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): diff --git a/tests/gclient_scm_test.py b/tests/gclient_scm_test.py index 89e84d32f..6d5e380c0 100755 --- a/tests/gclient_scm_test.py +++ b/tests/gclient_scm_test.py @@ -73,8 +73,6 @@ class SVNWrapperTestCase(BaseTestCase): self.force = False self.reset = False self.nohooks = False - # TODO(maruel): Test --jobs > 1. - self.jobs = 1 def Options(self, *args, **kwargs): return self.OptionsObject(*args, **kwargs) diff --git a/tests/scm_unittest.py b/tests/scm_unittest.py index 7564678ec..6b4faf358 100755 --- a/tests/scm_unittest.py +++ b/tests/scm_unittest.py @@ -45,8 +45,8 @@ class RootTestCase(BaseSCMTestCase): members = [ 'ElementTree', 'GetCasedPath', 'GenFakeDiff', 'GIT', 'SVN', 'ValidateEmail', - 'cStringIO', 'determine_scm', 'gclient_utils', 'glob', 'logging', - 'only_int', 'os', 're', 'subprocess2', 'sys', 'tempfile', 'time', + 'cStringIO', 'determine_scm', 'gclient_utils', 'glob', 'logging', 'os', + 're', 'subprocess2', 'sys', 'tempfile', 'time', ] # If this test fails, you should add the relevant test. self.compareMembers(scm, members) @@ -60,7 +60,6 @@ class GitWrapperTestCase(BaseSCMTestCase): 'GenerateDiff', 'GetBranch', 'GetBranchRef', 'GetCheckoutRoot', 'GetDifferentFiles', 'GetEmail', 'GetPatchName', 'GetSVNBranch', 'GetUpstreamBranch', 'IsGitSvn', 'MatchSvnGlob', 'ShortBranchName', - 'current_version', ] # If this test fails, you should add the relevant test. self.compareMembers(scm.GIT, members)