annotate tests/test_externals.py @ 837:805ef27fbcbe

hgsubversion/*.py: add space after comment symbol #
author Yonggang Luo <luoyonggang@gmail.com>
date Mon, 17 Oct 2011 22:44:15 +0800
parents 312b37bc5e20
children 04729f3a3d17
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:
832
e9af7eba88db globally: clean up whitespace around operators and commas to conform with PEP8
Yonggang Luo <luoyonggang@gmail.com>
parents: 795
diff changeset
13 print >> sys.stderr, 'test_externals: skipping .hgsub tests'
763
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 """
795
6f0b0a47938c test_externals: flag another case as using hgsub, use assertMultiLineEqual
Augie Fackler <durin42@gmail.com>
parents: 792
diff changeset
83 self.assertMultiLineEqual(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 """
795
6f0b0a47938c test_externals: flag another case as using hgsub, use assertMultiLineEqual
Augie Fackler <durin42@gmail.com>
parents: 792
diff changeset
92 self.assertMultiLineEqual(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):
795
6f0b0a47938c test_externals: flag another case as using hgsub, use assertMultiLineEqual
Augie Fackler <durin42@gmail.com>
parents: 792
diff changeset
156 if subrepo is None:
6f0b0a47938c test_externals: flag another case as using hgsub, use assertMultiLineEqual
Augie Fackler <durin42@gmail.com>
parents: 792
diff changeset
157 return
762
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
158 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
159 externals='subrepos',
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
160 stupid=stupid)
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
161 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
162 deps/project1 = [hgsubversion] :^/externals/project1 deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
163 """, repo[0]['.hgsub'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
164 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
165 HEAD deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
166 """, repo[0]['.hgsubstate'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
167
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
168 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
169 deps/project1 = [hgsubversion] :^/externals/project1 deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
170 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
171 """, repo[1]['.hgsub'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
172 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
173 HEAD deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
174 2 deps/project2
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
175 """, repo[1]['.hgsubstate'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
176
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
177 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
178 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
179 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
180 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
181 """, repo[2]['.hgsub'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
182 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
183 2 deps/project2
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
184 HEAD subdir/deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
185 HEAD subdir2/deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
186 """, repo[2]['.hgsubstate'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
187
795
6f0b0a47938c test_externals: flag another case as using hgsub, use assertMultiLineEqual
Augie Fackler <durin42@gmail.com>
parents: 792
diff changeset
188 self.assertMultiLineEqual("""\
762
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
189 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
190 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
191 """, repo[3]['.hgsub'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
192 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
193 2 deps/project2
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
194 HEAD subdir/deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
195 """, repo[3]['.hgsubstate'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
196
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
197 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
198 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
199 """, repo[4]['.hgsub'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
200 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
201 HEAD subdir/deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
202 """, repo[4]['.hgsubstate'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
203
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
204 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
205 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
206 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
207 """, repo[5]['.hgsub'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
208 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
209 2 deps/project2
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
210 HEAD subdir2/deps/project1
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
211 """, repo[5]['.hgsubstate'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
212
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
213 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
214 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
215 """, repo[6]['.hgsub'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
216 self.assertEqual("""\
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
217 2 deps/project2
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
218 """, repo[6]['.hgsubstate'].data())
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
219
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
220 def test_hgsub_stupid(self):
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
221 self.test_hgsub(True)
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
222
776
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
223 def test_ignore(self):
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
224 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
225 externals='ignore')
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
226 for rev in repo:
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
227 ctx = repo[rev]
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
228 self.assertTrue('.hgsvnexternals' not in ctx)
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
229 self.assertTrue('.hgsub' not in ctx)
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
230 self.assertTrue('.hgsubstate' not in ctx)
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
231
763
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
232 def test_updatehgsub(self):
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
233 def checkdeps(ui, repo, rev, deps, nodeps):
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
234 commands.update(ui, repo, node=str(rev))
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
235 for d in deps:
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
236 p = os.path.join(repo.root, d)
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
237 self.assertTrue(os.path.isdir(p),
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
238 'missing: %s@%r' % (d, repo[None].rev()))
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
239 for d in nodeps:
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
240 p = os.path.join(repo.root, d)
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
241 self.assertTrue(not os.path.isdir(p),
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
242 'unexpected: %s@%r' % (d, repo[None].rev()))
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
243
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
244 if subrepo is None:
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
245 return
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
246
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
247 ui = self.ui()
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
248 repo = self._load_fixture_and_fetch('externals.svndump',
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
249 stupid=0, externals='subrepos')
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
250 checkdeps(ui, repo, 0, ['deps/project1'], [])
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
251 checkdeps(ui, repo, 1, ['deps/project1', 'deps/project2'], [])
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
252 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
253 'deps/project2'],
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
254 ['deps/project1'])
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
255 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
256 ['subdir2/deps/project1'])
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
257 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
258
784
f214fb3f92cd svnexternals: handle new overwrite argument of subrepo.get()
Patrick Mezard <pmezard@gmail.com>
parents: 776
diff changeset
259 # Test update --clean, used to crash
f214fb3f92cd svnexternals: handle new overwrite argument of subrepo.get()
Patrick Mezard <pmezard@gmail.com>
parents: 776
diff changeset
260 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
261 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
262
792
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
263 def test_mergeexternals(self, stupid=False):
795
6f0b0a47938c test_externals: flag another case as using hgsub, use assertMultiLineEqual
Augie Fackler <durin42@gmail.com>
parents: 792
diff changeset
264 if subrepo is None:
6f0b0a47938c test_externals: flag another case as using hgsub, use assertMultiLineEqual
Augie Fackler <durin42@gmail.com>
parents: 792
diff changeset
265 return
792
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
266 repo = self._load_fixture_and_fetch('mergeexternals.svndump',
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
267 externals='subrepos',
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
268 stupid=stupid)
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
269 # Check merged directories externals are fine
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
270 self.assertEqual("""\
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
271 d1/ext = [hgsubversion] d1:^/trunk/common/ext ext
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
272 d2/ext = [hgsubversion] d2:^/trunk/common/ext ext
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
273 d3/ext3 = [hgsubversion] d3:^/trunk/common/ext ext3
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
274 """, repo['tip']['.hgsub'].data())
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
275
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
276 def test_mergeexternals_stupid(self):
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
277 self.test_mergeexternals(True)
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
278
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
279 class TestPushExternals(test_util.TestBase):
764
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
280 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
281 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
282 self.repo_path,
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
283 self.wc_path)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
284 # 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
285 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
286 ('.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
287 """[dir]
175
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 [subdir1]
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
290 ../externals/project1 deps/project1
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
291 [subdir2]
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
292 ../externals/project2 deps/project2
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
293 """),
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
294 ('subdir1/a', 'subdir1/a', 'a'),
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
295 ('subdir2/a', 'subdir2/a', 'a'),
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 self.commitchanges(changes)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
298 self.pushrevisions(stupid)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
299 self.assertchanges(changes, self.repo['tip'])
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
300
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
301 # 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
302 # to the other (test multiline entries)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
303 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
304 ('.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
305 """[subdir1]
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
306 ../externals/project1 deps/project1
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
307 ../externals/project2 deps/project2
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
308 """),
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
309 # 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
310 ('subdir1/a', None, None),
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
311 ]
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
312 self.commitchanges(changes)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
313 self.pushrevisions(stupid)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
314 self.assertchanges(changes, self.repo['tip'])
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
315 # 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
316 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
317 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
318
176
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
319 # Test externals removal
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
320 changes = [
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
321 ('.hgsvnexternals', None, None),
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
322 ]
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
323 self.commitchanges(changes)
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
324 self.pushrevisions(stupid)
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
325 self.assertchanges(changes, self.repo['tip'])
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
326
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
327 def test_push_externals_stupid(self):
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
328 self.test_push_externals(True)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
329
764
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
330 def test_push_hgsub(self, stupid=False):
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
331 if subrepo is None:
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
332 return
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
333
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
334 test_util.load_fixture_and_fetch('pushexternals.svndump',
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
335 self.repo_path,
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
336 self.wc_path,
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
337 externals='subrepos')
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
338 # 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
339 changes = [
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
340 ('.hgsub', '.hgsub', """\
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
341 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
342 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
343 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
344 """),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
345 ('.hgsubstate', '.hgsubstate', """\
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
346 HEAD dir/deps/project2
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
347 HEAD subdir1/deps/project1
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
348 HEAD subdir2/deps/project2
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
349 """),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
350 ('subdir1/a', 'subdir1/a', 'a'),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
351 ('subdir2/a', 'subdir2/a', 'a'),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
352 ]
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
353 self.svnco('externals/project2', '2', 'dir/deps/project2')
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
354 self.svnco('externals/project1', '2', 'subdir1/deps/project1')
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
355 self.svnco('externals/project2', '2', 'subdir2/deps/project2')
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
356 self.commitchanges(changes)
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
357 self.pushrevisions(stupid)
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
358 self.assertchanges(changes, self.repo['tip'])
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 # Check .hgsub and .hgsubstate were not pushed
832
e9af7eba88db globally: clean up whitespace around operators and commas to conform with PEP8
Yonggang Luo <luoyonggang@gmail.com>
parents: 795
diff changeset
361 self.assertEqual(['dir', 'subdir1', 'subdir1/a', 'subdir2',
764
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
362 'subdir2/a'], self.svnls('trunk'))
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
363
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
364 # 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
365 # to the other (test multiline entries)
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
366 changes = [
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
367 ('.hgsub', '.hgsub', """\
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
368 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
369 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
370 """),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
371 ('.hgsubstate', '.hgsubstate', """\
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
372 HEAD subdir1/deps/project1
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
373 HEAD subdir1/deps/project2
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
374 """),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
375 # 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
376 ('subdir1/a', None, None),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
377 ]
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
378 self.svnco('externals/project1', '2', 'subdir1/deps/project1')
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
379 self.svnco('externals/project2', '2', 'subdir1/deps/project2')
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
380 self.commitchanges(changes)
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
381 self.pushrevisions(stupid)
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
382 self.assertchanges(changes, self.repo['tip'])
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
383 # 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
384 self.assertTrue('subdir2/a' in self.repo['tip'])
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
385 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
386
785
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
387 # 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
388 # 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
389 changes = [
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
390 ('.hgsub', '.hgsub', """\
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
391 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
392 """),
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
393 ('.hgsubstate', '.hgsubstate', """\
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
394 HEAD subdir1/deps/project1
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
395 """),
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
396 ]
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
397 self.commitchanges(changes)
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
398 self.pushrevisions(stupid)
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
399 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
400
764
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
401 # Test externals removal
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
402 changes = [
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
403 ('.hgsub', None, None),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
404 ('.hgsubstate', None, None),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
405 ]
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
406 self.commitchanges(changes)
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
407 self.pushrevisions(stupid)
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
408 self.assertchanges(changes, self.repo['tip'])
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
409
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
410 def suite():
833
312b37bc5e20 tests: avoid shadowing Python builtin all()
Yonggang Luo <luoyonggang@gmail.com>
parents: 832
diff changeset
411 all_tests = [unittest.TestLoader().loadTestsFromTestCase(TestFetchExternals),
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
412 unittest.TestLoader().loadTestsFromTestCase(TestPushExternals),
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
413 ]
833
312b37bc5e20 tests: avoid shadowing Python builtin all()
Yonggang Luo <luoyonggang@gmail.com>
parents: 832
diff changeset
414 return unittest.TestSuite(all_tests)