comparison tests/test_fetch_mappings.py @ 304:ce676eff002b

First merge, totally untested.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Fri, 01 May 2009 10:28:59 +0200
parents ffccf0080e54
children 75f082b5897e
comparison
equal deleted inserted replaced
303:f423a8780832 304:ce676eff002b
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 fetch_command 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 fetch_command.fetch_revisions(ui.ui(), 26 wrappers.clone(None, ui.ui(), source=test_util.fileurl(self.repo_path),
27 svn_url=test_util.fileurl(self.repo_path), 27 dest=self.wc_path, stupid=stupid, svn_authors=self.authors)
28 hg_repo_path=self.wc_path,
29 stupid=stupid,
30 authors=self.authors)
31 self.assertEqual(self.repo[0].user(), 28 self.assertEqual(self.repo[0].user(),
32 'Augie Fackler <durin42@gmail.com>') 29 'Augie Fackler <durin42@gmail.com>')
33 self.assertEqual(self.repo['tip'].user(), 30 self.assertEqual(self.repo['tip'].user(),
34 'evil@5b65bade-98f3-4993-a01f-b7a6710da339') 31 'evil@5b65bade-98f3-4993-a01f-b7a6710da339')
35 32
39 def test_author_map_closing_author(self, stupid=False): 36 def test_author_map_closing_author(self, stupid=False):
40 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')
41 authormap = open(self.authors, 'w') 38 authormap = open(self.authors, 'w')
42 authormap.write("evil=Testy <test@test>") 39 authormap.write("evil=Testy <test@test>")
43 authormap.close() 40 authormap.close()
44 fetch_command.fetch_revisions(ui.ui(), 41 wrappers.clone(None, ui.ui(), source=test_util.fileurl(self.repo_path),
45 svn_url=test_util.fileurl(self.repo_path), 42 dest=self.wc_path, stupid=stupid,
46 hg_repo_path=self.wc_path, 43 svn_authors=self.authors)
47 stupid=stupid,
48 authors=self.authors)
49 self.assertEqual(self.repo[0].user(), 44 self.assertEqual(self.repo[0].user(),
50 'Augie@5b65bade-98f3-4993-a01f-b7a6710da339') 45 'Augie@5b65bade-98f3-4993-a01f-b7a6710da339')
51 self.assertEqual(self.repo['tip'].user(), 46 self.assertEqual(self.repo['tip'].user(),
52 'Testy <test@test>') 47 'Testy <test@test>')
53 48
57 def test_file_map(self, stupid=False): 52 def test_file_map(self, stupid=False):
58 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')
59 filemap = open(self.filemap, 'w') 54 filemap = open(self.filemap, 'w')
60 filemap.write("include alpha\n") 55 filemap.write("include alpha\n")
61 filemap.close() 56 filemap.close()
62 fetch_command.fetch_revisions(ui.ui(), 57 wrappers.clone(None, ui.ui(), source=test_util.fileurl(self.repo_path),
63 svn_url=test_util.fileurl(self.repo_path), 58 dest=self.wc_path, stupid=stupid,
64 hg_repo_path=self.wc_path, 59 svn_filemap=self.filemap)
65 stupid=stupid,
66 filemap=self.filemap)
67 self.assertEqual(node.hex(self.repo[0].node()), '88e2c7492d83e4bf30fbb2dcbf6aa24d60ac688d') 60 self.assertEqual(node.hex(self.repo[0].node()), '88e2c7492d83e4bf30fbb2dcbf6aa24d60ac688d')
68 self.assertEqual(node.hex(self.repo['default'].node()), 'e524296152246b3837fe9503c83b727075835155') 61 self.assertEqual(node.hex(self.repo['default'].node()), 'e524296152246b3837fe9503c83b727075835155')
69 62
70 def test_file_map_stupid(self): 63 def test_file_map_stupid(self):
71 self.test_file_map(True) 64 self.test_file_map(True)
73 def test_file_map_exclude(self, stupid=False): 66 def test_file_map_exclude(self, stupid=False):
74 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')
75 filemap = open(self.filemap, 'w') 68 filemap = open(self.filemap, 'w')
76 filemap.write("exclude alpha\n") 69 filemap.write("exclude alpha\n")
77 filemap.close() 70 filemap.close()
78 fetch_command.fetch_revisions(ui.ui(), 71 wrappers.clone(None, ui.ui(), source=test_util.fileurl(self.repo_path),
79 svn_url=test_util.fileurl(self.repo_path), 72 dest=self.wc_path, stupid=stupid,
80 hg_repo_path=self.wc_path, 73 svn_filemap=self.filemap)
81 stupid=stupid,
82 filemap=self.filemap)
83 self.assertEqual(node.hex(self.repo[0].node()), '2c48f3525926ab6c8b8424bcf5eb34b149b61841') 74 self.assertEqual(node.hex(self.repo[0].node()), '2c48f3525926ab6c8b8424bcf5eb34b149b61841')
84 self.assertEqual(node.hex(self.repo['default'].node()), 'b37a3c0297b71f989064d9b545b5a478bbed7cc1') 75 self.assertEqual(node.hex(self.repo['default'].node()), 'b37a3c0297b71f989064d9b545b5a478bbed7cc1')
85 76
86 def test_file_map_exclude_stupid(self): 77 def test_file_map_exclude_stupid(self):
87 self.test_file_map_exclude(True) 78 self.test_file_map_exclude(True)