Mercurial > hgsubversion
annotate tests/test_fetch_mappings.py @ 168:4f26fa049452
authormap: Add tests, fix in stupid mode.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Tue, 30 Dec 2008 20:14:03 -0600 |
parents | |
children | a336e3e82648 |
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 |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
7 |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
8 import test_util |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
9 import fetch_command |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
10 |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
11 class MapTests(test_util.TestBase): |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
12 @property |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
13 def authors(self): |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
14 return os.path.join(self.tmpdir, 'authormap') |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
15 |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
16 @property |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
17 def filemap(self): |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
18 return os.path.join(self.tmpdir, 'filemap') |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
19 |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
20 def test_author_map(self, stupid=False): |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
21 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
|
22 authormap = open(self.authors, 'w') |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
23 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
|
24 authormap.close() |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
25 fetch_command.fetch_revisions(ui.ui(), |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
26 svn_url=test_util.fileurl(self.repo_path), |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
27 hg_repo_path=self.wc_path, |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
28 stupid=stupid, |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
29 authors=self.authors) |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
30 self.assertEqual(self.repo[0].user(), |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
31 'Augie Fackler <durin42@gmail.com>') |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
32 self.assertEqual(self.repo['tip'].user(), |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
33 'evil@5b65bade-98f3-4993-a01f-b7a6710da339') |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
34 |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
35 def test_author_map_stupid(self): |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
36 self.test_author_map(True) |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
37 |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
38 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
|
39 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
|
40 authormap = open(self.authors, 'w') |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
41 authormap.write("evil=Testy <test@test>") |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
42 authormap.close() |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
43 fetch_command.fetch_revisions(ui.ui(), |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
44 svn_url=test_util.fileurl(self.repo_path), |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
45 hg_repo_path=self.wc_path, |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
46 stupid=stupid, |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
47 authors=self.authors) |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
48 self.assertEqual(self.repo[0].user(), |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
49 'Augie@5b65bade-98f3-4993-a01f-b7a6710da339') |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
50 self.assertEqual(self.repo['tip'].user(), |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
51 'Testy <test@test>') |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
52 |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
53 def test_author_map_closing_author_stupid(self): |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
54 self.test_author_map_closing_author(True) |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
55 |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
56 |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
57 def suite(): |
4f26fa049452
authormap: Add tests, fix in stupid mode.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
58 return unittest.TestLoader().loadTestsFromTestCase(MapTests) |