Mercurial > hgsubversion
comparison tests/test_externals.py @ 763:6463b34bbcb6
svnexternals: support subrepos based externals checkout
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Thu, 25 Nov 2010 21:55:21 +0100 |
parents | c31a1f92e1c6 |
children | bc5c176b63eb |
comparison
equal
deleted
inserted
replaced
762:c31a1f92e1c6 | 763:6463b34bbcb6 |
---|---|
1 import test_util | 1 import test_util |
2 | 2 |
3 import os, unittest | 3 import os, unittest, sys |
4 | 4 |
5 from mercurial import commands | 5 from mercurial import commands |
6 from mercurial import util as hgutil | |
7 try: | |
8 from mercurial import subrepo | |
9 # require svnsubrepo and hg >= 1.7.1 | |
10 subrepo.svnsubrepo | |
11 hgutil.checknlink | |
12 except (ImportError, AttributeError), e: | |
13 print >>sys.stderr, 'test_externals: skipping .hgsub tests' | |
14 subrepo = None | |
6 | 15 |
7 from hgsubversion import svnexternals | 16 from hgsubversion import svnexternals |
8 | 17 |
9 class TestFetchExternals(test_util.TestBase): | 18 class TestFetchExternals(test_util.TestBase): |
10 def test_externalsfile(self): | 19 def test_externalsfile(self): |
202 2 deps/project2 | 211 2 deps/project2 |
203 """, repo[6]['.hgsubstate'].data()) | 212 """, repo[6]['.hgsubstate'].data()) |
204 | 213 |
205 def test_hgsub_stupid(self): | 214 def test_hgsub_stupid(self): |
206 self.test_hgsub(True) | 215 self.test_hgsub(True) |
216 | |
217 def test_updatehgsub(self): | |
218 def checkdeps(ui, repo, rev, deps, nodeps): | |
219 commands.update(ui, repo, node=str(rev)) | |
220 for d in deps: | |
221 p = os.path.join(repo.root, d) | |
222 self.assertTrue(os.path.isdir(p), | |
223 'missing: %s@%r' % (d, repo[None].rev())) | |
224 for d in nodeps: | |
225 p = os.path.join(repo.root, d) | |
226 self.assertTrue(not os.path.isdir(p), | |
227 'unexpected: %s@%r' % (d, repo[None].rev())) | |
228 | |
229 if subrepo is None: | |
230 return | |
231 | |
232 ui = self.ui() | |
233 repo = self._load_fixture_and_fetch('externals.svndump', | |
234 stupid=0, externals='subrepos') | |
235 checkdeps(ui, repo, 0, ['deps/project1'], []) | |
236 checkdeps(ui, repo, 1, ['deps/project1', 'deps/project2'], []) | |
237 checkdeps(ui, repo, 2, ['subdir/deps/project1', 'subdir2/deps/project1', | |
238 'deps/project2'], | |
239 ['deps/project1']) | |
240 checkdeps(ui, repo, 3, ['subdir/deps/project1', 'deps/project2'], | |
241 ['subdir2/deps/project1']) | |
242 checkdeps(ui, repo, 4, ['subdir/deps/project1'], ['deps/project2']) | |
207 | 243 |
208 class TestPushExternals(test_util.TestBase): | 244 class TestPushExternals(test_util.TestBase): |
209 def setUp(self): | 245 def setUp(self): |
210 test_util.TestBase.setUp(self) | 246 test_util.TestBase.setUp(self) |
211 test_util.load_fixture_and_fetch('pushexternals.svndump', | 247 test_util.load_fixture_and_fetch('pushexternals.svndump', |