comparison tests/test_fetch_command.py @ 154:6fa97cfbf62f

fetch: Refactor extra creation to be shared by real and diff replay. Add convert-compatible meta information to extra.
author Augie Fackler <durin42@gmail.com>
date Tue, 23 Dec 2008 11:10:32 -0600
parents 19aabf67c792
children 906d3f302b45
comparison
equal deleted inserted replaced
153:46f6b872c988 154:6fa97cfbf62f
9 9
10 class TestBasicRepoLayout(test_util.TestBase): 10 class TestBasicRepoLayout(test_util.TestBase):
11 def test_fresh_fetch_single_rev(self): 11 def test_fresh_fetch_single_rev(self):
12 repo = self._load_fixture_and_fetch('single_rev.svndump') 12 repo = self._load_fixture_and_fetch('single_rev.svndump')
13 self.assertEqual(node.hex(repo['tip'].node()), 13 self.assertEqual(node.hex(repo['tip'].node()),
14 'a47d0ce778660a91c31bf2c21c448e9ee296ac90') 14 '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
15 self.assertEqual(repo['tip'].extra()['convert_revision'],
16 'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/trunk@2')
15 self.assertEqual(repo['tip'], repo[0]) 17 self.assertEqual(repo['tip'], repo[0])
16 18
17 def test_fresh_fetch_two_revs(self): 19 def test_fresh_fetch_two_revs(self):
18 repo = self._load_fixture_and_fetch('two_revs.svndump') 20 repo = self._load_fixture_and_fetch('two_revs.svndump')
19 # TODO there must be a better way than repo[0] for this check 21 # TODO there must be a better way than repo[0] for this check
20 self.assertEqual(node.hex(repo[0].node()), 22 self.assertEqual(node.hex(repo[0].node()),
21 'a47d0ce778660a91c31bf2c21c448e9ee296ac90') 23 '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
22 self.assertEqual(node.hex(repo['tip'].node()), 24 self.assertEqual(node.hex(repo['tip'].node()),
23 'bf3767835b3b32ecc775a298c2fa27134dd91c11') 25 'c95251e0dd04697deee99b79cc407d7db76e6a5f')
24 self.assertEqual(repo['tip'], repo[1]) 26 self.assertEqual(repo['tip'], repo[1])
25 27
26 def test_branches(self): 28 def test_branches(self):
27 repo = self._load_fixture_and_fetch('simple_branch.svndump') 29 repo = self._load_fixture_and_fetch('simple_branch.svndump')
28 # TODO there must be a better way than repo[0] for this check 30 # TODO there must be a better way than repo[0] for this check
29 self.assertEqual(node.hex(repo[0].node()), 31 self.assertEqual(node.hex(repo[0].node()),
30 'a47d0ce778660a91c31bf2c21c448e9ee296ac90') 32 '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
31 self.assertEqual(node.hex(repo['tip'].node()), 33 self.assertEqual(node.hex(repo['tip'].node()),
32 '9dfb0a19494f45c36e22f3c6d1b21d80638a7f6e') 34 'f1ff5b860f5dbb9a59ad0921a79da77f10f25109')
33 self.assertEqual(len(repo['tip'].parents()), 1) 35 self.assertEqual(len(repo['tip'].parents()), 1)
34 self.assertEqual(repo['tip'].parents()[0], repo['default']) 36 self.assertEqual(repo['tip'].parents()[0], repo['default'])
37 self.assertEqual(repo['tip'].extra()['convert_revision'],
38 'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/branches/the_branch@4')
39 self.assertEqual(repo['default'].extra()['convert_revision'],
40 'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/trunk@3')
35 self.assertEqual(len(repo.heads()), 1) 41 self.assertEqual(len(repo.heads()), 1)
36 42
37 def test_two_branches_with_heads(self): 43 def test_two_branches_with_heads(self):
38 repo = self._load_fixture_and_fetch('two_heads.svndump') 44 repo = self._load_fixture_and_fetch('two_heads.svndump')
39 # TODO there must be a better way than repo[0] for this check 45 # TODO there must be a better way than repo[0] for this check
40 self.assertEqual(node.hex(repo[0].node()), 46 self.assertEqual(node.hex(repo[0].node()),
41 'a47d0ce778660a91c31bf2c21c448e9ee296ac90') 47 '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
42 self.assertEqual(node.hex(repo['tip'].node()), 48 self.assertEqual(node.hex(repo['tip'].node()),
43 'a595c77cfcaa3d1ba9e04b2c55c68bc6bf2b0fbf') 49 '1083037b18d85cd84fa211c5adbaeff0fea2cd9f')
44 self.assertEqual(node.hex(repo['the_branch'].node()), 50 self.assertEqual(node.hex(repo['the_branch'].node()),
45 '8ccaba5f0eae124487e413abd904a013f7f6fdeb') 51 '4e256962fc5df545e2e0a51d0d1dc61c469127e6')
46 self.assertEqual(node.hex(repo['the_branch'].parents()[0].node()), 52 self.assertEqual(node.hex(repo['the_branch'].parents()[0].node()),
47 '9dfb0a19494f45c36e22f3c6d1b21d80638a7f6e') 53 'f1ff5b860f5dbb9a59ad0921a79da77f10f25109')
48 self.assertEqual(len(repo['tip'].parents()), 1) 54 self.assertEqual(len(repo['tip'].parents()), 1)
49 self.assertEqual(repo['tip'], repo['default']) 55 self.assertEqual(repo['tip'], repo['default'])
50 self.assertEqual(len(repo.heads()), 2) 56 self.assertEqual(len(repo.heads()), 2)
51 57
52 def test_many_special_cases_replay(self): 58 def test_many_special_cases_replay(self):
61 # TODO there must be a better way than repo[0] for this check 67 # TODO there must be a better way than repo[0] for this check
62 self._many_special_cases_checks(repo) 68 self._many_special_cases_checks(repo)
63 69
64 def _many_special_cases_checks(self, repo): 70 def _many_special_cases_checks(self, repo):
65 self.assertEqual(node.hex(repo[0].node()), 71 self.assertEqual(node.hex(repo[0].node()),
66 'a47d0ce778660a91c31bf2c21c448e9ee296ac90') 72 '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
67 self.assertEqual(node.hex(repo['tip'].node()), 73 self.assertEqual(node.hex(repo['tip'].node()),
68 '179fb7d9bc77eef78288661f0430e0c1dff56b6f') 74 'b7bdc73041b1852563deb1ef3f4153c2fe4484f2')
69 self.assertEqual(node.hex(repo['the_branch'].node()), 75 self.assertEqual(node.hex(repo['the_branch'].node()),
70 '8ccaba5f0eae124487e413abd904a013f7f6fdeb') 76 '4e256962fc5df545e2e0a51d0d1dc61c469127e6')
71 self.assertEqual(node.hex(repo['the_branch'].parents()[0].node()), 77 self.assertEqual(node.hex(repo['the_branch'].parents()[0].node()),
72 '9dfb0a19494f45c36e22f3c6d1b21d80638a7f6e') 78 'f1ff5b860f5dbb9a59ad0921a79da77f10f25109')
73 self.assertEqual(len(repo['tip'].parents()), 1) 79 self.assertEqual(len(repo['tip'].parents()), 1)
74 self.assertEqual(repo['tip'], repo['default']) 80 self.assertEqual(repo['tip'], repo['default'])
75 self.assertEqual(len(repo.heads()), 2) 81 self.assertEqual(len(repo.heads()), 2)
76 82
77 def test_file_mixed_with_branches(self): 83 def test_file_mixed_with_branches(self):
78 repo = self._load_fixture_and_fetch('file_mixed_with_branches.svndump') 84 repo = self._load_fixture_and_fetch('file_mixed_with_branches.svndump')
79 self.assertEqual(node.hex(repo['tip'].node()), 85 self.assertEqual(node.hex(repo['tip'].node()),
80 'a47d0ce778660a91c31bf2c21c448e9ee296ac90') 86 '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
81 assert 'README' not in repo 87 assert 'README' not in repo
82 88
83 def test_files_copied_from_outside_btt(self): 89 def test_files_copied_from_outside_btt(self):
84 repo = self._load_fixture_and_fetch( 90 repo = self._load_fixture_and_fetch(
85 'test_files_copied_from_outside_btt.svndump') 91 'test_files_copied_from_outside_btt.svndump')
86 self.assertEqual(node.hex(repo['tip'].node()), 92 self.assertEqual(node.hex(repo['tip'].node()),
87 'c4e669a763a70f751c71d4534a34a65f398d71d4') 93 '3c78170e30ddd35f2c32faa0d8646ab75bba4f73')
88 self.assertEqual(len(repo.changelog), 2) 94 self.assertEqual(len(repo.changelog), 2)
89 95
90 def test_file_renamed_in_from_outside_btt(self): 96 def test_file_renamed_in_from_outside_btt(self):
91 repo = self._load_fixture_and_fetch( 97 repo = self._load_fixture_and_fetch(
92 'file_renamed_in_from_outside_btt.svndump') 98 'file_renamed_in_from_outside_btt.svndump')
94 100
95 def test_renamed_dir_in_from_outside_btt_not_repo_root(self): 101 def test_renamed_dir_in_from_outside_btt_not_repo_root(self):
96 repo = self._load_fixture_and_fetch( 102 repo = self._load_fixture_and_fetch(
97 'fetch_missing_files_subdir.svndump', subdir='foo') 103 'fetch_missing_files_subdir.svndump', subdir='foo')
98 self.assertEqual(node.hex(repo['tip'].node()), 104 self.assertEqual(node.hex(repo['tip'].node()),
99 '2fae2544a5858d0bc6c04976683b3dcc0416d6e3') 105 '269dcdd4361b2847e9f4288d4500e55d35df1f52')
100 self.assert_('bar/alpha' in repo['tip']) 106 self.assert_('bar/alpha' in repo['tip'])
101 self.assert_('foo' in repo['tip']) 107 self.assert_('foo' in repo['tip'])
102 self.assert_('bar/alpha' not in repo['tip'].parents()[0]) 108 self.assert_('bar/alpha' not in repo['tip'].parents()[0])
103 self.assert_('foo' in repo['tip'].parents()[0]) 109 self.assert_('foo' in repo['tip'].parents()[0])
104 110
105 def test_oldest_not_trunk_and_tag_vendor_branch(self): 111 def test_oldest_not_trunk_and_tag_vendor_branch(self):
106 repo = self._load_fixture_and_fetch( 112 repo = self._load_fixture_and_fetch(
107 'tagged_vendor_and_oldest_not_trunk.svndump') 113 'tagged_vendor_and_oldest_not_trunk.svndump')
108 self.assertEqual(node.hex(repo['oldest'].node()), 114 self.assertEqual(node.hex(repo['oldest'].node()),
109 'd73002bcdeffe389a8df81ee43303d36e79e8ca4') 115 '926671740dec045077ab20f110c1595f935334fa')
110 self.assertEqual(repo['tip'].parents()[0].parents()[0], 116 self.assertEqual(repo['tip'].parents()[0].parents()[0],
111 repo['oldest']) 117 repo['oldest'])
112 self.assertEqual(node.hex(repo['tip'].node()), 118 self.assertEqual(node.hex(repo['tip'].node()),
113 '9cf09e6ff7fa938188c3bcc9dd87abd7842c080c') 119 '1a6c3f30911d57abb67c257ec0df3e7bc44786f7')
114 120
115 def test_propedit_with_nothing_else(self, stupid=False): 121 def test_propedit_with_nothing_else(self, stupid=False):
116 repo = self._load_fixture_and_fetch('branch_prop_edit.svndump', 122 repo = self._load_fixture_and_fetch('branch_prop_edit.svndump',
117 stupid=stupid) 123 stupid=stupid)
118 self.assertEqual(repo['tip'].description(), 'Commit bogus propchange.') 124 self.assertEqual(repo['tip'].description(), 'Commit bogus propchange.')
137 self.repo_path, 143 self.repo_path,
138 self.wc_path, 144 self.wc_path,
139 True) 145 True)
140 # TODO there must be a better way than repo[0] for this check 146 # TODO there must be a better way than repo[0] for this check
141 self.assertEqual(node.hex(repo[0].node()), 147 self.assertEqual(node.hex(repo[0].node()),
142 'a47d0ce778660a91c31bf2c21c448e9ee296ac90') 148 '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
143 self.assertEqual(node.hex(repo['tip'].node()), 149 self.assertEqual(node.hex(repo['tip'].node()),
144 'a595c77cfcaa3d1ba9e04b2c55c68bc6bf2b0fbf') 150 '1083037b18d85cd84fa211c5adbaeff0fea2cd9f')
145 self.assertEqual(node.hex(repo['the_branch'].node()), 151 self.assertEqual(node.hex(repo['the_branch'].node()),
146 '8ccaba5f0eae124487e413abd904a013f7f6fdeb') 152 '4e256962fc5df545e2e0a51d0d1dc61c469127e6')
153 self.assertEqual(repo['the_branch'].extra()['convert_revision'],
154 'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/branches/the_branch@5')
147 self.assertEqual(node.hex(repo['the_branch'].parents()[0].node()), 155 self.assertEqual(node.hex(repo['the_branch'].parents()[0].node()),
148 '9dfb0a19494f45c36e22f3c6d1b21d80638a7f6e') 156 'f1ff5b860f5dbb9a59ad0921a79da77f10f25109')
149 self.assertEqual(len(repo['tip'].parents()), 1) 157 self.assertEqual(len(repo['tip'].parents()), 1)
158 self.assertEqual(repo['default'].extra()['convert_revision'],
159 'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/trunk@6')
150 self.assertEqual(repo['tip'], repo['default']) 160 self.assertEqual(repo['tip'], repo['default'])
151 self.assertEqual(len(repo.heads()), 2) 161 self.assertEqual(len(repo.heads()), 2)
152 162
153 def test_oldest_not_trunk_and_tag_vendor_branch(self): 163 def test_oldest_not_trunk_and_tag_vendor_branch(self):
154 repo = test_util.load_fixture_and_fetch( 164 repo = test_util.load_fixture_and_fetch(
156 self.repo_path, 166 self.repo_path,
157 self.wc_path, 167 self.wc_path,
158 True) 168 True)
159 repo = hg.repository(ui.ui(), self.wc_path) 169 repo = hg.repository(ui.ui(), self.wc_path)
160 self.assertEqual(node.hex(repo['oldest'].node()), 170 self.assertEqual(node.hex(repo['oldest'].node()),
161 'd73002bcdeffe389a8df81ee43303d36e79e8ca4') 171 '926671740dec045077ab20f110c1595f935334fa')
162 self.assertEqual(repo['tip'].parents()[0].parents()[0], 172 self.assertEqual(repo['tip'].parents()[0].parents()[0],
163 repo['oldest']) 173 repo['oldest'])
164 self.assertEqual(node.hex(repo['tip'].node()), 174 self.assertEqual(node.hex(repo['tip'].node()),
165 '9cf09e6ff7fa938188c3bcc9dd87abd7842c080c') 175 '1a6c3f30911d57abb67c257ec0df3e7bc44786f7')
166 176
167 def suite(): 177 def suite():
168 all = [unittest.TestLoader().loadTestsFromTestCase(TestBasicRepoLayout), 178 all = [unittest.TestLoader().loadTestsFromTestCase(TestBasicRepoLayout),
169 unittest.TestLoader().loadTestsFromTestCase(TestStupidPull), 179 unittest.TestLoader().loadTestsFromTestCase(TestStupidPull),
170 ] 180 ]