comparison tests/test_externals.py @ 762:c31a1f92e1c6

svnexternals: preliminary support for subrepos based externals At this point, only pulling externals definitions into .hgsub and .hgsubstate is supported. One difference between subrepos and svn:externals is the former separate the source definition and target revision in two files, while svn:externals definitions contain both. To handle this, the svn:externals revision references is replaced with a {REV} placeholder and stored in .hgsub, prefixed with the external base directory separated with a ':', while the revision is extracted in .hgsubstate. For instance, the following external: -r3 ^/externals/proj2@2 deps/proj2 Becomes: (.hgsub) deps/proj2 = [hgsubversion] :-r{REV} ^/externals/proj2@2 deps/proj2 (.hgsubstate) 3 deps/proj2
author Patrick Mezard <pmezard@gmail.com>
date Thu, 25 Nov 2010 21:55:21 +0100
parents 979148947967
children 6463b34bbcb6
comparison
equal deleted inserted replaced
761:979148947967 762:c31a1f92e1c6
136 'deps/project2'], 136 'deps/project2'],
137 ['deps/project1'], repo, 2) 137 ['deps/project1'], repo, 2)
138 checkdeps(['subdir/deps/project1', 'deps/project2'], 138 checkdeps(['subdir/deps/project1', 'deps/project2'],
139 ['subdir2/deps/project1'], repo, 3) 139 ['subdir2/deps/project1'], repo, 3)
140 checkdeps(['subdir/deps/project1'], ['deps/project2'], repo, 4) 140 checkdeps(['subdir/deps/project1'], ['deps/project2'], repo, 4)
141
142 def test_hgsub(self, stupid=False):
143 repo = self._load_fixture_and_fetch('externals.svndump',
144 externals='subrepos',
145 stupid=stupid)
146 self.assertEqual("""\
147 deps/project1 = [hgsubversion] :^/externals/project1 deps/project1
148 """, repo[0]['.hgsub'].data())
149 self.assertEqual("""\
150 HEAD deps/project1
151 """, repo[0]['.hgsubstate'].data())
152
153 self.assertEqual("""\
154 deps/project1 = [hgsubversion] :^/externals/project1 deps/project1
155 deps/project2 = [hgsubversion] :-r{REV} ^/externals/project2@2 deps/project2
156 """, repo[1]['.hgsub'].data())
157 self.assertEqual("""\
158 HEAD deps/project1
159 2 deps/project2
160 """, repo[1]['.hgsubstate'].data())
161
162 self.assertEqual("""\
163 deps/project2 = [hgsubversion] :-r{REV} ^/externals/project2@2 deps/project2
164 subdir/deps/project1 = [hgsubversion] subdir:^/externals/project1 deps/project1
165 subdir2/deps/project1 = [hgsubversion] subdir2:^/externals/project1 deps/project1
166 """, repo[2]['.hgsub'].data())
167 self.assertEqual("""\
168 2 deps/project2
169 HEAD subdir/deps/project1
170 HEAD subdir2/deps/project1
171 """, repo[2]['.hgsubstate'].data())
172
173 self.assertEqual("""\
174 deps/project2 = [hgsubversion] :-r{REV} ^/externals/project2@2 deps/project2
175 subdir/deps/project1 = [hgsubversion] subdir:^/externals/project1 deps/project1
176 """, repo[3]['.hgsub'].data())
177 self.assertEqual("""\
178 2 deps/project2
179 HEAD subdir/deps/project1
180 """, repo[3]['.hgsubstate'].data())
181
182 self.assertEqual("""\
183 subdir/deps/project1 = [hgsubversion] subdir:^/externals/project1 deps/project1
184 """, repo[4]['.hgsub'].data())
185 self.assertEqual("""\
186 HEAD subdir/deps/project1
187 """, repo[4]['.hgsubstate'].data())
188
189 self.assertEqual("""\
190 deps/project2 = [hgsubversion] :-r{REV} ^/externals/project2@2 deps/project2
191 subdir2/deps/project1 = [hgsubversion] subdir2:^/externals/project1 deps/project1
192 """, repo[5]['.hgsub'].data())
193 self.assertEqual("""\
194 2 deps/project2
195 HEAD subdir2/deps/project1
196 """, repo[5]['.hgsubstate'].data())
197
198 self.assertEqual("""\
199 deps/project2 = [hgsubversion] :-r{REV} ^/externals/project2@2 deps/project2
200 """, repo[6]['.hgsub'].data())
201 self.assertEqual("""\
202 2 deps/project2
203 """, repo[6]['.hgsubstate'].data())
204
205 def test_hgsub_stupid(self):
206 self.test_hgsub(True)
141 207
142 class TestPushExternals(test_util.TestBase): 208 class TestPushExternals(test_util.TestBase):
143 def setUp(self): 209 def setUp(self):
144 test_util.TestBase.setUp(self) 210 test_util.TestBase.setUp(self)
145 test_util.load_fixture_and_fetch('pushexternals.svndump', 211 test_util.load_fixture_and_fetch('pushexternals.svndump',