Commit 3031d733 authored by stip@chromium.org's avatar stip@chromium.org

Revert of Run `svn cleanup` before every update and reset....

Revert of Run `svn cleanup` before every update and reset. (https://chromiumcodereview.appspot.com/240503007/)

Reason for revert:
It's inconclusive if this actually helped the bots, so reverting.

Original issue's description:
> Run `svn cleanup` before every update and reset.
> 
> Testing on a bot with an 'unclean' Chromium checkout:
> 
> Unpatched `gclient revert -v -v -v --nohooks --upstream` (unclean checkout)
> real    9m14.280s
> user    0m37.238s
> sys     0m37.738s
> 
> Patched 'gclient revert -v -v -v --nohooks --upstream'  (unclean checkout)
> real    5m50.065s
> user    1m18.889s
> sys     0m57.860s
> 
> ---------------- after patched gclient revert run (cleans the checkout)
> 
> Unpatched 'gclient revert -v -v -v --nohooks --upstream' (clean checkout)
> real    0m21.602s
> user    0m24.966s
> sys     0m13.969s
> 
> Patched 'gclient revert -v -v -v --nohooks --upstream' (clean checkout)
> real    0m27.467s
> user    0m28.382s
> sys     0m22.629s
> 
> BUG=336983
> 
> Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=264753

TBR=dpranke@chromium.org,iannucci@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=336983

Review URL: https://codereview.chromium.org/245293003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@265093 0039d316-1c4b-4281-b951-d872f2087c98
parent 98e82e1d
......@@ -1196,13 +1196,18 @@ class SVNWrapper(SCMWrapper):
'Try using @unmanaged.\n%s') % (
self.checkout_path, from_info))
try:
self._Run(['cleanup', self.checkout_path], options)
except subprocess2.CalledProcessError, e:
# Look for locked directories.
dir_info = scm.SVN.CaptureStatus(
None, os.path.join(self.checkout_path, '.'))
if any(d[0][2] == 'L' for d in dir_info):
# Look for locked directories.
dir_info = scm.SVN.CaptureStatus(
None, os.path.join(self.checkout_path, '.'))
if any(d[0][2] == 'L' for d in dir_info):
try:
self._Run(['cleanup', self.checkout_path], options)
except subprocess2.CalledProcessError, e:
# Get the status again, svn cleanup may have cleaned up at least
# something.
dir_info = scm.SVN.CaptureStatus(
None, os.path.join(self.checkout_path, '.'))
# Try to fix the failures by removing troublesome files.
for d in dir_info:
if d[0][2] == 'L':
......@@ -1355,8 +1360,6 @@ class SVNWrapper(SCMWrapper):
# Don't reuse the args.
return self.update(options, [], file_list)
self._Run(['cleanup', self.checkout_path], options)
def printcb(file_status):
if file_list is not None:
file_list.append(file_status[1])
......
......@@ -233,9 +233,6 @@ class SVNWrapperTestCase(BaseTestCase):
gclient_scm.scm.SVN.CaptureStatus(
None, self.base_path, no_ignore=False).AndReturn([])
gclient_scm.os.path.isdir(self.base_path).AndReturn(True)
gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(['svn',
'cleanup', self.base_path],
always=True, cwd=self.base_path)
gclient_scm.scm.SVN.RunAndGetFileList(
options.verbose,
['update', '--revision', 'BASE', '--ignore-externals'],
......@@ -257,9 +254,6 @@ class SVNWrapperTestCase(BaseTestCase):
]
gclient_scm.scm.SVN.CaptureStatus(
None, self.base_path, no_ignore=False).AndReturn(items)
gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(['svn',
'cleanup', self.base_path],
always=True, cwd=self.base_path)
file_path = join(self.base_path, 'a')
gclient_scm.os.path.exists(file_path).AndReturn(True)
gclient_scm.os.path.isfile(file_path).AndReturn(False)
......@@ -299,9 +293,6 @@ class SVNWrapperTestCase(BaseTestCase):
gclient_scm.gclient_utils.rmtree(file_path)
# pylint: disable=E1120
gclient_scm.os.path.isdir(self.base_path).AndReturn(False)
gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(['svn',
'cleanup', self.base_path],
always=True, cwd=self.base_path)
gclient_scm.SVNWrapper.update(options, [], ['.'])
self.mox.ReplayAll()
......@@ -376,6 +367,9 @@ class SVNWrapperTestCase(BaseTestCase):
dotted_path = join(self.base_path, '.')
gclient_scm.scm.SVN._CaptureInfo([], dotted_path).AndReturn(file_info)
# Verify no locked files.
gclient_scm.scm.SVN.CaptureStatus(None, dotted_path).AndReturn([])
# Cheat a bit here.
gclient_scm.scm.SVN._CaptureInfo([file_info['URL']], None
).AndReturn(file_info)
......@@ -392,9 +386,6 @@ class SVNWrapperTestCase(BaseTestCase):
additional_args = ['--revision', str(file_info['Revision'])]
additional_args.extend(['--force', '--ignore-externals'])
files_list = []
gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(['svn',
'cleanup', self.base_path],
always=True, cwd=self.base_path)
gclient_scm.scm.SVN.RunAndGetFileList(
options.verbose,
['update', self.base_path] + additional_args,
......@@ -424,16 +415,15 @@ class SVNWrapperTestCase(BaseTestCase):
gclient_scm.scm.SVN._CaptureInfo([], dotted_path).AndReturn(file_info)
# Create an untracked file and directory.
gclient_scm.scm.SVN.CaptureStatus(None, dotted_path
).AndReturn([['? ', 'dir'], ['? ', 'file']])
gclient_scm.scm.SVN._CaptureInfo([file_info['URL']], None
).AndReturn(file_info)
gclient_scm.scm.SVN._CaptureInfo([], self.base_path+'/.'
).AndReturn({'Revision': 100})
gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(['svn',
'cleanup', self.base_path],
always=True, cwd=self.base_path)
self.mox.ReplayAll()
files_list = []
scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
......@@ -452,27 +442,25 @@ class SVNWrapperTestCase(BaseTestCase):
'UUID': 'ABC',
'Revision': 42,
}
gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False)
self.mox.StubOutWithMock(gclient_scm.scm.GIT, 'IsGitSvn', True)
gclient_scm.scm.GIT.IsGitSvn(self.base_path).AndReturn(False)
gclient_scm.os.path.exists(self.base_path).AndReturn(True)
gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(['svn',
'cleanup', self.base_path],
always=True, cwd=self.base_path)
# Checkout or update.
dotted_path = join(self.base_path, '.')
gclient_scm.scm.SVN._CaptureInfo([], dotted_path).AndReturn(file_info)
# Create an untracked file and directory.
gclient_scm.scm.SVN.CaptureStatus(None, dotted_path
).AndReturn([['? ', 'dir'], ['? ', 'file']])
gclient_scm.scm.SVN._CaptureInfo([file_info['URL']], None
).AndReturn(file_info)
# Confirm that the untracked file is removed.
gclient_scm.scm.SVN.CaptureStatus(None, self.base_path
).AndReturn([['? ', 'dir'], ['? ', 'file']])
gclient_scm.os.path.isdir(join(self.base_path, 'dir')).AndReturn(True)
gclient_scm.os.path.isdir(join(self.base_path, 'file')).AndReturn(False)
gclient_scm.os.path.islink(join(self.base_path, 'dir')).AndReturn(False)
......@@ -504,7 +492,9 @@ class SVNWrapperTestCase(BaseTestCase):
gclient_scm.os.path.exists(join(self.base_path, '.svn')).AndReturn(False)
gclient_scm.os.path.exists(join(self.base_path, 'DEPS')).AndReturn(False)
# Verify no locked files.
dotted_path = join(self.base_path, '.')
gclient_scm.scm.SVN.CaptureStatus(None, dotted_path).AndReturn([])
# When checking out a single file, we issue an svn checkout and svn update.
files_list = self.mox.CreateMockAnything()
......@@ -512,9 +502,6 @@ class SVNWrapperTestCase(BaseTestCase):
['svn', 'checkout', '--depth', 'empty', self.url, self.base_path],
always=True,
cwd=self.root_dir)
gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(['svn',
'cleanup', self.base_path],
always=True, cwd=self.base_path)
gclient_scm.scm.SVN.RunAndGetFileList(
options.verbose,
['update', 'DEPS', '--ignore-externals'],
......@@ -576,17 +563,16 @@ class SVNWrapperTestCase(BaseTestCase):
gclient_scm.os.path.exists(join(self.base_path, 'DEPS')).AndReturn(True)
gclient_scm.os.remove(join(self.base_path, 'DEPS'))
# Verify no locked files.
gclient_scm.scm.SVN.CaptureStatus(
None, join(self.base_path, '.')).AndReturn([])
# When checking out a single file, we issue an svn checkout and svn update.
files_list = self.mox.CreateMockAnything()
gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(
['svn', 'checkout', '--depth', 'empty', self.url, self.base_path],
always=True,
cwd=self.root_dir)
gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(['svn',
'cleanup', self.base_path],
always=True, cwd=self.base_path)
gclient_scm.scm.SVN.RunAndGetFileList(
options.verbose,
['update', 'DEPS', '--ignore-externals'],
......@@ -625,9 +611,9 @@ class SVNWrapperTestCase(BaseTestCase):
).AndReturn('1.5.1')
gclient_scm.os.path.exists(join(self.base_path, '.svn')).AndReturn(True)
gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(['svn',
'cleanup', self.base_path],
always=True, cwd=self.base_path)
# Verify no locked files.
gclient_scm.scm.SVN.CaptureStatus(None, join(self.base_path, '.')
).AndReturn([])
# Now we fall back on scm.update().
files_list = self.mox.CreateMockAnything()
......
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