Commit 13b522c1 authored by shouqun.liu@intel.com's avatar shouqun.liu@intel.com

Fix the svn version check issue, append '--quiet' to get svn version string.

In some enviroments (eg, OSX zh_CN), use 'svn --version' and splitting string
may get error version string. Use 'svn --version --quiet' to do stable svn
version check, which directly returns version string such as '1.7.0'.

BUG=
TEST=


Review URL: https://chromiumcodereview.appspot.com/10805037

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@147670 0039d316-1c4b-4281-b951-d872f2087c98
parent b4cb59c2
......@@ -1004,7 +1004,7 @@ class SVN(object):
def AssertVersion(cls, min_version):
"""Asserts svn's version is at least min_version."""
if cls.current_version is None:
cls.current_version = cls.Capture(['--version'], None).split()[2]
cls.current_version = cls.Capture(['--version', '--quiet'], None)
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)
......
......@@ -178,8 +178,8 @@ class SVNWrapperTestCase(BaseTestCase):
options = self.Options(verbose=True)
gclient_scm.os.path.isdir(self.base_path).AndReturn(False)
gclient_scm.os.path.exists(self.base_path).AndReturn(False)
gclient_scm.scm.SVN.Capture(['--version'], None
).AndReturn('svn, version 1.5.1 (r32289)')
gclient_scm.scm.SVN.Capture(['--version', '--quiet'], None
).AndReturn('1.5.1')
# It'll to a checkout instead.
gclient_scm.os.path.exists(join(self.base_path, '.git')).AndReturn(False)
gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False)
......@@ -219,8 +219,8 @@ class SVNWrapperTestCase(BaseTestCase):
gclient_scm.os.makedirs(parent)
gclient_scm.os.path.exists(parent).AndReturn(True)
files_list = self.mox.CreateMockAnything()
gclient_scm.scm.SVN.Capture(['--version'], None
).AndReturn('svn, version 1.6')
gclient_scm.scm.SVN.Capture(['--version', '--quiet'], None
).AndReturn('1.6')
gclient_scm.scm.SVN.RunAndGetFileList(
options.verbose,
['checkout', self.url, self.base_path, '--force', '--ignore-externals'],
......@@ -344,8 +344,8 @@ class SVNWrapperTestCase(BaseTestCase):
gclient_scm.os.makedirs(parent)
gclient_scm.os.path.exists(parent).AndReturn(True)
files_list = self.mox.CreateMockAnything()
gclient_scm.scm.SVN.Capture(['--version'], None
).AndReturn('svn, version 1.5.1 (r32289)')
gclient_scm.scm.SVN.Capture(['--version', '--quiet'], None
).AndReturn('1.5.1')
gclient_scm.scm.SVN.RunAndGetFileList(
options.verbose,
['checkout', self.url, self.base_path, '--force', '--ignore-externals'],
......@@ -382,8 +382,8 @@ class SVNWrapperTestCase(BaseTestCase):
).AndReturn(file_info)
# _AddAdditionalUpdateFlags()
gclient_scm.scm.SVN.Capture(['--version'], None
).AndReturn('svn, version 1.5.1 (r32289)')
gclient_scm.scm.SVN.Capture(['--version', '--quiet'], None
).AndReturn('1.5.1')
additional_args = []
if options.manually_grab_svn_rev:
......@@ -483,8 +483,8 @@ class SVNWrapperTestCase(BaseTestCase):
# Checks to make sure that we support svn co --depth.
gclient_scm.scm.SVN.current_version = None
gclient_scm.scm.SVN.Capture(['--version'], None
).AndReturn('svn, version 1.5.1 (r32289)')
gclient_scm.scm.SVN.Capture(['--version', '--quiet'], None
).AndReturn('1.5.1')
gclient_scm.os.path.exists(join(self.base_path, '.svn')).AndReturn(False)
gclient_scm.os.path.exists(join(self.base_path, 'DEPS')).AndReturn(False)
......@@ -523,8 +523,8 @@ class SVNWrapperTestCase(BaseTestCase):
# Checks to make sure that we support svn co --depth.
gclient_scm.scm.SVN.current_version = None
gclient_scm.scm.SVN.Capture(['--version'], None
).AndReturn('svn, version 1.4.4 (r25188)')
gclient_scm.scm.SVN.Capture(['--version', '--quiet'], None
).AndReturn('1.4.4')
gclient_scm.os.path.exists(self.base_path).AndReturn(True)
# When checking out a single file with svn 1.4, we use svn export
......@@ -547,8 +547,8 @@ class SVNWrapperTestCase(BaseTestCase):
# Checks to make sure that we support svn co --depth.
gclient_scm.scm.SVN.current_version = None
gclient_scm.scm.SVN.Capture(['--version'], None
).AndReturn('svn, version 1.5.1 (r32289)')
gclient_scm.scm.SVN.Capture(['--version', '--quiet'], None
).AndReturn('1.5.1')
gclient_scm.os.path.exists(join(self.base_path, '.svn')).AndReturn(False)
# If DEPS already exists, assume we're upgrading from svn1.4, so delete
# the old DEPS file.
......@@ -595,8 +595,8 @@ class SVNWrapperTestCase(BaseTestCase):
}
# Checks to make sure that we support svn co --depth.
gclient_scm.scm.SVN.current_version = None
gclient_scm.scm.SVN.Capture(['--version'], None
).AndReturn('svn, version 1.5.1 (r32289)')
gclient_scm.scm.SVN.Capture(['--version', '--quiet'], None
).AndReturn('1.5.1')
gclient_scm.os.path.exists(join(self.base_path, '.svn')).AndReturn(True)
# Verify no locked files.
......
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