comparison tests/test_fetch_mappings.py @ 241:4950b18cf949

Move fetch_command.fetch_revisions() to svncommands.pull().
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Wed, 08 Apr 2009 17:49:30 +0200
parents 907c160c6289
children ffccf0080e54
comparison
equal deleted inserted replaced
240:1aa1d2d406d9 241:4950b18cf949
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 svncommands
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 svncommands.pull(ui.ui(), svn_url=test_util.fileurl(self.repo_path),
27 svn_url=test_util.fileurl(self.repo_path), 27 hg_repo_path=self.wc_path, stupid=stupid,
28 hg_repo_path=self.wc_path, 28 authors=self.authors)
29 stupid=stupid,
30 authors=self.authors)
31 self.assertEqual(self.repo[0].user(), 29 self.assertEqual(self.repo[0].user(),
32 'Augie Fackler <durin42@gmail.com>') 30 'Augie Fackler <durin42@gmail.com>')
33 self.assertEqual(self.repo['tip'].user(), 31 self.assertEqual(self.repo['tip'].user(),
34 'evil@5b65bade-98f3-4993-a01f-b7a6710da339') 32 'evil@5b65bade-98f3-4993-a01f-b7a6710da339')
35 33
39 def test_author_map_closing_author(self, stupid=False): 37 def test_author_map_closing_author(self, stupid=False):
40 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump') 38 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
41 authormap = open(self.authors, 'w') 39 authormap = open(self.authors, 'w')
42 authormap.write("evil=Testy <test@test>") 40 authormap.write("evil=Testy <test@test>")
43 authormap.close() 41 authormap.close()
44 fetch_command.fetch_revisions(ui.ui(), 42 svncommands.pull(ui.ui(), svn_url=test_util.fileurl(self.repo_path),
45 svn_url=test_util.fileurl(self.repo_path), 43 hg_repo_path=self.wc_path, stupid=stupid,
46 hg_repo_path=self.wc_path, 44 authors=self.authors)
47 stupid=stupid,
48 authors=self.authors)
49 self.assertEqual(self.repo[0].user(), 45 self.assertEqual(self.repo[0].user(),
50 'Augie@5b65bade-98f3-4993-a01f-b7a6710da339') 46 'Augie@5b65bade-98f3-4993-a01f-b7a6710da339')
51 self.assertEqual(self.repo['tip'].user(), 47 self.assertEqual(self.repo['tip'].user(),
52 'Testy <test@test>') 48 'Testy <test@test>')
53 49
57 def test_file_map(self, stupid=False): 53 def test_file_map(self, stupid=False):
58 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump') 54 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
59 filemap = open(self.filemap, 'w') 55 filemap = open(self.filemap, 'w')
60 filemap.write("include alpha\n") 56 filemap.write("include alpha\n")
61 filemap.close() 57 filemap.close()
62 fetch_command.fetch_revisions(ui.ui(), 58 svncommands.pull(ui.ui(), svn_url=test_util.fileurl(self.repo_path),
63 svn_url=test_util.fileurl(self.repo_path), 59 hg_repo_path=self.wc_path, stupid=stupid,
64 hg_repo_path=self.wc_path, 60 filemap=self.filemap)
65 stupid=stupid,
66 filemap=self.filemap)
67 self.assertEqual(node.hex(self.repo[0].node()), '88e2c7492d83e4bf30fbb2dcbf6aa24d60ac688d') 61 self.assertEqual(node.hex(self.repo[0].node()), '88e2c7492d83e4bf30fbb2dcbf6aa24d60ac688d')
68 self.assertEqual(node.hex(self.repo['default'].node()), 'e524296152246b3837fe9503c83b727075835155') 62 self.assertEqual(node.hex(self.repo['default'].node()), 'e524296152246b3837fe9503c83b727075835155')
69 63
70 def test_file_map_stupid(self): 64 def test_file_map_stupid(self):
71 self.test_file_map(True) 65 self.test_file_map(True)
73 def test_file_map_exclude(self, stupid=False): 67 def test_file_map_exclude(self, stupid=False):
74 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump') 68 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
75 filemap = open(self.filemap, 'w') 69 filemap = open(self.filemap, 'w')
76 filemap.write("exclude alpha\n") 70 filemap.write("exclude alpha\n")
77 filemap.close() 71 filemap.close()
78 fetch_command.fetch_revisions(ui.ui(), 72 svncommands.pull(ui.ui(), svn_url=test_util.fileurl(self.repo_path),
79 svn_url=test_util.fileurl(self.repo_path), 73 hg_repo_path=self.wc_path, stupid=stupid,
80 hg_repo_path=self.wc_path, 74 filemap=self.filemap)
81 stupid=stupid,
82 filemap=self.filemap)
83 self.assertEqual(node.hex(self.repo[0].node()), '2c48f3525926ab6c8b8424bcf5eb34b149b61841') 75 self.assertEqual(node.hex(self.repo[0].node()), '2c48f3525926ab6c8b8424bcf5eb34b149b61841')
84 self.assertEqual(node.hex(self.repo['default'].node()), 'b37a3c0297b71f989064d9b545b5a478bbed7cc1') 76 self.assertEqual(node.hex(self.repo['default'].node()), 'b37a3c0297b71f989064d9b545b5a478bbed7cc1')
85 77
86 def test_file_map_exclude_stupid(self): 78 def test_file_map_exclude_stupid(self):
87 self.test_file_map_exclude(True) 79 self.test_file_map_exclude(True)