comparison tests/test_fetch_mappings.py @ 851:9ce00cb1d676

Merge alternate tunnel schemes.
author Augie Fackler <durin42@gmail.com>
date Sat, 25 Feb 2012 14:51:22 -0600
parents 4e203a47102a
children 20e73b5ab6f7
comparison
equal deleted inserted replaced
850:d3bc067c0f72 851:9ce00cb1d676
24 return os.path.join(self.tmpdir, 'filemap') 24 return os.path.join(self.tmpdir, 'filemap')
25 25
26 @property 26 @property
27 def branchmap(self): 27 def branchmap(self):
28 return os.path.join(self.tmpdir, 'branchmap') 28 return os.path.join(self.tmpdir, 'branchmap')
29 29
30 @property 30 @property
31 def tagmap(self): 31 def tagmap(self):
32 return os.path.join(self.tmpdir, 'tagmap') 32 return os.path.join(self.tmpdir, 'tagmap')
33 33
34 def test_author_map(self, stupid=False): 34 def test_author_map(self, stupid=False):
94 new.write(open(orig).read()) 94 new.write(open(orig).read())
95 new.close() 95 new.close()
96 test = maps.AuthorMap(self.ui(), self.authors) 96 test = maps.AuthorMap(self.ui(), self.authors)
97 fromself = set(test) 97 fromself = set(test)
98 test.load(orig) 98 test.load(orig)
99 all = set(test) 99 all_tests = set(test)
100 self.assertEqual(fromself.symmetric_difference(all), set()) 100 self.assertEqual(fromself.symmetric_difference(all_tests), set())
101 101
102 def test_file_map(self, stupid=False): 102 def test_file_map(self, stupid=False):
103 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump') 103 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
104 filemap = open(self.filemap, 'w') 104 filemap = open(self.filemap, 'w')
105 filemap.write("include alpha\n") 105 filemap.write("include alpha\n")
110 self.wc_path, filemap=self.filemap) 110 self.wc_path, filemap=self.filemap)
111 self.assertEqual(node.hex(self.repo[0].node()), '88e2c7492d83e4bf30fbb2dcbf6aa24d60ac688d') 111 self.assertEqual(node.hex(self.repo[0].node()), '88e2c7492d83e4bf30fbb2dcbf6aa24d60ac688d')
112 self.assertEqual(node.hex(self.repo['default'].node()), 'e524296152246b3837fe9503c83b727075835155') 112 self.assertEqual(node.hex(self.repo['default'].node()), 'e524296152246b3837fe9503c83b727075835155')
113 113
114 def test_file_map_stupid(self): 114 def test_file_map_stupid(self):
115 self.test_file_map(True) 115 # TODO: re-enable test if we ever reinstate this feature
116 self.assertRaises(hgutil.Abort, self.test_file_map, True)
116 117
117 def test_file_map_exclude(self, stupid=False): 118 def test_file_map_exclude(self, stupid=False):
118 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump') 119 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
119 filemap = open(self.filemap, 'w') 120 filemap = open(self.filemap, 'w')
120 filemap.write("exclude alpha\n") 121 filemap.write("exclude alpha\n")
125 self.wc_path, filemap=self.filemap) 126 self.wc_path, filemap=self.filemap)
126 self.assertEqual(node.hex(self.repo[0].node()), '2c48f3525926ab6c8b8424bcf5eb34b149b61841') 127 self.assertEqual(node.hex(self.repo[0].node()), '2c48f3525926ab6c8b8424bcf5eb34b149b61841')
127 self.assertEqual(node.hex(self.repo['default'].node()), 'b37a3c0297b71f989064d9b545b5a478bbed7cc1') 128 self.assertEqual(node.hex(self.repo['default'].node()), 'b37a3c0297b71f989064d9b545b5a478bbed7cc1')
128 129
129 def test_file_map_exclude_stupid(self): 130 def test_file_map_exclude_stupid(self):
130 self.test_file_map_exclude(True) 131 # TODO: re-enable test if we ever reinstate this feature
132 self.assertRaises(hgutil.Abort, self.test_file_map_exclude, True)
133
134 def test_file_map_rule_order(self):
135 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
136 filemap = open(self.filemap, 'w')
137 filemap.write("exclude alpha\n")
138 filemap.write("include .\n")
139 filemap.write("exclude gamma\n")
140 filemap.close()
141 ui = self.ui(False)
142 ui.setconfig('hgsubversion', 'filemap', self.filemap)
143 commands.clone(ui, test_util.fileurl(self.repo_path),
144 self.wc_path, filemap=self.filemap)
145 # The exclusion of alpha is overridden by the later rule to
146 # include all of '.', whereas gamma should remain excluded
147 # because it's excluded after the root directory.
148 self.assertEqual(self.repo[0].manifest().keys(),
149 ['alpha', 'beta'])
150 self.assertEqual(self.repo['default'].manifest().keys(),
151 ['alpha', 'beta'])
131 152
132 def test_branchmap(self, stupid=False): 153 def test_branchmap(self, stupid=False):
133 test_util.load_svndump_fixture(self.repo_path, 'branchmap.svndump') 154 test_util.load_svndump_fixture(self.repo_path, 'branchmap.svndump')
134 branchmap = open(self.branchmap, 'w') 155 branchmap = open(self.branchmap, 'w')
135 branchmap.write("badname = good-name # stuffy\n") 156 branchmap.write("badname = good-name # stuffy\n")