changeset 344:4dfab1b8b7be

Mention what failed when given a non-numeric revision to clone/pull. Replace test_branch_tip_update_to_branch_anchor with test_branch_pull_anchor
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Wed, 20 May 2009 21:15:47 +0200
parents 49e6895ce041
children 49a656155a92
files hgsubversion/svnrepo.py hgsubversion/wrappers.py tests/test_fetch_branches.py
diffstat 3 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/svnrepo.py
+++ b/hgsubversion/svnrepo.py
@@ -63,7 +63,7 @@ def generate_repo_class(ui, repo):
             lock = self.wlock()
             try:
                 wrappers.pull(self, source=remote.svnurl,
-                              rev=heads, force=force)
+                              heads=heads, force=force)
             finally:
                 lock.release()
 
--- a/hgsubversion/wrappers.py
+++ b/hgsubversion/wrappers.py
@@ -194,7 +194,7 @@ def push(repo, dest="default", force=Fal
     return 0
 
 
-def pull(repo, source="default", rev=None, force=False):
+def pull(repo, source="default", heads=None, force=False):
     """pull new revisions from Subversion
 
     Also takes svn, svn_stupid, and create_new_dest kwargs.
@@ -203,7 +203,7 @@ def pull(repo, source="default", rev=Non
     svn_url = util.normalize_url(url)
 
     # Split off #rev
-    svn_url, revs, checkout = hg.parseurl(svn_url, rev)
+    svn_url, heads, checkout = hg.parseurl(svn_url, heads)
     old_encoding = util.swap_out_encoding()
 
     # TODO implement skipto support
@@ -211,8 +211,8 @@ def pull(repo, source="default", rev=Non
     try:
         stopat_rev = int(checkout or 0)
     except ValueError:
-        raise hgutil.Abort('unrecognised Subversion revision; '
-                           'only numbers work.')
+        raise hgutil.Abort('unrecognised Subversion revision %s: '
+                           'only numbers work.' % checkout)
 
     have_replay = not repo.ui.configbool('hgsubversion', 'stupid')
     if have_replay and not callable(
--- a/tests/test_fetch_branches.py
+++ b/tests/test_fetch_branches.py
@@ -3,6 +3,7 @@ import unittest
 from mercurial import hg
 from mercurial import node
 from mercurial import ui
+from mercurial import util as hgutil
 
 import test_util
 
@@ -78,11 +79,13 @@ class TestFetchBranches(test_util.TestBa
     def test_branch_tip_update_to_default_stupid(self):
         self.test_branch_tip_update_to_default(True)
 
-    def test_branch_tip_update_to_branch_anchor(self):
+    def test_branch_pull_anchor(self):
+        self.assertRaises(hgutil.Abort,
+                          self._load_fixture_and_fetch_with_anchor,
+                          'unorderedbranch.svndump', 'NaN')
         repo = self._load_fixture_and_fetch_with_anchor(
-            'unorderedbranch.svndump', 'branch')
-        self.assertEqual(repo[None].branch(), 'branch')
-        self.assertEqual(repo[None].parents()[0], repo[repo.branchheads()[0]])
+            'unorderedbranch.svndump', '4')
+        self.assertTrue('c' not in repo.branchtags())
 
     def test_branches_weird_moves(self, stupid=False):
         repo = self._load_fixture_and_fetch('renamedproject.svndump', stupid,