annotate tests/test_externals.py @ 1233:0d0132cba155

editor: fix edge case with in memory file-store size limit There are a few cases where we will set a single file into to the editor's FileStore object more than once. Notably, for copied and then modified files, we will set it at least twice. Three times if editing fails (which it can for symlinks). If we pass the in-memory storage limit in between the first (or second if editing fails) time we set the file and the last time we set the file, we will write the data to the in memory store the first time and the file store the last time. We didn't remove it form the in-memory store though, and we always prefer reading from the in-memory store. This means we can sometimes end up with the wrong version of a file. This is fairly unlikely to happen in normal use since you need to hit the memory limit between two writes to the store for the same file. We only write a file multiple times if a) the file (and not one of it's parent directories) is copied and then modified or b) editing fails. From what I can tell, it's only common for editing to fail for symlinks, and they ten to be relatively small data that is unlikely to push over the limit. Finally, the default limit is 100MB which I would expect to be most often either well over (source code) or well under (binaries or automated changes) the size of the changes files in a single commit. The easiest way to reproduce this is to set the in-memory cache size to 0 and then commit a copied and modified symlink. The empty-string version from the failed editing will be the one that persists. I happened to stumble upon this while trying (and failing) to test a bug-fix for a related bug with identical symptoms (empty simlink). I have seen this in the wild, once, but couldn't reproduce it at the time. The repo in question is quite large and quite active, so I am quite confident in my estimation that this is a real, but very rare, problem. The test changes attached to this was mneant to test a related bug, but turned out not to actually cover the bug in question. They did trigger this bug though, and are worthwhile to test, so I kept them.
author David Schleimer <dschleimer@fb.com>
date Mon, 07 Apr 2014 17:51:59 -0700
parents 7d82131e7801
children 258fb67fb956
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):
1060
7d82131e7801 test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
19 stupid_mode_tests = True
7d82131e7801 test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
20
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
21 def test_externalsfile(self):
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
22 f = svnexternals.externalsfile()
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
23 f['t1'] = 'dir1 -r10 svn://foobar'
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
24 f['t 2'] = 'dir2 -r10 svn://foobar'
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
25 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
26
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
27 refext = """[t 2]
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
28 dir2 -r10 svn://foobar
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
29 [t1]
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
30 dir1 -r10 svn://foobar
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
31 [t3]
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
32 dir31 -r10 svn://foobar
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
33 dir32 -r10 svn://foobar
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
34 """
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
35 value = f.write()
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
36 self.assertEqual(refext, value)
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
37
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
38 f2 = svnexternals.externalsfile()
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
39 f2.read(value)
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
40 self.assertEqual(sorted(f), sorted(f2))
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
41 for t in f:
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
42 self.assertEqual(f[t], f2[t])
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
43
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
44 def test_parsedefinitions(self):
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
45 # Taken from svn book
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
46 samples = [
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
47 ('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
48 ('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
49 '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
50
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
51 ('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
52 ('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
53 '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
54
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
55 ('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
56 ('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
57 '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
58
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
59 ('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
60 ('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
61 '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
62
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
63 ('-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
64 ('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
65 '-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
66
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
67 ('-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
68 ('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
69 '-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
70
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
71 ('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
72 ('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
73 '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
74 ]
337
46e69be8e2c8 Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents: 315
diff changeset
75
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
76 for line, expected in samples:
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
77 self.assertEqual(expected, svnexternals.parsedefinition(line))
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
78
1060
7d82131e7801 test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
79 def test_externals(self):
7d82131e7801 test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
80 repo = self._load_fixture_and_fetch('externals.svndump')
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
81
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
82 ref0 = """[.]
183
1c46ad3f56aa test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents: 176
diff changeset
83 ^/externals/project1 deps/project1
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
84 """
795
6f0b0a47938c test_externals: flag another case as using hgsub, use assertMultiLineEqual
Augie Fackler <durin42@gmail.com>
parents: 792
diff changeset
85 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
86 ref1 = """\
a5be5ca638de externals: ignore externals blank or comment lines
Patrick Mezard <pmezard@gmail.com>
parents: 785
diff changeset
87 [.]
a5be5ca638de externals: ignore externals blank or comment lines
Patrick Mezard <pmezard@gmail.com>
parents: 785
diff changeset
88 # 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
89
183
1c46ad3f56aa test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents: 176
diff changeset
90 ^/externals/project1 deps/project1
789
a5be5ca638de externals: ignore externals blank or comment lines
Patrick Mezard <pmezard@gmail.com>
parents: 785
diff changeset
91
315
963d27a0b1c2 svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents: 291
diff changeset
92 -r2 ^/externals/project2@2 deps/project2
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
93 """
795
6f0b0a47938c test_externals: flag another case as using hgsub, use assertMultiLineEqual
Augie Fackler <durin42@gmail.com>
parents: 792
diff changeset
94 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
95
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
96 ref2 = """[.]
315
963d27a0b1c2 svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents: 291
diff changeset
97 -r2 ^/externals/project2@2 deps/project2
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
98 [subdir]
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 [subdir2]
183
1c46ad3f56aa test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents: 176
diff changeset
101 ^/externals/project1 deps/project1
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
102 """
218
a360ddc97719 branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents: 215
diff changeset
103 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
104 self.assertEqual(ref2, actual)
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
105
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
106 ref3 = """[.]
315
963d27a0b1c2 svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents: 291
diff changeset
107 -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
108 [subdir]
1c46ad3f56aa test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents: 176
diff changeset
109 ^/externals/project1 deps/project1
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
110 """
218
a360ddc97719 branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents: 215
diff changeset
111 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
112
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
113 ref4 = """[subdir]
183
1c46ad3f56aa test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents: 176
diff changeset
114 ^/externals/project1 deps/project1
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
115 """
218
a360ddc97719 branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents: 215
diff changeset
116 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
117
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
118 ref5 = """[.]
315
963d27a0b1c2 svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents: 291
diff changeset
119 -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
120 [subdir2]
d3ea6c98a086 Do not recurse for externals on copied directory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 183
diff changeset
121 ^/externals/project1 deps/project1
183
1c46ad3f56aa test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents: 176
diff changeset
122 """
218
a360ddc97719 branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents: 215
diff changeset
123 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
124
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
125 ref6 = """[.]
315
963d27a0b1c2 svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents: 291
diff changeset
126 -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
127 """
218
a360ddc97719 branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents: 215
diff changeset
128 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
129
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
130 def test_updateexternals(self):
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
131 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
132 svnexternals.updateexternals(ui, [rev], repo)
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
133 for d in deps:
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
134 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
135 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
136 'missing: %s@%r' % (d, rev))
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
137 for d in nodeps:
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
138 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
139 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
140 'unexpected: %s@%r' % (d, rev))
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
141
576
d96aa92d9ad9 tests: silence test suite by using quiet UIs everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 337
diff changeset
142 ui = self.ui()
1060
7d82131e7801 test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
143 repo = self._load_fixture_and_fetch('externals.svndump')
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
144 commands.update(ui, repo)
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
145 checkdeps(['deps/project1'], [], repo, 0)
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
146 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
147 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
148 'deps/project2'],
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
149 ['deps/project1'], repo, 2)
337
46e69be8e2c8 Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents: 315
diff changeset
150 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
151 ['subdir2/deps/project1'], repo, 3)
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
152 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
153
1060
7d82131e7801 test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
154 def test_hgsub(self):
795
6f0b0a47938c test_externals: flag another case as using hgsub, use assertMultiLineEqual
Augie Fackler <durin42@gmail.com>
parents: 792
diff changeset
155 if subrepo is None:
6f0b0a47938c test_externals: flag another case as using hgsub, use assertMultiLineEqual
Augie Fackler <durin42@gmail.com>
parents: 792
diff changeset
156 return
762
c31a1f92e1c6 svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents: 761
diff changeset
157 repo = self._load_fixture_and_fetch('externals.svndump',
1060
7d82131e7801 test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
158 externals='subrepos')
762
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
795
6f0b0a47938c test_externals: flag another case as using hgsub, use assertMultiLineEqual
Augie Fackler <durin42@gmail.com>
parents: 792
diff changeset
186 self.assertMultiLineEqual("""\
762
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
776
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
218 def test_ignore(self):
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
219 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
220 externals='ignore')
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
221 for rev in repo:
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
222 ctx = repo[rev]
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
223 self.assertTrue('.hgsvnexternals' not in ctx)
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
224 self.assertTrue('.hgsub' not in ctx)
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
225 self.assertTrue('.hgsubstate' not in ctx)
f025d00bfc4a svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents: 764
diff changeset
226
763
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
227 def test_updatehgsub(self):
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
228 def checkdeps(ui, repo, rev, deps, nodeps):
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
229 commands.update(ui, repo, node=str(rev))
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
230 for d in deps:
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
231 p = os.path.join(repo.root, d)
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
232 self.assertTrue(os.path.isdir(p),
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
233 'missing: %s@%r' % (d, repo[None].rev()))
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
234 for d in nodeps:
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
235 p = os.path.join(repo.root, d)
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
236 self.assertTrue(not os.path.isdir(p),
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
237 'unexpected: %s@%r' % (d, repo[None].rev()))
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
238
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
239 if subrepo is None:
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
240 return
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 ui = self.ui()
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
243 repo = self._load_fixture_and_fetch('externals.svndump',
1060
7d82131e7801 test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
244 externals='subrepos')
763
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
245 checkdeps(ui, repo, 0, ['deps/project1'], [])
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
246 checkdeps(ui, repo, 1, ['deps/project1', 'deps/project2'], [])
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
247 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
248 'deps/project2'],
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
249 ['deps/project1'])
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
250 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
251 ['subdir2/deps/project1'])
6463b34bbcb6 svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents: 762
diff changeset
252 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
253
784
f214fb3f92cd svnexternals: handle new overwrite argument of subrepo.get()
Patrick Mezard <pmezard@gmail.com>
parents: 776
diff changeset
254 # Test update --clean, used to crash
f214fb3f92cd svnexternals: handle new overwrite argument of subrepo.get()
Patrick Mezard <pmezard@gmail.com>
parents: 776
diff changeset
255 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
256 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
257
1060
7d82131e7801 test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
258 def test_mergeexternals(self):
795
6f0b0a47938c test_externals: flag another case as using hgsub, use assertMultiLineEqual
Augie Fackler <durin42@gmail.com>
parents: 792
diff changeset
259 if subrepo is None:
6f0b0a47938c test_externals: flag another case as using hgsub, use assertMultiLineEqual
Augie Fackler <durin42@gmail.com>
parents: 792
diff changeset
260 return
792
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
261 repo = self._load_fixture_and_fetch('mergeexternals.svndump',
1060
7d82131e7801 test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
262 externals='subrepos')
792
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
263 # Check merged directories externals are fine
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
264 self.assertEqual("""\
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
265 d1/ext = [hgsubversion] d1:^/trunk/common/ext ext
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
266 d2/ext = [hgsubversion] d2:^/trunk/common/ext ext
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
267 d3/ext3 = [hgsubversion] d3:^/trunk/common/ext ext3
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
268 """, repo['tip']['.hgsub'].data())
ba65c0b01d4f replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents: 789
diff changeset
269
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
270 class TestPushExternals(test_util.TestBase):
1060
7d82131e7801 test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
271 stupid_mode_tests = True
1055
2d7398fffd0d push: obsolete rather than rebase & strip when enabled
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents: 1044
diff changeset
272 obsolete_mode_tests = True
2d7398fffd0d push: obsolete rather than rebase & strip when enabled
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents: 1044
diff changeset
273
1060
7d82131e7801 test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
274 def test_push_externals(self):
865
04729f3a3d17 test_util: merge load_fixture_and_fetch() into TestBase method
Patrick Mezard <patrick@mezard.eu>
parents: 833
diff changeset
275 repo = self._load_fixture_and_fetch('pushexternals.svndump')
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
276 # 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
277 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
278 ('.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
279 """[dir]
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
280 ../externals/project2 deps/project2
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
281 [subdir1]
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
282 ../externals/project1 deps/project1
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
283 [subdir2]
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 """),
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
286 ('subdir1/a', 'subdir1/a', 'a'),
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
287 ('subdir2/a', 'subdir2/a', 'a'),
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
288 ]
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
289 self.commitchanges(changes)
1060
7d82131e7801 test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
290 self.pushrevisions()
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
291 self.assertchanges(changes, self.repo['tip'])
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 # 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
294 # to the other (test multiline entries)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
295 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
296 ('.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
297 """[subdir1]
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
298 ../externals/project1 deps/project1
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
299 ../externals/project2 deps/project2
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 # 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
302 ('subdir1/a', None, None),
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
303 ]
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
304 self.commitchanges(changes)
1060
7d82131e7801 test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
305 self.pushrevisions()
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
306 self.assertchanges(changes, self.repo['tip'])
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
307 # 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
308 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
309 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
310
176
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
311 # Test externals removal
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
312 changes = [
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
313 ('.hgsvnexternals', None, None),
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
314 ]
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
315 self.commitchanges(changes)
1060
7d82131e7801 test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
316 self.pushrevisions()
176
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
317 self.assertchanges(changes, self.repo['tip'])
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
318
1060
7d82131e7801 test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
319 def test_push_hgsub(self):
764
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
320 if subrepo is None:
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
321 return
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
322
869
db3a651494f9 test_util: pass repo_path to svnls(), turn it into a function
Patrick Mezard <patrick@mezard.eu>
parents: 865
diff changeset
323 repo, repo_path = self.load_and_fetch('pushexternals.svndump',
db3a651494f9 test_util: pass repo_path to svnls(), turn it into a function
Patrick Mezard <patrick@mezard.eu>
parents: 865
diff changeset
324 externals='subrepos')
764
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
325 # 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
326 changes = [
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
327 ('.hgsub', '.hgsub', """\
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
328 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
329 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
330 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
331 """),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
332 ('.hgsubstate', '.hgsubstate', """\
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
333 HEAD dir/deps/project2
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
334 HEAD subdir1/deps/project1
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
335 HEAD subdir2/deps/project2
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
336 """),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
337 ('subdir1/a', 'subdir1/a', 'a'),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
338 ('subdir2/a', 'subdir2/a', 'a'),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
339 ]
870
1eb2a4428c42 test_util: pass repo_path to svnco() explicitely
Patrick Mezard <patrick@mezard.eu>
parents: 869
diff changeset
340 self.svnco(repo_path, 'externals/project2', '2', 'dir/deps/project2')
1eb2a4428c42 test_util: pass repo_path to svnco() explicitely
Patrick Mezard <patrick@mezard.eu>
parents: 869
diff changeset
341 self.svnco(repo_path, 'externals/project1', '2', 'subdir1/deps/project1')
1eb2a4428c42 test_util: pass repo_path to svnco() explicitely
Patrick Mezard <patrick@mezard.eu>
parents: 869
diff changeset
342 self.svnco(repo_path, 'externals/project2', '2', 'subdir2/deps/project2')
764
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
343 self.commitchanges(changes)
1060
7d82131e7801 test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
344 self.pushrevisions()
764
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
345 self.assertchanges(changes, self.repo['tip'])
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
346
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
347 # 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
348 self.assertEqual(['dir', 'subdir1', 'subdir1/a', 'subdir2',
869
db3a651494f9 test_util: pass repo_path to svnls(), turn it into a function
Patrick Mezard <patrick@mezard.eu>
parents: 865
diff changeset
349 'subdir2/a'], test_util.svnls(repo_path, 'trunk'))
764
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
350
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
351 # 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
352 # to the other (test multiline entries)
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
353 changes = [
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
354 ('.hgsub', '.hgsub', """\
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
355 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
356 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
357 """),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
358 ('.hgsubstate', '.hgsubstate', """\
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
359 HEAD subdir1/deps/project1
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
360 HEAD subdir1/deps/project2
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
361 """),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
362 # 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
363 ('subdir1/a', None, None),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
364 ]
870
1eb2a4428c42 test_util: pass repo_path to svnco() explicitely
Patrick Mezard <patrick@mezard.eu>
parents: 869
diff changeset
365 self.svnco(repo_path, 'externals/project1', '2', 'subdir1/deps/project1')
1eb2a4428c42 test_util: pass repo_path to svnco() explicitely
Patrick Mezard <patrick@mezard.eu>
parents: 869
diff changeset
366 self.svnco(repo_path, 'externals/project2', '2', 'subdir1/deps/project2')
764
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
367 self.commitchanges(changes)
1060
7d82131e7801 test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
368 self.pushrevisions()
764
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
369 self.assertchanges(changes, self.repo['tip'])
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
370 # 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
371 self.assertTrue('subdir2/a' in self.repo['tip'])
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
372 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
373
785
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
374 # 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
375 # 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
376 changes = [
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
377 ('.hgsub', '.hgsub', """\
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
378 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
379 """),
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
380 ('.hgsubstate', '.hgsubstate', """\
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
381 HEAD subdir1/deps/project1
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
382 """),
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
383 ]
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
384 self.commitchanges(changes)
1060
7d82131e7801 test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
385 self.pushrevisions()
785
40ddf8213fa2 pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents: 784
diff changeset
386 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
387
764
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
388 # Test externals removal
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
389 changes = [
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
390 ('.hgsub', None, None),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
391 ('.hgsubstate', None, None),
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
392 ]
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
393 self.commitchanges(changes)
1060
7d82131e7801 test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
394 self.pushrevisions()
764
bc5c176b63eb svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents: 763
diff changeset
395 self.assertchanges(changes, self.repo['tip'])