annotate tests/test_externals.py @ 660:67b54cb38843

__init__: activate & advertise the new help topic.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Wed, 11 Aug 2010 19:57:34 +0200
parents d2ef7220a079
children 979148947967
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
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
3 import os, unittest
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
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
6
337
46e69be8e2c8 Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents: 315
diff changeset
7 from hgsubversion import svnexternals
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
8
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
9 class TestFetchExternals(test_util.TestBase):
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
10 def test_externalsfile(self):
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
11 f = svnexternals.externalsfile()
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
12 f['t1'] = 'dir1 -r10 svn://foobar'
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
13 f['t 2'] = 'dir2 -r10 svn://foobar'
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
14 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
15
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
16 refext = """[t 2]
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
17 dir2 -r10 svn://foobar
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
18 [t1]
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
19 dir1 -r10 svn://foobar
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
20 [t3]
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
21 dir31 -r10 svn://foobar
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
22 dir32 -r10 svn://foobar
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
23 """
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
24 value = f.write()
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
25 self.assertEqual(refext, value)
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
26
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
27 f2 = svnexternals.externalsfile()
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
28 f2.read(value)
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
29 self.assertEqual(sorted(f), sorted(f2))
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
30 for t in f:
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
31 self.assertEqual(f[t], f2[t])
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
32
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
33 def test_parsedefinitions(self):
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
34 # Taken from svn book
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
35 samples = [
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
36 ('third-party/sounds http://svn.example.com/repos/sounds',
315
963d27a0b1c2 svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents: 291
diff changeset
37 ('third-party/sounds', None, 'http://svn.example.com/repos/sounds', None)),
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
38 ('third-party/skins -r148 http://svn.example.com/skinproj',
315
963d27a0b1c2 svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents: 291
diff changeset
39 ('third-party/skins', '148', 'http://svn.example.com/skinproj', None)),
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
40 ('third-party/skins -r 148 http://svn.example.com/skinproj',
315
963d27a0b1c2 svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents: 291
diff changeset
41 ('third-party/skins', '148', 'http://svn.example.com/skinproj', None)),
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
42 ('http://svn.example.com/repos/sounds third-party/sounds',
315
963d27a0b1c2 svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents: 291
diff changeset
43 ('third-party/sounds', None, 'http://svn.example.com/repos/sounds', None)),
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
44 ('-r148 http://svn.example.com/skinproj third-party/skins',
315
963d27a0b1c2 svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents: 291
diff changeset
45 ('third-party/skins', '148', 'http://svn.example.com/skinproj', None)),
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
46 ('-r 148 http://svn.example.com/skinproj third-party/skins',
315
963d27a0b1c2 svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents: 291
diff changeset
47 ('third-party/skins', '148', 'http://svn.example.com/skinproj', None)),
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
48 ('http://svn.example.com/skin-maker@21 third-party/skins/toolkit',
315
963d27a0b1c2 svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents: 291
diff changeset
49 ('third-party/skins/toolkit', None, 'http://svn.example.com/skin-maker', '21')),
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
50 ]
337
46e69be8e2c8 Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents: 315
diff changeset
51
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
52 for line, expected in samples:
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
53 self.assertEqual(expected, svnexternals.parsedefinition(line))
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
54
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
55 def test_externals(self, stupid=False):
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
56 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
57
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
58 ref0 = """[.]
183
1c46ad3f56aa test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents: 176
diff changeset
59 ^/externals/project1 deps/project1
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
60 """
218
a360ddc97719 branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents: 215
diff changeset
61 self.assertEqual(ref0, repo[0]['.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
62 ref1 = """[.]
183
1c46ad3f56aa test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents: 176
diff changeset
63 ^/externals/project1 deps/project1
315
963d27a0b1c2 svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents: 291
diff changeset
64 -r2 ^/externals/project2@2 deps/project2
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
65 """
218
a360ddc97719 branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents: 215
diff changeset
66 self.assertEqual(ref1, repo[1]['.hgsvnexternals'].data())
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
67
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
68 ref2 = """[.]
315
963d27a0b1c2 svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents: 291
diff changeset
69 -r2 ^/externals/project2@2 deps/project2
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
70 [subdir]
183
1c46ad3f56aa test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents: 176
diff changeset
71 ^/externals/project1 deps/project1
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
72 [subdir2]
183
1c46ad3f56aa test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents: 176
diff changeset
73 ^/externals/project1 deps/project1
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
74 """
218
a360ddc97719 branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents: 215
diff changeset
75 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
76 self.assertEqual(ref2, actual)
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
77
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
78 ref3 = """[.]
315
963d27a0b1c2 svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents: 291
diff changeset
79 -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
80 [subdir]
1c46ad3f56aa test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents: 176
diff changeset
81 ^/externals/project1 deps/project1
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
82 """
218
a360ddc97719 branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents: 215
diff changeset
83 self.assertEqual(ref3, repo[3]['.hgsvnexternals'].data())
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
84
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
85 ref4 = """[subdir]
183
1c46ad3f56aa test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents: 176
diff changeset
86 ^/externals/project1 deps/project1
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
87 """
218
a360ddc97719 branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents: 215
diff changeset
88 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
89
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
90 ref5 = """[.]
315
963d27a0b1c2 svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents: 291
diff changeset
91 -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
92 [subdir2]
d3ea6c98a086 Do not recurse for externals on copied directory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents: 183
diff changeset
93 ^/externals/project1 deps/project1
183
1c46ad3f56aa test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents: 176
diff changeset
94 """
218
a360ddc97719 branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents: 215
diff changeset
95 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
96
215
b5ef9a404f5d Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents: 195
diff changeset
97 ref6 = """[.]
315
963d27a0b1c2 svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents: 291
diff changeset
98 -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
99 """
218
a360ddc97719 branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents: 215
diff changeset
100 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
101
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
102 def test_externals_stupid(self):
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
103 self.test_externals(True)
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
104
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
105 def test_updateexternals(self):
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
106 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
107 svnexternals.updateexternals(ui, [rev], repo)
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
108 for d in deps:
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
109 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
110 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
111 'missing: %s@%r' % (d, rev))
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
112 for d in nodeps:
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
113 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
114 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
115 'unexpected: %s@%r' % (d, rev))
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
116
576
d96aa92d9ad9 tests: silence test suite by using quiet UIs everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 337
diff changeset
117 ui = self.ui()
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
118 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
119 commands.update(ui, repo)
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
120 checkdeps(['deps/project1'], [], repo, 0)
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
121 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
122 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
123 'deps/project2'],
291
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
124 ['deps/project1'], repo, 2)
337
46e69be8e2c8 Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents: 315
diff changeset
125 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
126 ['subdir2/deps/project1'], repo, 3)
ba8e91a7c077 Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents: 218
diff changeset
127 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
128
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
129 class TestPushExternals(test_util.TestBase):
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
130 def setUp(self):
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
131 test_util.TestBase.setUp(self)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
132 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
133 self.repo_path,
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
134 self.wc_path)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
135
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
136 def test_push_externals(self, stupid=False):
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
137 # 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
138 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
139 ('.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
140 """[dir]
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
141 ../externals/project2 deps/project2
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
142 [subdir1]
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
143 ../externals/project1 deps/project1
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
144 [subdir2]
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
145 ../externals/project2 deps/project2
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
146 """),
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
147 ('subdir1/a', 'subdir1/a', 'a'),
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
148 ('subdir2/a', 'subdir2/a', 'a'),
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
149 ]
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
150 self.commitchanges(changes)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
151 self.pushrevisions(stupid)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
152 self.assertchanges(changes, self.repo['tip'])
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
153
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
154 # 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
155 # to the other (test multiline entries)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
156 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
157 ('.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
158 """[subdir1]
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
159 ../externals/project1 deps/project1
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
160 ../externals/project2 deps/project2
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
161 """),
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
162 # 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
163 ('subdir1/a', None, None),
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
164 ]
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
165 self.commitchanges(changes)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
166 self.pushrevisions(stupid)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
167 self.assertchanges(changes, self.repo['tip'])
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
168 # 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
169 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
170 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
171
176
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
172 # Test externals removal
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
173 changes = [
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
174 ('.hgsvnexternals', None, None),
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
175 ]
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
176 self.commitchanges(changes)
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
177 self.pushrevisions(stupid)
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
178 self.assertchanges(changes, self.repo['tip'])
c4115b3918e9 Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents: 175
diff changeset
179
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
180 def test_push_externals_stupid(self):
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
181 self.test_push_externals(True)
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
182
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
183
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
184 def suite():
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
185 all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchExternals),
175
2412800b1258 Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents: 174
diff changeset
186 unittest.TestLoader().loadTestsFromTestCase(TestPushExternals),
174
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
187 ]
f80132c5fea5 Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
188 return unittest.TestSuite(all)