Mercurial > hgsubversion
comparison tests/test_fetch_mappings.py @ 641:67513cca972f
rebuildmeta: handle mapped branch names.
| author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
|---|---|
| date | Tue, 13 Jul 2010 12:19:16 +0200 |
| parents | b2c8c2079822 |
| children | d2ef7220a079 |
comparison
equal
deleted
inserted
replaced
| 640:a3d20d6e96b0 | 641:67513cca972f |
|---|---|
| 2 """ | 2 """ |
| 3 import os | 3 import os |
| 4 import unittest | 4 import unittest |
| 5 | 5 |
| 6 from mercurial import commands | 6 from mercurial import commands |
| 7 from mercurial import hg | |
| 7 from mercurial import node | 8 from mercurial import node |
| 8 from mercurial import util as hgutil | 9 from mercurial import util as hgutil |
| 9 | 10 |
| 10 import test_util | 11 import test_util |
| 11 | 12 |
| 12 from hgsubversion import maps | 13 from hgsubversion import maps |
| 14 from hgsubversion import svncommands | |
| 13 | 15 |
| 14 class MapTests(test_util.TestBase): | 16 class MapTests(test_util.TestBase): |
| 15 @property | 17 @property |
| 16 def authors(self): | 18 def authors(self): |
| 17 return os.path.join(self.tmpdir, 'authormap') | 19 return os.path.join(self.tmpdir, 'authormap') |
| 175 | 177 |
| 176 def test_branchmap_combine_stupid(self): | 178 def test_branchmap_combine_stupid(self): |
| 177 '''test combining two branches, but retaining heads (stupid)''' | 179 '''test combining two branches, but retaining heads (stupid)''' |
| 178 self.test_branchmap_combine(True) | 180 self.test_branchmap_combine(True) |
| 179 | 181 |
| 182 def test_branchmap_rebuildmeta(self, stupid=False): | |
| 183 '''test rebuildmeta on a branchmapped clone''' | |
| 184 test_util.load_svndump_fixture(self.repo_path, 'branchmap.svndump') | |
| 185 branchmap = open(self.branchmap, 'w') | |
| 186 branchmap.write("badname = dit\n") | |
| 187 branchmap.write("feature = dah\n") | |
| 188 branchmap.close() | |
| 189 ui = self.ui(stupid) | |
| 190 ui.setconfig('hgsubversion', 'branchmap', self.branchmap) | |
| 191 commands.clone(ui, test_util.fileurl(self.repo_path), | |
| 192 self.wc_path, branchmap=self.branchmap) | |
| 193 originfo = self.repo.svnmeta().branches | |
| 194 | |
| 195 # clone & rebuild | |
| 196 ui = self.ui(stupid) | |
| 197 src, dest = hg.clone(ui, self.wc_path, self.wc_path + '_clone', | |
| 198 update=False) | |
| 199 svncommands.rebuildmeta(ui, dest, | |
| 200 args=[test_util.fileurl(self.repo_path)]) | |
| 201 | |
| 202 # just check the keys; assume the contents are unaffected by the branch | |
| 203 # map and thus properly tested by other tests | |
| 204 self.assertEquals(sorted(src.svnmeta().branches), | |
| 205 sorted(dest.svnmeta().branches)) | |
| 206 | |
| 207 def test_branchmap_rebuildmeta_stupid(self): | |
| 208 '''test rebuildmeta on a branchmapped clone (stupid)''' | |
| 209 self.test_branchmap_rebuildmeta(True) | |
| 210 | |
| 180 def test_branchmap_no_replacement(self): | 211 def test_branchmap_no_replacement(self): |
| 181 ''' | 212 ''' |
| 182 test that empty mappings are rejected | 213 test that empty mappings are rejected |
| 183 | 214 |
| 184 Empty mappings are lines like 'this ='. The most sensible thing to do | 215 Empty mappings are lines like 'this ='. The most sensible thing to do |
