diff tests/test_fetch_mappings.py @ 634:a400f3bf5611

replay/stupid: fix tagging on a branch renamed using a branch map Previously, both convert_rev() functions used parentctx.extra() to determine the branch to pass to meta.movetag(). This assumed that the branch name stored in the changeset matches the internal branch. The introduction of branch maps made this assumption unsafe, however: Now, the Mercurial branch can be completely unrelated to the origin of the changeset. It turns out, however, that movetag() already has sufficient knowledge to determine the branch. Given the hash of the new changeset to be tagged, we walk its ancestors until we find an open changeset, which we then know to be the originating branch. This assumes that there were `few' commits made to the tag; an assumption I would consider reasonable.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Sun, 11 Jul 2010 11:46:19 +0200
parents d96aa92d9ad9
children e2c3349b2cca
line wrap: on
line diff
--- a/tests/test_fetch_mappings.py
+++ b/tests/test_fetch_mappings.py
@@ -118,6 +118,21 @@ class MapTests(test_util.TestBase):
     def test_branchmap_stupid(self):
         self.test_branchmap(True)
 
+    def test_branchmap_tagging(self, stupid=False):
+        '''test tagging a renamed branch, which used to raise an exception'''
+        test_util.load_svndump_fixture(self.repo_path, 'commit-to-tag.svndump')
+        branchmap = open(self.branchmap, 'w')
+        branchmap.write("magic = art\n")
+        branchmap.close()
+        ui = self.ui(stupid)
+        ui.setconfig('hgsubversion', 'branchmap', self.branchmap)
+        commands.clone(ui, test_util.fileurl(self.repo_path),
+                       self.wc_path, branchmap=self.branchmap)
+        branches = set(self.repo[i].branch() for i in self.repo)
+        self.assertEquals(sorted(branches), ['art', 'closeme'])
+
+    def test_branchmap_tagging_stupid(self):
+        self.test_branchmap_tagging(True)
 
 def suite():
     return unittest.TestLoader().loadTestsFromTestCase(MapTests)