diff tests/test_fetch_truncated.py @ 331:75f082b5897e

Switch to using url scheme wrappers instead of duplicating each command we wrap. The 'hg svn url' command has been killed; the replacement is '.hg/hgrc'. More stuff related to its disappearance has been stripped, including two tests. HgChangeReceiver now takes a UUID argument, which it uses to ensure that remote repositories remain unchanged. This is a temporary solution, and I'm not entirely satisfied with how it's done either. Access to the UUID file has been isolated in a HgChangeReceiver property. Some more tests have been updated to use ui.pushbuffer()/popbuffer(), and to pass through the Mercurial API. Moved the arguments to wrappers.pull() to the UI configuration. Also, remove HgChangeReceiver.opts in favour of a 'usebranchnames' instance & configuration variable. The name is taken from the ConvertExtension.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Fri, 15 May 2009 19:18:43 +0200
parents ffccf0080e54
children d96aa92d9ad9
line wrap: on
line diff
--- a/tests/test_fetch_truncated.py
+++ b/tests/test_fetch_truncated.py
@@ -1,39 +1,39 @@
-import unittest
-
-from mercurial import hg
-from mercurial import ui
-
-import wrappers
-import test_util
-
-class TestFetchTruncatedHistory(test_util.TestBase):
-    def test_truncated_history(self, stupid=False):
-        # Test repository does not follow the usual layout
-        test_util.load_svndump_fixture(self.repo_path, 'truncatedhistory.svndump')
-        svn_url = test_util.fileurl(self.repo_path + '/project2')
-        wrappers.clone(None, ui.ui(), source=svn_url,
-                       dest=self.wc_path, stupid=stupid,
-                       noupdate=True)
-        repo = hg.repository(ui.ui(), self.wc_path)
-
-        # We are converting /project2/trunk coming from:
-        #
-        # Changed paths:
-        #     D /project1
-        #     A /project2/trunk (from /project1:2)
-        #
-        # Here a full fetch should be performed since we are starting
-        # the conversion on an already filled branch.
-        tip = repo['tip']
-        files = tip.manifest().keys()
-        files.sort()
-        self.assertEqual(files, ['a', 'b'])
-        self.assertEqual(repo['tip']['a'].data(), 'a\n')
-
-    def test_truncated_history_stupid(self):
-        self.test_truncated_history(True)
-
-def suite():
-    all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchTruncatedHistory),
-          ]
-    return unittest.TestSuite(all)
+import unittest
+
+from mercurial import commands
+from mercurial import hg
+from mercurial import ui
+
+import test_util
+
+class TestFetchTruncatedHistory(test_util.TestBase):
+    def test_truncated_history(self, stupid=False):
+        # Test repository does not follow the usual layout
+        test_util.load_svndump_fixture(self.repo_path, 'truncatedhistory.svndump')
+        svn_url = test_util.fileurl(self.repo_path + '/project2')
+        _ui = ui.ui()
+        _ui.setconfig('hgsubversion', 'stupid', str(stupid))
+        commands.clone(_ui, svn_url, self.wc_path, noupdate=True)
+        repo = hg.repository(_ui, self.wc_path)
+
+        # We are converting /project2/trunk coming from:
+        #
+        # Changed paths:
+        #     D /project1
+        #     A /project2/trunk (from /project1:2)
+        #
+        # Here a full fetch should be performed since we are starting
+        # the conversion on an already filled branch.
+        tip = repo['tip']
+        files = tip.manifest().keys()
+        files.sort()
+        self.assertEqual(files, ['a', 'b'])
+        self.assertEqual(repo['tip']['a'].data(), 'a\n')
+
+    def test_truncated_history_stupid(self):
+        self.test_truncated_history(True)
+
+def suite():
+    all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchTruncatedHistory),
+          ]
+    return unittest.TestSuite(all)