Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: tests/scm_unittest.py

Issue 6613025: Improve SVN.Revert() to catch more corner cases. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/gclient_scm_test.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/scm_unittest.py
diff --git a/tests/scm_unittest.py b/tests/scm_unittest.py
index 48882f95be94a177c522f78ef6bd5c7b6ef94bac..9089bbe20bbbaa74bac8ec1a4ca9e8a899590ef9 100755
--- a/tests/scm_unittest.py
+++ b/tests/scm_unittest.py
@@ -10,6 +10,7 @@
# Fixes include path.
from super_mox import SuperMoxTestBase
+import fake_repos
import scm
@@ -240,6 +241,54 @@ class SVNTestCase(BaseSCMTestCase):
self.assertEquals(info, [])
+class RealSvnTest(fake_repos.FakeReposTestBase):
+ # Tests that work with a checkout.
+ def setUp(self):
+ super(RealSvnTest, self).setUp()
+ self.FAKE_REPOS.setUpSVN()
+ self.svn_root = scm.os.path.join(self.root_dir, 'base')
+ scm.SVN.Capture(
+ ['checkout', self.svn_base + 'trunk/third_party', 'base'],
+ cwd=self.root_dir)
+ self.tree = self.mangle_svn_tree(('trunk/third_party@-1', ''),)
+
+ def _capture(self, cmd, **kwargs):
+ kwargs.setdefault('cwd', self.svn_root)
+ return scm.SVN.Capture(cmd, **kwargs)
+
+ def testCheckout(self):
+ # Checkout and verify the tree.
+ self.assertTree(self.tree, self.svn_root)
+
+ def testRevert(self):
+ # Mess around and make sure revert works for all corner cases.
+ # - svn add a file
+ # - svn add a file and delete it
+ # - Delete a file
+ # - svn delete a file
+ # - svn move a directory and svn rename files in it
+ self._capture(['move', 'foo', 'foo2'])
+ self._capture(
+ ['move',
+ scm.os.path.join('foo2', 'origin'),
+ scm.os.path.join('foo2', 'o')])
+ scm.os.remove(scm.os.path.join(self.svn_root, 'origin'))
+ self._capture(
+ ['propset', 'foo', 'bar',
+ scm.os.path.join(self.svn_root, 'prout', 'origin')])
+ fake_repos.rmtree(scm.os.path.join(self.svn_root, 'prout'))
+ with open(scm.os.path.join(self.svn_root, 'faa'), 'w') as f:
+ f.write('eh')
+ 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')])
+
+ scm.SVN.Revert(self.svn_root)
+ self._capture(['update', '--revision', 'base'])
+
+ self.assertTree(self.tree, self.svn_root)
+
+
if __name__ == '__main__':
import unittest
unittest.main()
« no previous file with comments | « tests/gclient_scm_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698