annotate tests/test_externals.py @ 794:c32c92fdca5b

util: use real function definitions for keywords, document them Starting with mercurial 1.9 template keywords and filters documentation is generated from the items docstrings.
author Patrick Mezard <pmezard@gmail.com>
date Sat, 12 Mar 2011 15:27:22 +0100
parents ba65c0b01d4f
children 6f0b0a47938c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
643
d2ef7220a079 tests: import test_util as the first module in all relevant tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 576
diff changeset
1 import test_util
d2ef7220a079 tests: import test_util as the first module in all relevant tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 576
diff changeset
2
763
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
3 import os, unittest, sys
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
4
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
5 from mercurial import commands
763
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
6 from mercurial import util as hgutil
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
7 try:
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
8 from mercurial import subrepo
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
9 # require svnsubrepo and hg >= 1.7.1
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
10 subrepo.svnsubrepo
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
11 hgutil.checknlink
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
12 except (ImportError, AttributeError), e:
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
13 print >>sys.stderr, 'test_externals: skipping .hgsub tests'
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
14 subrepo = None
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
15
337
46e69be8e2c8 Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents: 315
diff changeset
16 from hgsubversion import svnexternals
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
17
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
18 class TestFetchExternals(test_util.TestBase):
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
19 def test_externalsfile(self):
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
20 f = svnexternals.externalsfile()
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
21 f['t1'] = 'dir1 -r10 svn://foobar'
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
22 f['t 2'] = 'dir2 -r10 svn://foobar'
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
23 f['t3'] = ['dir31 -r10 svn://foobar', 'dir32 -r10 svn://foobar']
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
24
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
25 refext = """[t 2]
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
26 dir2 -r10 svn://foobar
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
27 [t1]
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
28 dir1 -r10 svn://foobar
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
29 [t3]
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
30 dir31 -r10 svn://foobar
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
31 dir32 -r10 svn://foobar
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
32 """
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
33 value = f.write()
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
34 self.assertEqual(refext, value)
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
35
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
36 f2 = svnexternals.externalsfile()
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
37 f2.read(value)
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
38 self.assertEqual(sorted(f), sorted(f2))
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
39 for t in f:
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
40 self.assertEqual(f[t], f2[t])
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
41
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
42 def test_parsedefinitions(self):
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
43 # Taken from svn book
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
44 samples = [
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
45 ('third-party/sounds http://svn.example.com/repos/sounds',
761
979148947967 svnexternals: generate externals with a revision placeholder
Patrick Mezard <pmezard@gmail.com>
parents: 643
diff changeset
46 ('third-party/sounds', None, 'http://svn.example.com/repos/sounds', None,
979148947967 svnexternals: generate externals with a revision placeholder
Patrick Mezard <pmezard@gmail.com>
parents: 643
diff changeset
47 'third-party/sounds http://svn.example.com/repos/sounds')),
979148947967 svnexternals: generate externals with a revision placeholder
Patrick Mezard <pmezard@gmail.com>
parents: 643
diff changeset
48
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
49 ('third-party/skins -r148 http://svn.example.com/skinproj',
761
979148947967 svnexternals: generate externals with a revision placeholder
Patrick Mezard <pmezard@gmail.com>
parents: 643
diff changeset
50 ('third-party/skins', '148', 'http://svn.example.com/skinproj', None,
979148947967 svnexternals: generate externals with a revision placeholder
Patrick Mezard <pmezard@gmail.com>
parents: 643
diff changeset
51 'third-party/skins -r{REV} http://svn.example.com/skinproj')),
979148947967 svnexternals: generate externals with a revision placeholder
Patrick Mezard <pmezard@gmail.com>
parents: 643
diff changeset
52
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
53 ('third-party/skins -r 148 http://svn.example.com/skinproj',
761
979148947967 svnexternals: generate externals with a revision placeholder
Patrick Mezard <pmezard@gmail.com>
parents: 643
diff changeset
54 ('third-party/skins', '148', 'http://svn.example.com/skinproj', None,
979148947967 svnexternals: generate externals with a revision placeholder
Patrick Mezard <pmezard@gmail.com>
parents: 643
diff changeset
55 'third-party/skins -r {REV} http://svn.example.com/skinproj')),
979148947967 svnexternals: generate externals with a revision placeholder
Patrick Mezard <pmezard@gmail.com>
parents: 643
diff changeset
56
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
57 ('http://svn.example.com/repos/sounds third-party/sounds',
761
979148947967 svnexternals: generate externals with a revision placeholder
Patrick Mezard <pmezard@gmail.com>
parents: 643
diff changeset
58 ('third-party/sounds', None, 'http://svn.example.com/repos/sounds', None,
979148947967 svnexternals: generate externals with a revision placeholder
Patrick Mezard <pmezard@gmail.com>
parents: 643
diff changeset
59 'http://svn.example.com/repos/sounds third-party/sounds')),
979148947967 svnexternals: generate externals with a revision placeholder
Patrick Mezard <pmezard@gmail.com>
parents: 643
diff changeset
60
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
61 ('-r148 http://svn.example.com/skinproj third-party/skins',
761
979148947967 svnexternals: generate externals with a revision placeholder
Patrick Mezard <pmezard@gmail.com>
parents: 643
diff changeset
62 ('third-party/skins', '148', 'http://svn.example.com/skinproj', None,
979148947967 svnexternals: generate externals with a revision placeholder
Patrick Mezard <pmezard@gmail.com>
parents: 643
diff changeset
63 '-r{REV} http://svn.example.com/skinproj third-party/skins')),
979148947967 svnexternals: generate externals with a revision placeholder
Patrick Mezard <pmezard@gmail.com>
parents: 643
diff changeset
64
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
65 ('-r 148 http://svn.example.com/skinproj third-party/skins',
761
979148947967 svnexternals: generate externals with a revision placeholder
Patrick Mezard <pmezard@gmail.com>
parents: 643
diff changeset
66 ('third-party/skins', '148', 'http://svn.example.com/skinproj', None,
979148947967 svnexternals: generate externals with a revision placeholder
Patrick Mezard <pmezard@gmail.com>
parents: 643
diff changeset
67 '-r {REV} http://svn.example.com/skinproj third-party/skins')),
979148947967 svnexternals: generate externals with a revision placeholder
Patrick Mezard <pmezard@gmail.com>
parents: 643
diff changeset
68
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
69 ('http://svn.example.com/skin-maker@21 third-party/skins/toolkit',
761
979148947967 svnexternals: generate externals with a revision placeholder
Patrick Mezard <pmezard@gmail.com>
parents: 643
diff changeset
70 ('third-party/skins/toolkit', None, 'http://svn.example.com/skin-maker', '21',
979148947967 svnexternals: generate externals with a revision placeholder
Patrick Mezard <pmezard@gmail.com>
parents: 643
diff changeset
71 'http://svn.example.com/skin-maker@21 third-party/skins/toolkit')),
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
72 ]
337
46e69be8e2c8 Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents: 315
diff changeset
73
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
74 for line, expected in samples:
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
75 self.assertEqual(expected, svnexternals.parsedefinition(line))
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
76
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
77 def test_externals(self, stupid=False):
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
78 repo = self._load_fixture_and_fetch('externals.svndump', stupid=stupid)
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
79
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
80 ref0 = """[.]
183
1c46ad3f56aa test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents: 176
diff changeset
81 ^/externals/project1 deps/project1
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
82 """
218
a360ddc97719 branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents: 215
diff changeset
83 self.assertEqual(ref0, repo[0]['.hgsvnexternals'].data())
789
a5be5ca638de externals: ignore externals blank or comment lines
Patrick Mezard <pmezard@gmail.com>
parents: 785
diff changeset
84 ref1 = """\
a5be5ca638de externals: ignore externals blank or comment lines
Patrick Mezard <pmezard@gmail.com>
parents: 785
diff changeset
85 [.]
a5be5ca638de externals: ignore externals blank or comment lines
Patrick Mezard <pmezard@gmail.com>
parents: 785
diff changeset
86 # A comment, then an empty line, then a blank line
a5be5ca638de externals: ignore externals blank or comment lines
Patrick Mezard <pmezard@gmail.com>
parents: 785
diff changeset
87
183
1c46ad3f56aa test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents: 176
diff changeset
88 ^/externals/project1 deps/project1
789
a5be5ca638de externals: ignore externals blank or comment lines
Patrick Mezard <pmezard@gmail.com>
parents: 785
diff changeset
89
315
963d27a0b1c2 svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents: 291
diff changeset
90 -r2 ^/externals/project2@2 deps/project2
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
91 """
218
a360ddc97719 branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents: 215
diff changeset
92 self.assertEqual(ref1, repo[1]['.hgsvnexternals'].data())
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
93
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
94 ref2 = """[.]
315
963d27a0b1c2 svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents: 291
diff changeset
95 -r2 ^/externals/project2@2 deps/project2
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
96 [subdir]
183
1c46ad3f56aa test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents: 176
diff changeset
97 ^/externals/project1 deps/project1
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
98 [subdir2]
183
1c46ad3f56aa test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents: 176
diff changeset
99 ^/externals/project1 deps/project1
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
100 """
218
a360ddc97719 branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents: 215
diff changeset
101 actual = repo[2]['.hgsvnexternals'].data()
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
102 self.assertEqual(ref2, actual)
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
103
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
104 ref3 = """[.]
315
963d27a0b1c2 svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents: 291
diff changeset
105 -r2 ^/externals/project2@2 deps/project2
183
1c46ad3f56aa test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents: 176
diff changeset
106 [subdir]
1c46ad3f56aa test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents: 176
diff changeset
107 ^/externals/project1 deps/project1
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
108 """
218
a360ddc97719 branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents: 215
diff changeset
109 self.assertEqual(ref3, repo[3]['.hgsvnexternals'].data())
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
110
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
111 ref4 = """[subdir]
183
1c46ad3f56aa test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents: 176
diff changeset
112 ^/externals/project1 deps/project1
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
113 """
218
a360ddc97719 branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents: 215
diff changeset
114 self.assertEqual(ref4, repo[4]['.hgsvnexternals'].data())
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
115
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
116 ref5 = """[.]
315
963d27a0b1c2 svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents: 291
diff changeset
117 -r2 ^/externals/project2@2 deps/project2
184
d3ea6c98a086 Do not recurse for externals on copied directory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 183
diff changeset
118 [subdir2]
d3ea6c98a086 Do not recurse for externals on copied directory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 183
diff changeset
119 ^/externals/project1 deps/project1
183
1c46ad3f56aa test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents: 176
diff changeset
120 """
218
a360ddc97719 branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents: 215
diff changeset
121 self.assertEqual(ref5, repo[5]['.hgsvnexternals'].data())
183
1c46ad3f56aa test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents: 176
diff changeset
122
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
123 ref6 = """[.]
315
963d27a0b1c2 svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents: 291
diff changeset
124 -r2 ^/externals/project2@2 deps/project2
184
d3ea6c98a086 Do not recurse for externals on copied directory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 183
diff changeset
125 """
218
a360ddc97719 branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents: 215
diff changeset
126 self.assertEqual(ref6, repo[6]['.hgsvnexternals'].data())
184
d3ea6c98a086 Do not recurse for externals on copied directory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 183
diff changeset
127
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
128 def test_externals_stupid(self):
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
129 self.test_externals(True)
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
130
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
131 def test_updateexternals(self):
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
132 def checkdeps(deps, nodeps, repo, rev=None):
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
133 svnexternals.updateexternals(ui, [rev], repo)
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
134 for d in deps:
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
135 p = os.path.join(repo.root, d)
337
46e69be8e2c8 Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents: 315
diff changeset
136 self.assertTrue(os.path.isdir(p),
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
137 'missing: %s@%r' % (d, rev))
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
138 for d in nodeps:
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
139 p = os.path.join(repo.root, d)
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
140 self.assertTrue(not os.path.isdir(p),
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
141 'unexpected: %s@%r' % (d, rev))
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
142
576
d96aa92d9ad9 tests: silence test suite by using quiet UIs everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 337
diff changeset
143 ui = self.ui()
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
144 repo = self._load_fixture_and_fetch('externals.svndump', stupid=0)
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
145 commands.update(ui, repo)
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
146 checkdeps(['deps/project1'], [], repo, 0)
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
147 checkdeps(['deps/project1', 'deps/project2'], [], repo, 1)
337
46e69be8e2c8 Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents: 315
diff changeset
148 checkdeps(['subdir/deps/project1', 'subdir2/deps/project1',
46e69be8e2c8 Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents: 315
diff changeset
149 'deps/project2'],
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
150 ['deps/project1'], repo, 2)
337
46e69be8e2c8 Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents: 315
diff changeset
151 checkdeps(['subdir/deps/project1', 'deps/project2'],
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
152 ['subdir2/deps/project1'], repo, 3)
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
153 checkdeps(['subdir/deps/project1'], ['deps/project2'], repo, 4)
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
154
762
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
155 def test_hgsub(self, stupid=False):
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
156 repo = self._load_fixture_and_fetch('externals.svndump',
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
157 externals='subrepos',
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
158 stupid=stupid)
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
159 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
160 deps/project1 = [hgsubversion] :^/externals/project1 deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
161 """, repo[0]['.hgsub'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
162 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
163 HEAD deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
164 """, repo[0]['.hgsubstate'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
165
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
166 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
167 deps/project1 = [hgsubversion] :^/externals/project1 deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
168 deps/project2 = [hgsubversion] :-r{REV} ^/externals/project2@2 deps/project2
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
169 """, repo[1]['.hgsub'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
170 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
171 HEAD deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
172 2 deps/project2
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
173 """, repo[1]['.hgsubstate'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
174
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
175 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
176 deps/project2 = [hgsubversion] :-r{REV} ^/externals/project2@2 deps/project2
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
177 subdir/deps/project1 = [hgsubversion] subdir:^/externals/project1 deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
178 subdir2/deps/project1 = [hgsubversion] subdir2:^/externals/project1 deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
179 """, repo[2]['.hgsub'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
180 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
181 2 deps/project2
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
182 HEAD subdir/deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
183 HEAD subdir2/deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
184 """, repo[2]['.hgsubstate'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
185
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
186 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
187 deps/project2 = [hgsubversion] :-r{REV} ^/externals/project2@2 deps/project2
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
188 subdir/deps/project1 = [hgsubversion] subdir:^/externals/project1 deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
189 """, repo[3]['.hgsub'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
190 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
191 2 deps/project2
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
192 HEAD subdir/deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
193 """, repo[3]['.hgsubstate'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
194
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
195 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
196 subdir/deps/project1 = [hgsubversion] subdir:^/externals/project1 deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
197 """, repo[4]['.hgsub'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
198 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
199 HEAD subdir/deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
200 """, repo[4]['.hgsubstate'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
201
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
202 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
203 deps/project2 = [hgsubversion] :-r{REV} ^/externals/project2@2 deps/project2
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
204 subdir2/deps/project1 = [hgsubversion] subdir2:^/externals/project1 deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
205 """, repo[5]['.hgsub'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
206 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
207 2 deps/project2
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
208 HEAD subdir2/deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
209 """, repo[5]['.hgsubstate'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
210
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
211 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
212 deps/project2 = [hgsubversion] :-r{REV} ^/externals/project2@2 deps/project2
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
213 """, repo[6]['.hgsub'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
214 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
215 2 deps/project2
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
216 """, repo[6]['.hgsubstate'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
217
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
218 def test_hgsub_stupid(self):
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
219 self.test_hgsub(True)
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
220
776
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
221 def test_ignore(self):
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
222 repo = self._load_fixture_and_fetch('externals.svndump',
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
223 externals='ignore')
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
224 for rev in repo:
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
225 ctx = repo[rev]
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
226 self.assertTrue('.hgsvnexternals' not in ctx)
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
227 self.assertTrue('.hgsub' not in ctx)
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
228 self.assertTrue('.hgsubstate' not in ctx)
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
229
763
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
230 def test_updatehgsub(self):
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
231 def checkdeps(ui, repo, rev, deps, nodeps):
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
232 commands.update(ui, repo, node=str(rev))
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
233 for d in deps:
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
234 p = os.path.join(repo.root, d)
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
235 self.assertTrue(os.path.isdir(p),
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
236 'missing: %s@%r' % (d, repo[None].rev()))
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
237 for d in nodeps:
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
238 p = os.path.join(repo.root, d)
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
239 self.assertTrue(not os.path.isdir(p),
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
240 'unexpected: %s@%r' % (d, repo[None].rev()))
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
241
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
242 if subrepo is None:
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
243 return
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
244
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
245 ui = self.ui()
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
246 repo = self._load_fixture_and_fetch('externals.svndump',
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
247 stupid=0, externals='subrepos')
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
248 checkdeps(ui, repo, 0, ['deps/project1'], [])
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
249 checkdeps(ui, repo, 1, ['deps/project1', 'deps/project2'], [])
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
250 checkdeps(ui, repo, 2, ['subdir/deps/project1', 'subdir2/deps/project1',
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
251 'deps/project2'],
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
252 ['deps/project1'])
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
253 checkdeps(ui, repo, 3, ['subdir/deps/project1', 'deps/project2'],
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
254 ['subdir2/deps/project1'])
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
255 checkdeps(ui, repo, 4, ['subdir/deps/project1'], ['deps/project2'])
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
256
784
f214fb3f92cd svnexternals: handle new overwrite argument of subrepo.get()
Patrick Mezard <pmezard@gmail.com>
parents: 776
diff changeset
257 # Test update --clean, used to crash
f214fb3f92cd svnexternals: handle new overwrite argument of subrepo.get()
Patrick Mezard <pmezard@gmail.com>
parents: 776
diff changeset
258 repo.wwrite('subdir/deps/project1/a', 'foobar', '')
f214fb3f92cd svnexternals: handle new overwrite argument of subrepo.get()
Patrick Mezard <pmezard@gmail.com>
parents: 776
diff changeset
259 commands.update(ui, repo, node='4', clean=True)
f214fb3f92cd svnexternals: handle new overwrite argument of subrepo.get()
Patrick Mezard <pmezard@gmail.com>
parents: 776
diff changeset
260
792
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
261 def test_mergeexternals(self, stupid=False):
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
262 repo = self._load_fixture_and_fetch('mergeexternals.svndump',
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
263 externals='subrepos',
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
264 stupid=stupid)
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
265 # Check merged directories externals are fine
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
266 self.assertEqual("""\
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
267 d1/ext = [hgsubversion] d1:^/trunk/common/ext ext
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
268 d2/ext = [hgsubversion] d2:^/trunk/common/ext ext
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
269 d3/ext3 = [hgsubversion] d3:^/trunk/common/ext ext3
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
270 """, repo['tip']['.hgsub'].data())
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
271
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
272 def test_mergeexternals_stupid(self):
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
273 self.test_mergeexternals(True)
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
274
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
275 class TestPushExternals(test_util.TestBase):
764
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
276 def test_push_externals(self, stupid=False):
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
277 test_util.load_fixture_and_fetch('pushexternals.svndump',
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
278 self.repo_path,
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
279 self.wc_path)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
280 # Add a new reference on an existing and non-existing directory
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
281 changes = [
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
282 ('.hgsvnexternals', '.hgsvnexternals',
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
283 """[dir]
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
284 ../externals/project2 deps/project2
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
285 [subdir1]
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
286 ../externals/project1 deps/project1
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
287 [subdir2]
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
288 ../externals/project2 deps/project2
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
289 """),
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
290 ('subdir1/a', 'subdir1/a', 'a'),
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
291 ('subdir2/a', 'subdir2/a', 'a'),
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
292 ]
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
293 self.commitchanges(changes)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
294 self.pushrevisions(stupid)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
295 self.assertchanges(changes, self.repo['tip'])
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
296
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
297 # Remove all references from one directory, add a new one
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
298 # to the other (test multiline entries)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
299 changes = [
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
300 ('.hgsvnexternals', '.hgsvnexternals',
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
301 """[subdir1]
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
302 ../externals/project1 deps/project1
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
303 ../externals/project2 deps/project2
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
304 """),
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
305 # This removal used to trigger the parent directory removal
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
306 ('subdir1/a', None, None),
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
307 ]
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
308 self.commitchanges(changes)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
309 self.pushrevisions(stupid)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
310 self.assertchanges(changes, self.repo['tip'])
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
311 # Check subdir2/a is still there even if the externals were removed
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
312 self.assertTrue('subdir2/a' in self.repo['tip'])
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
313 self.assertTrue('subdir1/a' not in self.repo['tip'])
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
314
176
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
315 # Test externals removal
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
316 changes = [
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
317 ('.hgsvnexternals', None, None),
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
318 ]
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
319 self.commitchanges(changes)
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
320 self.pushrevisions(stupid)
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
321 self.assertchanges(changes, self.repo['tip'])
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
322
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
323 def test_push_externals_stupid(self):
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
324 self.test_push_externals(True)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
325
764
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
326 def test_push_hgsub(self, stupid=False):
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
327 if subrepo is None:
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
328 return
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
329
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
330 test_util.load_fixture_and_fetch('pushexternals.svndump',
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
331 self.repo_path,
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
332 self.wc_path,
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
333 externals='subrepos')
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
334 # Add a new reference on an existing and non-existing directory
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
335 changes = [
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
336 ('.hgsub', '.hgsub', """\
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
337 dir/deps/project2 = [hgsubversion] dir:^/externals/project2 deps/project2
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
338 subdir1/deps/project1 = [hgsubversion] subdir1:^/externals/project1 deps/project1
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
339 subdir2/deps/project2 = [hgsubversion] subdir2:^/externals/project2 deps/project2
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
340 """),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
341 ('.hgsubstate', '.hgsubstate', """\
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
342 HEAD dir/deps/project2
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
343 HEAD subdir1/deps/project1
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
344 HEAD subdir2/deps/project2
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
345 """),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
346 ('subdir1/a', 'subdir1/a', 'a'),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
347 ('subdir2/a', 'subdir2/a', 'a'),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
348 ]
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
349 self.svnco('externals/project2', '2', 'dir/deps/project2')
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
350 self.svnco('externals/project1', '2', 'subdir1/deps/project1')
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
351 self.svnco('externals/project2', '2', 'subdir2/deps/project2')
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
352 self.commitchanges(changes)
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
353 self.pushrevisions(stupid)
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
354 self.assertchanges(changes, self.repo['tip'])
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
355
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
356 # Check .hgsub and .hgsubstate were not pushed
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
357 self.assertEqual(['dir', 'subdir1', 'subdir1/a','subdir2',
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
358 'subdir2/a'], self.svnls('trunk'))
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
359
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
360 # Remove all references from one directory, add a new one
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
361 # to the other (test multiline entries)
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
362 changes = [
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
363 ('.hgsub', '.hgsub', """\
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
364 subdir1/deps/project1 = [hgsubversion] subdir1:^/externals/project1 deps/project1
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
365 subdir1/deps/project2 = [hgsubversion] subdir1:^/externals/project2 deps/project2
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
366 """),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
367 ('.hgsubstate', '.hgsubstate', """\
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
368 HEAD subdir1/deps/project1
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
369 HEAD subdir1/deps/project2
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
370 """),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
371 # This removal used to trigger the parent directory removal
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
372 ('subdir1/a', None, None),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
373 ]
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
374 self.svnco('externals/project1', '2', 'subdir1/deps/project1')
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
375 self.svnco('externals/project2', '2', 'subdir1/deps/project2')
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
376 self.commitchanges(changes)
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
377 self.pushrevisions(stupid)
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
378 self.assertchanges(changes, self.repo['tip'])
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
379 # Check subdir2/a is still there even if the externals were removed
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
380 self.assertTrue('subdir2/a' in self.repo['tip'])
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
381 self.assertTrue('subdir1/a' not in self.repo['tip'])
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
382
785
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
383 # Move the externals so they are defined on the base directory,
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
384 # this used to cause full branch removal when deleting the .hgsub
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
385 changes = [
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
386 ('.hgsub', '.hgsub', """\
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
387 subdir1/deps/project1 = [hgsubversion] :^/externals/project1 subdir1/deps/project1
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
388 """),
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
389 ('.hgsubstate', '.hgsubstate', """\
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
390 HEAD subdir1/deps/project1
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
391 """),
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
392 ]
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
393 self.commitchanges(changes)
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
394 self.pushrevisions(stupid)
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
395 self.assertchanges(changes, self.repo['tip'])
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
396
764
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
397 # Test externals removal
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
398 changes = [
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
399 ('.hgsub', None, None),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
400 ('.hgsubstate', None, None),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
401 ]
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
402 self.commitchanges(changes)
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
403 self.pushrevisions(stupid)
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
404 self.assertchanges(changes, self.repo['tip'])
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
405
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
406 def suite():
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
407 all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchExternals),
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
408 unittest.TestLoader().loadTestsFromTestCase(TestPushExternals),
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
409 ]
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
410 return unittest.TestSuite(all)