diff tests/test_pull.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 521d9c1bb11d
children 76c833526fbc
line wrap: on
line diff
--- a/tests/test_pull.py
+++ b/tests/test_pull.py
@@ -3,9 +3,8 @@ import test_util
 import os.path
 import subprocess
 from mercurial import ui
-
-import wrappers
-
+from mercurial import util as hgutil
+from mercurial import commands
 
 class TestPull(test_util.TestBase):
     def setUp(self):
@@ -22,30 +21,34 @@ class TestPull(test_util.TestBase):
         if self.svn_wc is None:
             self.svn_wc = os.path.join(self.tmpdir, 'testsvn_wc')
             subprocess.call([
-                'svn', 'co', '-q', test_util.fileurl(self.repo_path), 
+                'svn', 'co', '-q', test_util.fileurl(self.repo_path)[4:], 
                 self.svn_wc
-            ])
+            ],
+            stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
 
         for filename, contents in changes.iteritems():
             # filenames are / separated
             filename = filename.replace('/', os.path.sep)
             filename = os.path.join(self.svn_wc, filename)
             open(filename, 'w').write(contents)
-            subprocess.call(['svn', 'add', '-q', filename]) # may be redundant
+            # may be redundant
+            subprocess.call(['svn', 'add', '-q', filename],
+                            stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
         subprocess.call([
-            'svn', 'commit', '-q', self.svn_wc, '-m', 'test changes'])
+            'svn', 'commit', '-q', self.svn_wc, '-m', 'test changes'],
+            stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
 
     def test_nochanges(self):
-        repo = self._load_fixture_and_fetch('single_rev.svndump')
-        state = repo.parents()
-        wrappers.pull(None, ui.ui(), repo)
-        self.assertEqual(state, repo.parents())
+        self._load_fixture_and_fetch('single_rev.svndump')
+        state = self.repo.parents()
+        commands.pull(self.repo.ui, self.repo)
+        self.assertEqual(state, self.repo.parents())
 
     def test_onerevision_noupdate(self):
         repo = self._load_fixture_and_fetch('single_rev.svndump')
         state = repo.parents()
         self._add_svn_rev({'trunk/alpha': 'Changed'})
-        wrappers.pull(None, ui.ui(), repo)
+        commands.pull(self.repo.ui, repo)
         self.assertEqual(state, repo.parents())
         self.assertTrue('tip' not in repo[None].tags())
     
@@ -53,7 +56,7 @@ class TestPull(test_util.TestBase):
         repo = self._load_fixture_and_fetch('single_rev.svndump')
         state = repo.parents()
         self._add_svn_rev({'trunk/alpha': 'Changed'})
-        wrappers.pull(None, ui.ui(), repo, update=True)
+        commands.pull(self.repo.ui, repo, update=True)
         self.failIfEqual(state, repo.parents())
         self.assertTrue('tip' in repo[None].tags())
 
@@ -62,7 +65,8 @@ class TestPull(test_util.TestBase):
         self.commitchanges((('alpha', 'alpha', 'Changed another way'),))
         state = repo.parents()
         self._add_svn_rev({'trunk/alpha': 'Changed one way'})
-        wrappers.pull(None, ui.ui(), repo, update=True)
+        self.assertRaises(hgutil.Abort, commands.pull,
+                          self.repo.ui, repo, update=True)
         self.assertEqual(state, repo.parents())
         self.assertTrue('tip' not in repo[None].tags())
         self.assertEqual(len(repo.heads()), 2)