Mercurial > hgsubversion
comparison 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 |
comparison
equal
deleted
inserted
replaced
633:37b2adc64fb3 | 634:a400f3bf5611 |
---|---|
116 self.assertEquals(self.repo[2].branch(), 'default') | 116 self.assertEquals(self.repo[2].branch(), 'default') |
117 | 117 |
118 def test_branchmap_stupid(self): | 118 def test_branchmap_stupid(self): |
119 self.test_branchmap(True) | 119 self.test_branchmap(True) |
120 | 120 |
121 def test_branchmap_tagging(self, stupid=False): | |
122 '''test tagging a renamed branch, which used to raise an exception''' | |
123 test_util.load_svndump_fixture(self.repo_path, 'commit-to-tag.svndump') | |
124 branchmap = open(self.branchmap, 'w') | |
125 branchmap.write("magic = art\n") | |
126 branchmap.close() | |
127 ui = self.ui(stupid) | |
128 ui.setconfig('hgsubversion', 'branchmap', self.branchmap) | |
129 commands.clone(ui, test_util.fileurl(self.repo_path), | |
130 self.wc_path, branchmap=self.branchmap) | |
131 branches = set(self.repo[i].branch() for i in self.repo) | |
132 self.assertEquals(sorted(branches), ['art', 'closeme']) | |
133 | |
134 def test_branchmap_tagging_stupid(self): | |
135 self.test_branchmap_tagging(True) | |
121 | 136 |
122 def suite(): | 137 def suite(): |
123 return unittest.TestLoader().loadTestsFromTestCase(MapTests) | 138 return unittest.TestLoader().loadTestsFromTestCase(MapTests) |