comparison tests/test_fetch_mappings.py @ 574:8e025a6f0db4

add basic branchmap functionality, to rename branches
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Mon, 01 Mar 2010 22:10:18 +0100
parents 2851b81c65ce
children d96aa92d9ad9
comparison
equal deleted inserted replaced
573:00393e9abff8 574:8e025a6f0db4
17 return os.path.join(self.tmpdir, 'authormap') 17 return os.path.join(self.tmpdir, 'authormap')
18 18
19 @property 19 @property
20 def filemap(self): 20 def filemap(self):
21 return os.path.join(self.tmpdir, 'filemap') 21 return os.path.join(self.tmpdir, 'filemap')
22
23 @property
24 def branchmap(self):
25 return os.path.join(self.tmpdir, 'branchmap')
22 26
23 def test_author_map(self, stupid=False): 27 def test_author_map(self, stupid=False):
24 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump') 28 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
25 authormap = open(self.authors, 'w') 29 authormap = open(self.authors, 'w')
26 authormap.write('Augie=Augie Fackler <durin42@gmail.com> # stuffy\n') 30 authormap.write('Augie=Augie Fackler <durin42@gmail.com> # stuffy\n')
99 self.assertEqual(node.hex(self.repo['default'].node()), 'b37a3c0297b71f989064d9b545b5a478bbed7cc1') 103 self.assertEqual(node.hex(self.repo['default'].node()), 'b37a3c0297b71f989064d9b545b5a478bbed7cc1')
100 104
101 def test_file_map_exclude_stupid(self): 105 def test_file_map_exclude_stupid(self):
102 self.test_file_map_exclude(True) 106 self.test_file_map_exclude(True)
103 107
108 def test_branchmap(self, stupid=False):
109 test_util.load_svndump_fixture(self.repo_path, 'branchmap.svndump')
110 branchmap = open(self.branchmap, 'w')
111 branchmap.write("badname = good-name # stuffy\n")
112 branchmap.write("feature = default\n")
113 branchmap.close()
114 _ui = ui.ui()
115 _ui.setconfig('hgsubversion', 'stupid', str(stupid))
116 _ui.setconfig('hgsubversion', 'branchmap', self.branchmap)
117 commands.clone(_ui, test_util.fileurl(self.repo_path),
118 self.wc_path, branchmap=self.branchmap)
119 branches = set(self.repo[i].branch() for i in self.repo)
120 self.assert_('badname' not in branches)
121 self.assert_('good-name' in branches)
122 self.assertEquals(self.repo[2].branch(), 'default')
123
124 def test_branchmap_stupid(self):
125 self.test_branchmap(True)
126
104 127
105 def suite(): 128 def suite():
106 return unittest.TestLoader().loadTestsFromTestCase(MapTests) 129 return unittest.TestLoader().loadTestsFromTestCase(MapTests)