comparison tests/test_fetch_mappings.py @ 257:ffccf0080e54

Move wrappers for hg commands to their own module.
author Augie Fackler <durin42@gmail.com>
date Fri, 10 Apr 2009 22:38:29 -0500
parents 4950b18cf949
children 75f082b5897e
comparison
equal deleted inserted replaced
256:7932d098cb5f 257:ffccf0080e54
5 5
6 from mercurial import ui 6 from mercurial import ui
7 from mercurial import node 7 from mercurial import node
8 8
9 import test_util 9 import test_util
10 import svncommands 10 import wrappers
11 11
12 class MapTests(test_util.TestBase): 12 class MapTests(test_util.TestBase):
13 @property 13 @property
14 def authors(self): 14 def authors(self):
15 return os.path.join(self.tmpdir, 'authormap') 15 return os.path.join(self.tmpdir, 'authormap')
21 def test_author_map(self, stupid=False): 21 def test_author_map(self, stupid=False):
22 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump') 22 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
23 authormap = open(self.authors, 'w') 23 authormap = open(self.authors, 'w')
24 authormap.write("Augie=Augie Fackler <durin42@gmail.com>\n") 24 authormap.write("Augie=Augie Fackler <durin42@gmail.com>\n")
25 authormap.close() 25 authormap.close()
26 svncommands.pull(ui.ui(), svn_url=test_util.fileurl(self.repo_path), 26 wrappers.clone(None, ui.ui(), source=test_util.fileurl(self.repo_path),
27 hg_repo_path=self.wc_path, stupid=stupid, 27 dest=self.wc_path, stupid=stupid, svn_authors=self.authors)
28 authors=self.authors)
29 self.assertEqual(self.repo[0].user(), 28 self.assertEqual(self.repo[0].user(),
30 'Augie Fackler <durin42@gmail.com>') 29 'Augie Fackler <durin42@gmail.com>')
31 self.assertEqual(self.repo['tip'].user(), 30 self.assertEqual(self.repo['tip'].user(),
32 'evil@5b65bade-98f3-4993-a01f-b7a6710da339') 31 'evil@5b65bade-98f3-4993-a01f-b7a6710da339')
33 32
37 def test_author_map_closing_author(self, stupid=False): 36 def test_author_map_closing_author(self, stupid=False):
38 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump') 37 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
39 authormap = open(self.authors, 'w') 38 authormap = open(self.authors, 'w')
40 authormap.write("evil=Testy <test@test>") 39 authormap.write("evil=Testy <test@test>")
41 authormap.close() 40 authormap.close()
42 svncommands.pull(ui.ui(), svn_url=test_util.fileurl(self.repo_path), 41 wrappers.clone(None, ui.ui(), source=test_util.fileurl(self.repo_path),
43 hg_repo_path=self.wc_path, stupid=stupid, 42 dest=self.wc_path, stupid=stupid,
44 authors=self.authors) 43 svn_authors=self.authors)
45 self.assertEqual(self.repo[0].user(), 44 self.assertEqual(self.repo[0].user(),
46 'Augie@5b65bade-98f3-4993-a01f-b7a6710da339') 45 'Augie@5b65bade-98f3-4993-a01f-b7a6710da339')
47 self.assertEqual(self.repo['tip'].user(), 46 self.assertEqual(self.repo['tip'].user(),
48 'Testy <test@test>') 47 'Testy <test@test>')
49 48
53 def test_file_map(self, stupid=False): 52 def test_file_map(self, stupid=False):
54 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump') 53 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
55 filemap = open(self.filemap, 'w') 54 filemap = open(self.filemap, 'w')
56 filemap.write("include alpha\n") 55 filemap.write("include alpha\n")
57 filemap.close() 56 filemap.close()
58 svncommands.pull(ui.ui(), svn_url=test_util.fileurl(self.repo_path), 57 wrappers.clone(None, ui.ui(), source=test_util.fileurl(self.repo_path),
59 hg_repo_path=self.wc_path, stupid=stupid, 58 dest=self.wc_path, stupid=stupid,
60 filemap=self.filemap) 59 svn_filemap=self.filemap)
61 self.assertEqual(node.hex(self.repo[0].node()), '88e2c7492d83e4bf30fbb2dcbf6aa24d60ac688d') 60 self.assertEqual(node.hex(self.repo[0].node()), '88e2c7492d83e4bf30fbb2dcbf6aa24d60ac688d')
62 self.assertEqual(node.hex(self.repo['default'].node()), 'e524296152246b3837fe9503c83b727075835155') 61 self.assertEqual(node.hex(self.repo['default'].node()), 'e524296152246b3837fe9503c83b727075835155')
63 62
64 def test_file_map_stupid(self): 63 def test_file_map_stupid(self):
65 self.test_file_map(True) 64 self.test_file_map(True)
67 def test_file_map_exclude(self, stupid=False): 66 def test_file_map_exclude(self, stupid=False):
68 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump') 67 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
69 filemap = open(self.filemap, 'w') 68 filemap = open(self.filemap, 'w')
70 filemap.write("exclude alpha\n") 69 filemap.write("exclude alpha\n")
71 filemap.close() 70 filemap.close()
72 svncommands.pull(ui.ui(), svn_url=test_util.fileurl(self.repo_path), 71 wrappers.clone(None, ui.ui(), source=test_util.fileurl(self.repo_path),
73 hg_repo_path=self.wc_path, stupid=stupid, 72 dest=self.wc_path, stupid=stupid,
74 filemap=self.filemap) 73 svn_filemap=self.filemap)
75 self.assertEqual(node.hex(self.repo[0].node()), '2c48f3525926ab6c8b8424bcf5eb34b149b61841') 74 self.assertEqual(node.hex(self.repo[0].node()), '2c48f3525926ab6c8b8424bcf5eb34b149b61841')
76 self.assertEqual(node.hex(self.repo['default'].node()), 'b37a3c0297b71f989064d9b545b5a478bbed7cc1') 75 self.assertEqual(node.hex(self.repo['default'].node()), 'b37a3c0297b71f989064d9b545b5a478bbed7cc1')
77 76
78 def test_file_map_exclude_stupid(self): 77 def test_file_map_exclude_stupid(self):
79 self.test_file_map_exclude(True) 78 self.test_file_map_exclude(True)