changeset 868:cc1c870f1758

test_util: pass repo_path to _add_svn_rev() explicitely
author Patrick Mezard <patrick@mezard.eu>
date Thu, 19 Apr 2012 18:29:29 +0200
parents 50c13e01c7e3
children db3a651494f9
files tests/test_pull.py tests/test_single_dir_clone.py tests/test_util.py
diffstat 3 files changed, 17 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test_pull.py
+++ b/tests/test_pull.py
@@ -12,8 +12,9 @@ class TestPull(test_util.TestBase):
         super(TestPull, self).setUp()
 
     def _loadupdate(self, fixture_name):
-        return self._load_fixture_and_fetch(fixture_name, stupid=False,
-                                            noupdate=False)
+        repo, repo_path = self.load_and_fetch(fixture_name, stupid=False,
+                                              noupdate=False)
+        return repo, repo_path
 
     def test_nochanges(self):
         self._loadupdate('single_rev.svndump')
@@ -22,26 +23,26 @@ class TestPull(test_util.TestBase):
         self.assertEqual(state, self.repo.parents())
 
     def test_onerevision_noupdate(self):
-        repo = self._loadupdate('single_rev.svndump')
+        repo, repo_path = self._loadupdate('single_rev.svndump')
         state = repo.parents()
-        self._add_svn_rev({'trunk/alpha': 'Changed'})
+        self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed'})
         commands.pull(self.repo.ui, repo)
         self.assertEqual(state, repo.parents())
         self.assertTrue('tip' not in repo[None].tags())
 
     def test_onerevision_doupdate(self):
-        repo = self._loadupdate('single_rev.svndump')
+        repo, repo_path = self._loadupdate('single_rev.svndump')
         state = repo.parents()
-        self._add_svn_rev({'trunk/alpha': 'Changed'})
+        self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed'})
         commands.pull(self.repo.ui, repo, update=True)
         self.failIfEqual(state, repo.parents())
         self.assertTrue('tip' in repo[None].tags())
 
     def test_onerevision_divergent(self):
-        repo = self._loadupdate('single_rev.svndump')
+        repo, repo_path = self._loadupdate('single_rev.svndump')
         self.commitchanges((('alpha', 'alpha', 'Changed another way'),))
         state = repo.parents()
-        self._add_svn_rev({'trunk/alpha': 'Changed one way'})
+        self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed one way'})
         try:
             commands.pull(self.repo.ui, repo, update=True)
         except hgutil.Abort:
@@ -52,7 +53,7 @@ class TestPull(test_util.TestBase):
         self.assertEqual(len(repo.heads()), 2)
 
     def test_tag_repull_doesnt_happen(self):
-        repo = self._loadupdate('branchtagcollision.svndump')
+        repo = self._loadupdate('branchtagcollision.svndump')[0]
         oldheads = map(node.hex, repo.heads())
         commands.pull(repo.ui, repo)
         self.assertEqual(oldheads, map(node.hex, repo.heads()))
--- a/tests/test_single_dir_clone.py
+++ b/tests/test_single_dir_clone.py
@@ -152,11 +152,11 @@ class TestSingleDir(test_util.TestBase):
         # Pushes two outgoing over one incoming svn rev
         # (used to cause an "unknown revision")
         # This can happen if someone committed to svn since our last pull (race).
-        repo = self._load_fixture_and_fetch('branch_from_tag.svndump',
-                                            stupid=False,
-                                            layout='single',
-                                            subdir='trunk')
-        self._add_svn_rev({'trunk/alpha': 'Changed'})
+        repo, repo_path = self.load_and_fetch('branch_from_tag.svndump',
+                                              stupid=False,
+                                              layout='single',
+                                              subdir='trunk')
+        self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed'})
         def file_callback(repo, memctx, path):
             return context.memfilectx(path=path,
                                       data='data of %s' % path,
--- a/tests/test_util.py
+++ b/tests/test_util.py
@@ -304,12 +304,12 @@ class TestBase(unittest.TestCase):
         repo, repo_path = self.load_and_fetch(*args, **kwargs)
         return repo
 
-    def _add_svn_rev(self, changes):
+    def add_svn_rev(self, repo_path, changes):
         '''changes is a dict of filename -> contents'''
         if self.svn_wc is None:
             self.svn_wc = os.path.join(self.tmpdir, 'testsvn_wc')
             subprocess.call([
-                'svn', 'co', '-q', fileurl(self.repo_path),
+                'svn', 'co', '-q', fileurl(repo_path),
                 self.svn_wc
             ],
             stdout=subprocess.PIPE, stderr=subprocess.STDOUT)