annotate tests/test_fetch_mappings.py @ 191:0e912d37cbab

Mark command line and svn:externals as literal text.
author Martin Geisler <mg@daimi.au.dk>
date Wed, 21 Jan 2009 20:38:09 -0600
parents a336e3e82648
children 907c160c6289
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
168
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
1 """Tests for author maps and file maps.
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
2 """
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
3 import os
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
4 import unittest
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
5
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
6 from mercurial import ui
179
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
7 from mercurial import node
168
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
8
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
9 import test_util
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
10 import fetch_command
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
11
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
12 class MapTests(test_util.TestBase):
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
13 @property
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
14 def authors(self):
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
15 return os.path.join(self.tmpdir, 'authormap')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
16
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
17 @property
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
18 def filemap(self):
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
19 return os.path.join(self.tmpdir, 'filemap')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
20
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
21 def test_author_map(self, stupid=False):
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
22 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
23 authormap = open(self.authors, 'w')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
24 authormap.write("Augie=Augie Fackler <durin42@gmail.com>\n")
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
25 authormap.close()
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
26 fetch_command.fetch_revisions(ui.ui(),
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
27 svn_url=test_util.fileurl(self.repo_path),
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
28 hg_repo_path=self.wc_path,
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
29 stupid=stupid,
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
30 authors=self.authors)
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
31 self.assertEqual(self.repo[0].user(),
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
32 'Augie Fackler <durin42@gmail.com>')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
33 self.assertEqual(self.repo['tip'].user(),
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
34 'evil@5b65bade-98f3-4993-a01f-b7a6710da339')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
35
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
36 def test_author_map_stupid(self):
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
37 self.test_author_map(True)
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
38
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
39 def test_author_map_closing_author(self, stupid=False):
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
40 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
41 authormap = open(self.authors, 'w')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
42 authormap.write("evil=Testy <test@test>")
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
43 authormap.close()
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
44 fetch_command.fetch_revisions(ui.ui(),
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
45 svn_url=test_util.fileurl(self.repo_path),
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
46 hg_repo_path=self.wc_path,
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
47 stupid=stupid,
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
48 authors=self.authors)
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
49 self.assertEqual(self.repo[0].user(),
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
50 'Augie@5b65bade-98f3-4993-a01f-b7a6710da339')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
51 self.assertEqual(self.repo['tip'].user(),
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
52 'Testy <test@test>')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
53
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
54 def test_author_map_closing_author_stupid(self):
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
55 self.test_author_map_closing_author(True)
179
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
56
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
57 def test_file_map(self, stupid=False):
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
58 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
59 filemap = open(self.filemap, 'w')
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
60 filemap.write("include alpha\n")
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
61 filemap.close()
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
62 fetch_command.fetch_revisions(ui.ui(),
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
63 svn_url=test_util.fileurl(self.repo_path),
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
64 hg_repo_path=self.wc_path,
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
65 stupid=stupid,
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
66 filemap=self.filemap)
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
67 self.assertEqual(node.hex(self.repo[0].node()), '88e2c7492d83e4bf30fbb2dcbf6aa24d60ac688d')
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
68 self.assertEqual(node.hex(self.repo['default'].node()), 'e524296152246b3837fe9503c83b727075835155')
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
69
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
70 def test_file_map_stupid(self):
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
71 self.test_file_map(True)
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
72
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
73 def test_file_map_exclude(self, stupid=False):
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
74 test_util.load_svndump_fixture(self.repo_path, 'replace_trunk_with_branch.svndump')
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
75 filemap = open(self.filemap, 'w')
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
76 filemap.write("exclude alpha\n")
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
77 filemap.close()
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
78 fetch_command.fetch_revisions(ui.ui(),
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
79 svn_url=test_util.fileurl(self.repo_path),
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
80 hg_repo_path=self.wc_path,
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
81 stupid=stupid,
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
82 filemap=self.filemap)
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
83 self.assertEqual(node.hex(self.repo[0].node()), '2c48f3525926ab6c8b8424bcf5eb34b149b61841')
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
84 self.assertEqual(node.hex(self.repo['default'].node()), '86fc12d173716139d5bd1d36866038d355009f45')
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
85
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
86 def test_file_map_exclude_stupid(self):
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
87 self.test_file_map_exclude(True)
168
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
88
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
89
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
90 def suite():
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
91 return unittest.TestLoader().loadTestsFromTestCase(MapTests)