Commit ea15cb77 authored by maruel@chromium.org's avatar maruel@chromium.org

Make checkout.*.prepare() delete the svn:ignored files.

Add corresponding support to scm.SVN.Revert() to clobber the svn:ignore'd files.

This makes the commit queue remove all the unversioned files, which could have
improved its stability. It failed in practice to improve it but it's still a
good thing to do overall.

R=petermayo@chromium.org
BUG=
TEST=


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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@135333 0039d316-1c4b-4281-b951-d872f2087c98
parent 2c96af7d
......@@ -393,7 +393,7 @@ class SvnCheckout(CheckoutBase, SvnMixIn):
self._check_call_svn(
['checkout', self.svn_url, self.project_path] + flags, cwd=None)
else:
scm.SVN.Revert(self.project_path)
scm.SVN.Revert(self.project_path, no_ignore=True)
# Revive files that were deleted in scm.SVN.Revert().
self._check_call_svn(['update', '--force'] + flags)
return self._get_revision()
......
......@@ -621,13 +621,15 @@ class SVN(object):
return SVN.CaptureLocalInfo([], cwd).get('Revision')
@staticmethod
def CaptureStatus(files, cwd):
def CaptureStatus(files, cwd, no_ignore=False):
"""Returns the svn 1.5 svn status emulated output.
@files can be a string (one file) or a list of files.
Returns an array of (status, file) tuples."""
command = ["status", "--xml"]
if no_ignore:
command.append('--no-ignore')
if not files:
pass
elif isinstance(files, basestring):
......@@ -1007,7 +1009,7 @@ class SVN(object):
return (True, cls.current_version)
@staticmethod
def Revert(cwd, callback=None, ignore_externals=False):
def Revert(cwd, callback=None, ignore_externals=False, no_ignore=False):
"""Reverts all svn modifications in cwd, including properties.
Deletes any modified files or directory.
......@@ -1015,7 +1017,7 @@ class SVN(object):
A "svn update --revision BASE" call is required after to revive deleted
files.
"""
for file_status in SVN.CaptureStatus(None, cwd):
for file_status in SVN.CaptureStatus(None, cwd, no_ignore=no_ignore):
file_path = os.path.join(cwd, file_status[1])
if (ignore_externals and
file_status[0][0] == 'X' and
......
......@@ -239,7 +239,8 @@ class SVNWrapperTestCase(BaseTestCase):
options = self.Options(verbose=True)
gclient_scm.os.path.isdir(self.base_path).AndReturn(True)
gclient_scm.os.path.isdir(join(self.base_path, '.svn')).AndReturn(True)
gclient_scm.scm.SVN.CaptureStatus(None, self.base_path).AndReturn([])
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.scm.SVN.RunAndGetFileList(
options.verbose,
......@@ -260,7 +261,8 @@ class SVNWrapperTestCase(BaseTestCase):
items = [
('~ ', 'a'),
]
gclient_scm.scm.SVN.CaptureStatus(None, self.base_path).AndReturn(items)
gclient_scm.scm.SVN.CaptureStatus(
None, self.base_path, no_ignore=False).AndReturn(items)
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)
......@@ -289,7 +291,8 @@ class SVNWrapperTestCase(BaseTestCase):
items = [
('~ ', '.'),
]
gclient_scm.scm.SVN.CaptureStatus(None, self.base_path).AndReturn(items)
gclient_scm.scm.SVN.CaptureStatus(
None, self.base_path, no_ignore=False).AndReturn(items)
# RemoveDirectory() doesn't work on path ending with '.', like 'foo/.'.
file_path = self.base_path
gclient_scm.os.path.exists(file_path).AndReturn(True)
......
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