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