Mercurial > hgsubversion
comparison tests/test_fetch_command.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 | d978192f0d63 |
children | bb00f7ca5b8c |
comparison
equal
deleted
inserted
replaced
303:f423a8780832 | 304:ce676eff002b |
---|---|
4 from mercurial import node | 4 from mercurial import node |
5 from mercurial import ui | 5 from mercurial import ui |
6 | 6 |
7 import test_util | 7 import test_util |
8 | 8 |
9 class TestBasicRepoLayout(test_util.TestBase): | |
9 | 10 |
10 class TestBasicRepoLayout(test_util.TestBase): | 11 def test_no_dates(self): |
12 repo = self._load_fixture_and_fetch('test_no_dates.svndump') | |
13 local_epoch = repo[0].date() | |
14 self.assertEqual(local_epoch[0], local_epoch[1]) | |
15 self.assertEqual(repo[1].date(), repo[2].date()) | |
16 | |
11 def test_fresh_fetch_single_rev(self): | 17 def test_fresh_fetch_single_rev(self): |
12 repo = self._load_fixture_and_fetch('single_rev.svndump') | 18 repo = self._load_fixture_and_fetch('single_rev.svndump') |
13 self.assertEqual(node.hex(repo['tip'].node()), | 19 self.assertEqual(node.hex(repo['tip'].node()), |
14 '434ed487136c1b47c1e8f952edb4dc5a8e6328df') | 20 '434ed487136c1b47c1e8f952edb4dc5a8e6328df') |
15 self.assertEqual(repo['tip'].extra()['convert_revision'], | 21 self.assertEqual(repo['tip'].extra()['convert_revision'], |
16 'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/trunk@2') | 22 'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/trunk@2') |
17 self.assertEqual(repo['tip'], repo[0]) | 23 self.assertEqual(repo['tip'], repo[0]) |
18 | 24 |
19 def test_fresh_fetch_two_revs(self): | 25 def test_fresh_fetch_two_revs(self): |
20 repo = self._load_fixture_and_fetch('two_revs.svndump') | 26 repo = self._load_fixture_and_fetch('two_revs.svndump') |
21 # TODO there must be a better way than repo[0] for this check | |
22 self.assertEqual(node.hex(repo[0].node()), | 27 self.assertEqual(node.hex(repo[0].node()), |
23 '434ed487136c1b47c1e8f952edb4dc5a8e6328df') | 28 '434ed487136c1b47c1e8f952edb4dc5a8e6328df') |
24 self.assertEqual(node.hex(repo['tip'].node()), | 29 self.assertEqual(node.hex(repo['tip'].node()), |
25 'c95251e0dd04697deee99b79cc407d7db76e6a5f') | 30 'c95251e0dd04697deee99b79cc407d7db76e6a5f') |
26 self.assertEqual(repo['tip'], repo[1]) | 31 self.assertEqual(repo['tip'], repo[1]) |
27 | 32 |
28 def test_branches(self): | 33 def test_branches(self): |
29 repo = self._load_fixture_and_fetch('simple_branch.svndump') | 34 repo = self._load_fixture_and_fetch('simple_branch.svndump') |
30 # TODO there must be a better way than repo[0] for this check | |
31 self.assertEqual(node.hex(repo[0].node()), | 35 self.assertEqual(node.hex(repo[0].node()), |
32 '434ed487136c1b47c1e8f952edb4dc5a8e6328df') | 36 '434ed487136c1b47c1e8f952edb4dc5a8e6328df') |
33 self.assertEqual(node.hex(repo['tip'].node()), | 37 self.assertEqual(node.hex(repo['tip'].node()), |
34 'f1ff5b860f5dbb9a59ad0921a79da77f10f25109') | 38 'f1ff5b860f5dbb9a59ad0921a79da77f10f25109') |
35 self.assertEqual(len(repo['tip'].parents()), 1) | 39 self.assertEqual(len(repo['tip'].parents()), 1) |
40 'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/trunk@3') | 44 'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/trunk@3') |
41 self.assertEqual(len(repo.heads()), 1) | 45 self.assertEqual(len(repo.heads()), 1) |
42 | 46 |
43 def test_two_branches_with_heads(self): | 47 def test_two_branches_with_heads(self): |
44 repo = self._load_fixture_and_fetch('two_heads.svndump') | 48 repo = self._load_fixture_and_fetch('two_heads.svndump') |
45 # TODO there must be a better way than repo[0] for this check | |
46 self.assertEqual(node.hex(repo[0].node()), | 49 self.assertEqual(node.hex(repo[0].node()), |
47 '434ed487136c1b47c1e8f952edb4dc5a8e6328df') | 50 '434ed487136c1b47c1e8f952edb4dc5a8e6328df') |
48 self.assertEqual(node.hex(repo['tip'].node()), | 51 self.assertEqual(node.hex(repo['tip'].node()), |
49 '1083037b18d85cd84fa211c5adbaeff0fea2cd9f') | 52 '1083037b18d85cd84fa211c5adbaeff0fea2cd9f') |
50 self.assertEqual(node.hex(repo['the_branch'].node()), | 53 self.assertEqual(node.hex(repo['the_branch'].node()), |
55 self.assertEqual(repo['tip'], repo['default']) | 58 self.assertEqual(repo['tip'], repo['default']) |
56 self.assertEqual(len(repo.heads()), 2) | 59 self.assertEqual(len(repo.heads()), 2) |
57 | 60 |
58 def test_many_special_cases_replay(self): | 61 def test_many_special_cases_replay(self): |
59 repo = self._load_fixture_and_fetch('many_special_cases.svndump') | 62 repo = self._load_fixture_and_fetch('many_special_cases.svndump') |
60 # TODO there must be a better way than repo[0] for this check | |
61 self._many_special_cases_checks(repo) | 63 self._many_special_cases_checks(repo) |
62 | 64 |
63 | 65 |
64 def test_many_special_cases_diff(self): | 66 def test_many_special_cases_diff(self): |
65 repo = self._load_fixture_and_fetch('many_special_cases.svndump', | 67 repo = self._load_fixture_and_fetch('many_special_cases.svndump', |
66 stupid=True) | 68 stupid=True) |
67 # TODO there must be a better way than repo[0] for this check | |
68 self._many_special_cases_checks(repo) | 69 self._many_special_cases_checks(repo) |
69 | 70 |
70 def _many_special_cases_checks(self, repo): | 71 def _many_special_cases_checks(self, repo): |
71 self.assertEqual(node.hex(repo[0].node()), | 72 self.assertEqual(node.hex(repo[0].node()), |
72 '434ed487136c1b47c1e8f952edb4dc5a8e6328df') | 73 '434ed487136c1b47c1e8f952edb4dc5a8e6328df') |
83 def test_file_mixed_with_branches(self): | 84 def test_file_mixed_with_branches(self): |
84 repo = self._load_fixture_and_fetch('file_mixed_with_branches.svndump') | 85 repo = self._load_fixture_and_fetch('file_mixed_with_branches.svndump') |
85 self.assertEqual(node.hex(repo['default'].node()), | 86 self.assertEqual(node.hex(repo['default'].node()), |
86 '434ed487136c1b47c1e8f952edb4dc5a8e6328df') | 87 '434ed487136c1b47c1e8f952edb4dc5a8e6328df') |
87 assert 'README' not in repo | 88 assert 'README' not in repo |
88 self.assertEqual(repo['tip'].branch(), | 89 assert '../branches' not in repo |
89 '../branches') | |
90 | |
91 | 90 |
92 def test_files_copied_from_outside_btt(self): | 91 def test_files_copied_from_outside_btt(self): |
93 repo = self._load_fixture_and_fetch( | 92 repo = self._load_fixture_and_fetch( |
94 'test_files_copied_from_outside_btt.svndump') | 93 'test_files_copied_from_outside_btt.svndump') |
95 self.assertEqual(node.hex(repo['tip'].node()), | 94 self.assertEqual(node.hex(repo['tip'].node()), |
97 self.assertEqual(len(repo.changelog), 2) | 96 self.assertEqual(len(repo.changelog), 2) |
98 | 97 |
99 def test_file_renamed_in_from_outside_btt(self): | 98 def test_file_renamed_in_from_outside_btt(self): |
100 repo = self._load_fixture_and_fetch( | 99 repo = self._load_fixture_and_fetch( |
101 'file_renamed_in_from_outside_btt.svndump') | 100 'file_renamed_in_from_outside_btt.svndump') |
102 self.assert_('LICENSE.file' in repo['tip']) | 101 self.assert_('LICENSE.file' in repo['default']) |
103 | 102 |
104 def test_renamed_dir_in_from_outside_btt_not_repo_root(self): | 103 def test_renamed_dir_in_from_outside_btt_not_repo_root(self): |
105 repo = self._load_fixture_and_fetch( | 104 repo = self._load_fixture_and_fetch( |
106 'fetch_missing_files_subdir.svndump', subdir='foo') | 105 'fetch_missing_files_subdir.svndump', subdir='foo') |
107 self.assertEqual(node.hex(repo['tip'].node()), | 106 self.assertEqual(node.hex(repo['tip'].node()), |
139 def test_entry_deletion_stupid(self): | 138 def test_entry_deletion_stupid(self): |
140 self.test_entry_deletion(stupid=True) | 139 self.test_entry_deletion(stupid=True) |
141 | 140 |
142 def test_fetch_when_trunk_has_no_files(self, stupid=False): | 141 def test_fetch_when_trunk_has_no_files(self, stupid=False): |
143 repo = self._load_fixture_and_fetch('file_not_in_trunk_root.svndump', stupid=stupid) | 142 repo = self._load_fixture_and_fetch('file_not_in_trunk_root.svndump', stupid=stupid) |
144 print repo['tip'].branch() | |
145 print repo['tip'] | |
146 print repo['tip'].files() | |
147 self.assertEqual(repo['tip'].branch(), 'default') | 143 self.assertEqual(repo['tip'].branch(), 'default') |
148 | 144 |
149 def test_fetch_when_trunk_has_no_files_stupid(self): | 145 def test_fetch_when_trunk_has_no_files_stupid(self): |
150 self.test_fetch_when_trunk_has_no_files(stupid=True) | 146 self.test_fetch_when_trunk_has_no_files(stupid=True) |
151 | 147 |
153 def test_stupid(self): | 149 def test_stupid(self): |
154 repo = test_util.load_fixture_and_fetch('two_heads.svndump', | 150 repo = test_util.load_fixture_and_fetch('two_heads.svndump', |
155 self.repo_path, | 151 self.repo_path, |
156 self.wc_path, | 152 self.wc_path, |
157 True) | 153 True) |
158 # TODO there must be a better way than repo[0] for this check | |
159 self.assertEqual(node.hex(repo[0].node()), | 154 self.assertEqual(node.hex(repo[0].node()), |
160 '434ed487136c1b47c1e8f952edb4dc5a8e6328df') | 155 '434ed487136c1b47c1e8f952edb4dc5a8e6328df') |
161 self.assertEqual(node.hex(repo['tip'].node()), | 156 self.assertEqual(node.hex(repo['tip'].node()), |
162 '1083037b18d85cd84fa211c5adbaeff0fea2cd9f') | 157 '1083037b18d85cd84fa211c5adbaeff0fea2cd9f') |
163 self.assertEqual(node.hex(repo['the_branch'].node()), | 158 self.assertEqual(node.hex(repo['the_branch'].node()), |