Commit 924158a7 authored by maruel@chromium.org's avatar maruel@chromium.org

Add code to correctly revert a svn add'ed file.

Improve test to make sure svn status comes out clean.

TEST=improved unit tests and scm.SVN.Revert() should now do the right thing
BUG=none

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@77391 0039d316-1c4b-4281-b951-d872f2087c98
parent ee2fa069
......@@ -878,7 +878,7 @@ class SVN(object):
# svn revert is really stupid. It fails on inconsistent line-endings,
# on switched directories, etc. So take no chance and delete everything!
if file_status[0][0] in ('D', 'A') or file_status[0][2] != ' ':
if file_status[0][0] in ('D', 'A', '!') or file_status[0][2] != ' ':
# Added, deleted file requires manual intervention and require calling
# revert, like for properties.
try:
......
......@@ -282,11 +282,18 @@ class RealSvnTest(fake_repos.FakeReposTestBase):
with open(scm.os.path.join(self.svn_root, 'faala'), 'w') as f:
f.write('oh')
self._capture(['add', scm.os.path.join(self.svn_root, 'faala')])
added_and_removed = scm.os.path.join(self.svn_root, 'added_and_removed')
with open(added_and_removed, 'w') as f:
f.write('oh')
self._capture(['add', added_and_removed])
scm.os.remove(added_and_removed)
scm.SVN.Revert(self.svn_root)
self._capture(['update', '--revision', 'base'])
self.assertTree(self.tree, self.svn_root)
# Asserting the tree is not sufficient, svn status must come out clear too.
self.assertEquals('', self._capture(['status']))
if __name__ == '__main__':
......
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