annotate tests/test_fetch_mappings.py @ 281:8ff0b3261b7f

util: drop 1.2 support in the encoding swap.
author Augie Fackler <durin42@gmail.com>
date Fri, 24 Apr 2009 21:07:59 -0500
parents ffccf0080e54
children 75f082b5897e
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
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents: 241
diff changeset
10 import wrappers
168
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()
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents: 241
diff changeset
26 wrappers.clone(None, ui.ui(), source=test_util.fileurl(self.repo_path),
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents: 241
diff changeset
27 dest=self.wc_path, stupid=stupid, svn_authors=self.authors)
168
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
28 self.assertEqual(self.repo[0].user(),
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
29 'Augie Fackler <durin42@gmail.com>')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
30 self.assertEqual(self.repo['tip'].user(),
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
31 'evil@5b65bade-98f3-4993-a01f-b7a6710da339')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
32
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
33 def test_author_map_stupid(self):
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
34 self.test_author_map(True)
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_closing_author(self, stupid=False):
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
37 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
38 authormap = open(self.authors, 'w')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
39 authormap.write("evil=Testy <test@test>")
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
40 authormap.close()
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents: 241
diff changeset
41 wrappers.clone(None, ui.ui(), source=test_util.fileurl(self.repo_path),
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents: 241
diff changeset
42 dest=self.wc_path, stupid=stupid,
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents: 241
diff changeset
43 svn_authors=self.authors)
168
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
44 self.assertEqual(self.repo[0].user(),
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
45 'Augie@5b65bade-98f3-4993-a01f-b7a6710da339')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
46 self.assertEqual(self.repo['tip'].user(),
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
47 'Testy <test@test>')
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
48
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
49 def test_author_map_closing_author_stupid(self):
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
50 self.test_author_map_closing_author(True)
203
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 179
diff changeset
51
179
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
52 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
53 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
54 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
55 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
56 filemap.close()
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents: 241
diff changeset
57 wrappers.clone(None, ui.ui(), source=test_util.fileurl(self.repo_path),
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents: 241
diff changeset
58 dest=self.wc_path, stupid=stupid,
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents: 241
diff changeset
59 svn_filemap=self.filemap)
179
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
60 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
61 self.assertEqual(node.hex(self.repo['default'].node()), 'e524296152246b3837fe9503c83b727075835155')
203
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 179
diff changeset
62
179
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
63 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
64 self.test_file_map(True)
203
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 179
diff changeset
65
179
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
66 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
67 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
68 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
69 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
70 filemap.close()
257
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents: 241
diff changeset
71 wrappers.clone(None, ui.ui(), source=test_util.fileurl(self.repo_path),
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents: 241
diff changeset
72 dest=self.wc_path, stupid=stupid,
ffccf0080e54 Move wrappers for hg commands to their own module.
Augie Fackler <durin42@gmail.com>
parents: 241
diff changeset
73 svn_filemap=self.filemap)
179
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
74 self.assertEqual(node.hex(self.repo[0].node()), '2c48f3525926ab6c8b8424bcf5eb34b149b61841')
203
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 179
diff changeset
75 self.assertEqual(node.hex(self.repo['default'].node()), 'b37a3c0297b71f989064d9b545b5a478bbed7cc1')
907c160c6289 Refactor branch handling to be much more dynamic (and hopefully robust).
Augie Fackler <durin42@gmail.com>
parents: 179
diff changeset
76
179
a336e3e82648 Fetch: add a filemap argument for use in converting old repositories to
Graham Booker <gbooker@cod3r.com>
parents: 168
diff changeset
77 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
78 self.test_file_map_exclude(True)
168
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
79
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
80
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
81 def suite():
4f26fa049452 authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
82 return unittest.TestLoader().loadTestsFromTestCase(MapTests)