Commit 5c3a2ff6 authored by maruel@chromium.org's avatar maruel@chromium.org

Add a flag not print errors in CaptureSVN()

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@15887 0039d316-1c4b-4281-b951-d872f2087c98
parent be0d1ca0
......@@ -491,7 +491,7 @@ def RunSVN(args, in_directory):
SubprocessCall(c, in_directory)
def CaptureSVN(args, in_directory):
def CaptureSVN(args, in_directory=None, print_error=True):
"""Runs svn, capturing output sent to stdout as a string.
Args:
......@@ -508,10 +508,14 @@ def CaptureSVN(args, in_directory):
# the svn.exe executable, but shell=True makes subprocess on Linux fail
# when it's called with a list because it only tries to execute the
# first string ("svn").
stderr = None
if print_error:
stderr = subprocess.PIPE
return subprocess.Popen(c,
cwd=in_directory,
shell=(sys.platform == 'win32'),
stdout=subprocess.PIPE).communicate()[0]
stdout=subprocess.PIPE,
stderr=stderr).communicate()[0]
def RunSVNAndGetFileList(args, in_directory, file_list):
......@@ -560,7 +564,7 @@ def RunSVNAndGetFileList(args, in_directory, file_list):
capture_list=file_list)
def CaptureSVNInfo(relpath, in_directory=None):
def CaptureSVNInfo(relpath, in_directory=None, print_error=True):
"""Returns a dictionary from the svn info output for the given file.
Args:
......@@ -568,7 +572,7 @@ def CaptureSVNInfo(relpath, in_directory=None):
the directory given by in_directory.
in_directory: The directory where svn is to be run.
"""
output = CaptureSVN(["info", "--xml", relpath], in_directory)
output = CaptureSVN(["info", "--xml", relpath], in_directory, print_error)
dom = ParseXML(output)
result = {}
if dom:
......
......@@ -1273,7 +1273,8 @@ class SCMWrapperTestCase(GClientBaseTestCase):
</entry>
</info>
""" % self.url
gclient.CaptureSVN(['info', '--xml', self.url], '.').AndReturn(xml_text)
gclient.CaptureSVN(['info', '--xml', self.url],
'.', True).AndReturn(xml_text)
expected = {
'URL': 'http://src.chromium.org/svn/trunk/src/chrome/app/d',
'UUID': None,
......@@ -1286,7 +1287,7 @@ class SCMWrapperTestCase(GClientBaseTestCase):
'Node Kind': 'file',
}
self.mox.ReplayAll()
file_info = self._CaptureSVNInfo(self.url, '.')
file_info = self._CaptureSVNInfo(self.url, '.', True)
self.assertEquals(sorted(file_info.items()), sorted(expected.items()))
self.mox.VerifyAll()
......@@ -1314,9 +1315,10 @@ class SCMWrapperTestCase(GClientBaseTestCase):
</entry>
</info>
""" % (self.url, self.root_dir)
gclient.CaptureSVN(['info', '--xml', self.url], '.').AndReturn(xml_text)
gclient.CaptureSVN(['info', '--xml', self.url],
'.', True).AndReturn(xml_text)
self.mox.ReplayAll()
file_info = self._CaptureSVNInfo(self.url, '.')
file_info = self._CaptureSVNInfo(self.url, '.', True)
expected = {
'URL': self.url,
'UUID': '7b9385f5-0452-0410-af26-ad4892b7a1fb',
......
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