comparison tests/test_single_dir_clone.py @ 499:1fd3cfa47c5e

Support for single-directory clones.
author Augie Fackler <durin42@gmail.com>
date Fri, 16 Oct 2009 23:33:41 -0400
parents
children 5ddc212dbc56
comparison
equal deleted inserted replaced
498:990e07054f29 499:1fd3cfa47c5e
1 import shutil
2
3 import test_util
4
5
6 class TestSingleDir(test_util.TestBase):
7 def test_clone_single_dir_simple(self):
8 repo = self._load_fixture_and_fetch('branch_from_tag.svndump',
9 stupid=False,
10 layout='single',
11 subdir='')
12 self.assertEqual(repo.branchtags().keys(), ['default'])
13 self.assertEqual(repo['tip'].manifest().keys(),
14 ['trunk/beta',
15 'tags/copied_tag/alpha',
16 'trunk/alpha',
17 'tags/copied_tag/beta',
18 'branches/branch_from_tag/alpha',
19 'tags/tag_r3/alpha',
20 'tags/tag_r3/beta',
21 'branches/branch_from_tag/beta'])
22
23 def test_auto_detect_single(self):
24 repo = self._load_fixture_and_fetch('branch_from_tag.svndump',
25 stupid=False,
26 layout='auto')
27 self.assertEqual(repo.branchtags().keys(), ['default',
28 'branch_from_tag'])
29 oldmanifest = test_util.filtermanifest(repo['default'].manifest().keys())
30 # remove standard layout
31 shutil.rmtree(self.wc_path)
32 # try again with subdir to get single dir clone
33 repo = self._load_fixture_and_fetch('branch_from_tag.svndump',
34 stupid=False,
35 layout='auto',
36 subdir='trunk')
37 self.assertEqual(repo.branchtags().keys(), ['default', ])
38 self.assertEqual(repo['default'].manifest().keys(), oldmanifest)
39
40 def test_externals_single(self):
41 repo = self._load_fixture_and_fetch('externals.svndump',
42 stupid=False,
43 layout='single')
44 for rev in repo:
45 assert '.hgsvnexternals' not in repo[rev].manifest()
46 return # TODO enable test when externals in single are fixed
47 expect = """[.]
48 -r2 ^/externals/project2@2 deps/project2
49 [subdir]
50 ^/externals/project1 deps/project1
51 [subdir2]
52 ^/externals/project1 deps/project1
53 """
54 test = 2
55 self.assertEqual(self.repo[test]['.hgsvnexternals'].data(), expect)
56
57 def test_externals_single_whole_repo(self):
58 # This is the test which demonstrates the brokenness of externals
59 return # TODO enable test when externals in single are fixed
60 repo = self._load_fixture_and_fetch('externals.svndump',
61 stupid=False,
62 layout='single',
63 subdir='')
64 for rev in repo:
65 rc = repo[rev]
66 if '.hgsvnexternals' in rc:
67 extdata = rc['.hgsvnexternals'].data()
68 assert '[.]' not in extdata
69 print extdata
70 expect = '' # Not honestly sure what this should be...
71 test = 4
72 self.assertEqual(self.repo[test]['.hgsvnexternals'].data(), expect)