diff tests/test_fetch_branches.py @ 284:f8f9a2993705

Implement parseurl support (#revision in repository urls) Note: Normally when using parseurl, hg clone will treat the revision after # as if it was passed in as --rev, treats that rev as a head and won't clone beyond that. This wasn't implemented here, hence all the TODO's in the comments. All we do is use the checkout parameter where appropriate to update the wc to the selected revision.
author Martijn Pieters <mj@zopatista.com>
date Mon, 27 Apr 2009 09:39:39 -0500
parents 60acc38eac96
children 942f198b8ff5
line wrap: on
line diff
--- a/tests/test_fetch_branches.py
+++ b/tests/test_fetch_branches.py
@@ -1,8 +1,11 @@
 import unittest
 
+from mercurial import hg
 from mercurial import node
+from mercurial import ui
 
 import test_util
+import wrappers
 
 
 class TestFetchBranches(test_util.TestBase):
@@ -11,6 +14,12 @@ class TestFetchBranches(test_util.TestBa
                                                 self.wc_path, stupid=stupid,
                                                 noupdate=noupdate)
 
+    def _load_fixture_and_fetch_with_anchor(self, fixture_name, anchor):
+        test_util.load_svndump_fixture(self.repo_path, fixture_name)
+        source = '%s#%s' % (test_util.fileurl(self.repo_path), anchor)
+        wrappers.clone(None, ui.ui(), source=source, dest=self.wc_path)
+        return hg.repository(ui.ui(), self.wc_path)
+
     def test_unrelatedbranch(self, stupid=False):
         repo = self._load_fixture_and_fetch('unrelatedbranch.svndump', stupid)
         heads = [repo[n] for n in repo.heads()]
@@ -68,6 +77,12 @@ 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):
+        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]])
 
 def suite():
     all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchBranches),