Mercurial > hgsubversion
annotate tests/test_externals.py @ 1585:d6b75cf2c27d
util: add _relativeuipath attribute to PrefixMatch
Recently matchers in core introduced a _relativeuipath attribute and started
using it. We need to add that to PrefixMatch too. This change is no-op on older
versions of mercurial.
author | Pulkit Goyal <pulkit@yandex-team.ru> |
---|---|
date | Wed, 24 Oct 2018 15:22:59 +0300 |
parents | 258fb67fb956 |
children |
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 |
1554
258fb67fb956
externals: correctly enable hgsubversion externals support during tests
Augie Fackler <raf@durin42.com>
parents:
1060
diff
changeset
|
21 def setUp(self): |
258fb67fb956
externals: correctly enable hgsubversion externals support during tests
Augie Fackler <raf@durin42.com>
parents:
1060
diff
changeset
|
22 test_util.TestBase.setUp(self) |
258fb67fb956
externals: correctly enable hgsubversion externals support during tests
Augie Fackler <raf@durin42.com>
parents:
1060
diff
changeset
|
23 with open(self.hgrc, 'a') as rc: |
258fb67fb956
externals: correctly enable hgsubversion externals support during tests
Augie Fackler <raf@durin42.com>
parents:
1060
diff
changeset
|
24 rc.write('\n[subrepos]\nhgsubversion:allowed = true\n') |
258fb67fb956
externals: correctly enable hgsubversion externals support during tests
Augie Fackler <raf@durin42.com>
parents:
1060
diff
changeset
|
25 |
258fb67fb956
externals: correctly enable hgsubversion externals support during tests
Augie Fackler <raf@durin42.com>
parents:
1060
diff
changeset
|
26 def ui(self, *args, **kwargs): |
258fb67fb956
externals: correctly enable hgsubversion externals support during tests
Augie Fackler <raf@durin42.com>
parents:
1060
diff
changeset
|
27 kwargs['subrepo'] = True |
258fb67fb956
externals: correctly enable hgsubversion externals support during tests
Augie Fackler <raf@durin42.com>
parents:
1060
diff
changeset
|
28 return test_util.TestBase.ui(self, *args, **kwargs) |
258fb67fb956
externals: correctly enable hgsubversion externals support during tests
Augie Fackler <raf@durin42.com>
parents:
1060
diff
changeset
|
29 |
174
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
30 def test_externalsfile(self): |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
31 f = svnexternals.externalsfile() |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
32 f['t1'] = 'dir1 -r10 svn://foobar' |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
33 f['t 2'] = 'dir2 -r10 svn://foobar' |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
34 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
|
35 |
b5ef9a404f5d
Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents:
195
diff
changeset
|
36 refext = """[t 2] |
174
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
37 dir2 -r10 svn://foobar |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
38 [t1] |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
39 dir1 -r10 svn://foobar |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
40 [t3] |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
41 dir31 -r10 svn://foobar |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
42 dir32 -r10 svn://foobar |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
43 """ |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
44 value = f.write() |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
45 self.assertEqual(refext, value) |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
46 |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
47 f2 = svnexternals.externalsfile() |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
48 f2.read(value) |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
49 self.assertEqual(sorted(f), sorted(f2)) |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
50 for t in f: |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
51 self.assertEqual(f[t], f2[t]) |
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
52 |
291
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
53 def test_parsedefinitions(self): |
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
54 # Taken from svn book |
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
55 samples = [ |
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
56 ('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
|
57 ('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
|
58 '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
|
59 |
291
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
60 ('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
|
61 ('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
|
62 '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
|
63 |
291
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
64 ('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
|
65 ('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
|
66 '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
|
67 |
291
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
68 ('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
|
69 ('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
|
70 '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
|
71 |
291
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
72 ('-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
|
73 ('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
|
74 '-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
|
75 |
291
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
76 ('-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
|
77 ('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
|
78 '-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
|
79 |
291
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
80 ('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
|
81 ('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
|
82 '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
|
83 ] |
337
46e69be8e2c8
Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents:
315
diff
changeset
|
84 |
291
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
85 for line, expected in samples: |
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
86 self.assertEqual(expected, svnexternals.parsedefinition(line)) |
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
87 |
1060
7d82131e7801
test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1055
diff
changeset
|
88 def test_externals(self): |
7d82131e7801
test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1055
diff
changeset
|
89 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
|
90 |
215
b5ef9a404f5d
Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents:
195
diff
changeset
|
91 ref0 = """[.] |
183
1c46ad3f56aa
test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents:
176
diff
changeset
|
92 ^/externals/project1 deps/project1 |
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(ref0, repo[0]['.hgsvnexternals'].data()) |
789
a5be5ca638de
externals: ignore externals blank or comment lines
Patrick Mezard <pmezard@gmail.com>
parents:
785
diff
changeset
|
95 ref1 = """\ |
a5be5ca638de
externals: ignore externals blank or comment lines
Patrick Mezard <pmezard@gmail.com>
parents:
785
diff
changeset
|
96 [.] |
a5be5ca638de
externals: ignore externals blank or comment lines
Patrick Mezard <pmezard@gmail.com>
parents:
785
diff
changeset
|
97 # 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
|
98 |
183
1c46ad3f56aa
test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents:
176
diff
changeset
|
99 ^/externals/project1 deps/project1 |
789
a5be5ca638de
externals: ignore externals blank or comment lines
Patrick Mezard <pmezard@gmail.com>
parents:
785
diff
changeset
|
100 |
315
963d27a0b1c2
svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents:
291
diff
changeset
|
101 -r2 ^/externals/project2@2 deps/project2 |
174
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
102 """ |
795
6f0b0a47938c
test_externals: flag another case as using hgsub, use assertMultiLineEqual
Augie Fackler <durin42@gmail.com>
parents:
792
diff
changeset
|
103 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
|
104 |
215
b5ef9a404f5d
Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents:
195
diff
changeset
|
105 ref2 = """[.] |
315
963d27a0b1c2
svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents:
291
diff
changeset
|
106 -r2 ^/externals/project2@2 deps/project2 |
174
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
107 [subdir] |
183
1c46ad3f56aa
test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents:
176
diff
changeset
|
108 ^/externals/project1 deps/project1 |
174
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
109 [subdir2] |
183
1c46ad3f56aa
test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents:
176
diff
changeset
|
110 ^/externals/project1 deps/project1 |
174
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
111 """ |
218
a360ddc97719
branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents:
215
diff
changeset
|
112 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
|
113 self.assertEqual(ref2, actual) |
174
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
114 |
215
b5ef9a404f5d
Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents:
195
diff
changeset
|
115 ref3 = """[.] |
315
963d27a0b1c2
svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents:
291
diff
changeset
|
116 -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
|
117 [subdir] |
1c46ad3f56aa
test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents:
176
diff
changeset
|
118 ^/externals/project1 deps/project1 |
174
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
119 """ |
218
a360ddc97719
branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents:
215
diff
changeset
|
120 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
|
121 |
215
b5ef9a404f5d
Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents:
195
diff
changeset
|
122 ref4 = """[subdir] |
183
1c46ad3f56aa
test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents:
176
diff
changeset
|
123 ^/externals/project1 deps/project1 |
174
f80132c5fea5
Convert svn:externals properties into a .hgsvnexternals file
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
124 """ |
218
a360ddc97719
branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents:
215
diff
changeset
|
125 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
|
126 |
215
b5ef9a404f5d
Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents:
195
diff
changeset
|
127 ref5 = """[.] |
315
963d27a0b1c2
svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents:
291
diff
changeset
|
128 -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
|
129 [subdir2] |
d3ea6c98a086
Do not recurse for externals on copied directory in stupid mode
Patrick Mezard <pmezard@gmail.com>
parents:
183
diff
changeset
|
130 ^/externals/project1 deps/project1 |
183
1c46ad3f56aa
test_externals: test branch copy, use absolute externals
Patrick Mezard <pmezard@gmail.com>
parents:
176
diff
changeset
|
131 """ |
218
a360ddc97719
branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents:
215
diff
changeset
|
132 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
|
133 |
215
b5ef9a404f5d
Stopped idiotic filtering of revisions that did not edit something branches/tags/trunk.
Augie Fackler <durin42@gmail.com>
parents:
195
diff
changeset
|
134 ref6 = """[.] |
315
963d27a0b1c2
svnexternals: do not use peg revisions as --rev replacements
Patrick Mezard <pmezard@gmail.com>
parents:
291
diff
changeset
|
135 -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
|
136 """ |
218
a360ddc97719
branches: change handling again, but this time a little less magic.
Augie Fackler <durin42@gmail.com>
parents:
215
diff
changeset
|
137 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
|
138 |
291
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
139 def test_updateexternals(self): |
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
140 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
|
141 svnexternals.updateexternals(ui, [rev], repo) |
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
142 for d in deps: |
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
143 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
|
144 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
|
145 'missing: %s@%r' % (d, rev)) |
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
146 for d in nodeps: |
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
147 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
|
148 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
|
149 'unexpected: %s@%r' % (d, rev)) |
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
150 |
1554
258fb67fb956
externals: correctly enable hgsubversion externals support during tests
Augie Fackler <raf@durin42.com>
parents:
1060
diff
changeset
|
151 ui = self.ui(subrepo=True) |
1060
7d82131e7801
test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1055
diff
changeset
|
152 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
|
153 commands.update(ui, repo) |
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
154 checkdeps(['deps/project1'], [], repo, 0) |
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
155 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
|
156 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
|
157 'deps/project2'], |
291
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
158 ['deps/project1'], repo, 2) |
337
46e69be8e2c8
Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents:
315
diff
changeset
|
159 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
|
160 ['subdir2/deps/project1'], repo, 3) |
ba8e91a7c077
Add 'updateexternals' to synchronize externals with remote repo.
Patrick Mezard <pmezard@gmail.com>
parents:
218
diff
changeset
|
161 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
|
162 |
1060
7d82131e7801
test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1055
diff
changeset
|
163 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
|
164 if subrepo is None: |
6f0b0a47938c
test_externals: flag another case as using hgsub, use assertMultiLineEqual
Augie Fackler <durin42@gmail.com>
parents:
792
diff
changeset
|
165 return |
762
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
166 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
|
167 externals='subrepos') |
762
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
168 self.assertEqual("""\ |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
169 deps/project1 = [hgsubversion] :^/externals/project1 deps/project1 |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
170 """, repo[0]['.hgsub'].data()) |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
171 self.assertEqual("""\ |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
172 HEAD deps/project1 |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
173 """, repo[0]['.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/project1 = [hgsubversion] :^/externals/project1 deps/project1 |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
177 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
|
178 """, repo[1]['.hgsub'].data()) |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
179 self.assertEqual("""\ |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
180 HEAD deps/project1 |
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 """, repo[1]['.hgsubstate'].data()) |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
183 |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
184 self.assertEqual("""\ |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
185 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
|
186 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
|
187 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
|
188 """, repo[2]['.hgsub'].data()) |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
189 self.assertEqual("""\ |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
190 2 deps/project2 |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
191 HEAD subdir/deps/project1 |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
192 HEAD subdir2/deps/project1 |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
193 """, repo[2]['.hgsubstate'].data()) |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
194 |
795
6f0b0a47938c
test_externals: flag another case as using hgsub, use assertMultiLineEqual
Augie Fackler <durin42@gmail.com>
parents:
792
diff
changeset
|
195 self.assertMultiLineEqual("""\ |
762
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
196 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
|
197 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
|
198 """, repo[3]['.hgsub'].data()) |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
199 self.assertEqual("""\ |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
200 2 deps/project2 |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
201 HEAD subdir/deps/project1 |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
202 """, repo[3]['.hgsubstate'].data()) |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
203 |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
204 self.assertEqual("""\ |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
205 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
|
206 """, repo[4]['.hgsub'].data()) |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
207 self.assertEqual("""\ |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
208 HEAD subdir/deps/project1 |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
209 """, repo[4]['.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 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
|
214 """, repo[5]['.hgsub'].data()) |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
215 self.assertEqual("""\ |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
216 2 deps/project2 |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
217 HEAD subdir2/deps/project1 |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
218 """, repo[5]['.hgsubstate'].data()) |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
219 |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
220 self.assertEqual("""\ |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
221 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
|
222 """, repo[6]['.hgsub'].data()) |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
223 self.assertEqual("""\ |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
224 2 deps/project2 |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
225 """, repo[6]['.hgsubstate'].data()) |
c31a1f92e1c6
svnexternals: preliminary support for subrepos based externals
Patrick Mezard <pmezard@gmail.com>
parents:
761
diff
changeset
|
226 |
776
f025d00bfc4a
svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents:
764
diff
changeset
|
227 def test_ignore(self): |
f025d00bfc4a
svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents:
764
diff
changeset
|
228 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
|
229 externals='ignore') |
f025d00bfc4a
svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents:
764
diff
changeset
|
230 for rev in repo: |
f025d00bfc4a
svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents:
764
diff
changeset
|
231 ctx = repo[rev] |
f025d00bfc4a
svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents:
764
diff
changeset
|
232 self.assertTrue('.hgsvnexternals' not in ctx) |
f025d00bfc4a
svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents:
764
diff
changeset
|
233 self.assertTrue('.hgsub' not in ctx) |
f025d00bfc4a
svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents:
764
diff
changeset
|
234 self.assertTrue('.hgsubstate' not in ctx) |
f025d00bfc4a
svnexternals: add 'ignore' mode to avoid converting externals
Patrick Mezard <pmezard@gmail.com>
parents:
764
diff
changeset
|
235 |
763
6463b34bbcb6
svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents:
762
diff
changeset
|
236 def test_updatehgsub(self): |
6463b34bbcb6
svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents:
762
diff
changeset
|
237 def checkdeps(ui, repo, rev, deps, nodeps): |
6463b34bbcb6
svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents:
762
diff
changeset
|
238 commands.update(ui, repo, node=str(rev)) |
6463b34bbcb6
svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents:
762
diff
changeset
|
239 for d in deps: |
6463b34bbcb6
svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents:
762
diff
changeset
|
240 p = os.path.join(repo.root, d) |
6463b34bbcb6
svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents:
762
diff
changeset
|
241 self.assertTrue(os.path.isdir(p), |
6463b34bbcb6
svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents:
762
diff
changeset
|
242 'missing: %s@%r' % (d, repo[None].rev())) |
6463b34bbcb6
svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents:
762
diff
changeset
|
243 for d in nodeps: |
6463b34bbcb6
svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents:
762
diff
changeset
|
244 p = os.path.join(repo.root, d) |
6463b34bbcb6
svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents:
762
diff
changeset
|
245 self.assertTrue(not os.path.isdir(p), |
6463b34bbcb6
svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents:
762
diff
changeset
|
246 'unexpected: %s@%r' % (d, repo[None].rev())) |
6463b34bbcb6
svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents:
762
diff
changeset
|
247 |
6463b34bbcb6
svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents:
762
diff
changeset
|
248 if subrepo is None: |
6463b34bbcb6
svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents:
762
diff
changeset
|
249 return |
6463b34bbcb6
svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents:
762
diff
changeset
|
250 |
1554
258fb67fb956
externals: correctly enable hgsubversion externals support during tests
Augie Fackler <raf@durin42.com>
parents:
1060
diff
changeset
|
251 ui = self.ui(subrepo=True) |
763
6463b34bbcb6
svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents:
762
diff
changeset
|
252 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
|
253 externals='subrepos') |
763
6463b34bbcb6
svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents:
762
diff
changeset
|
254 checkdeps(ui, repo, 0, ['deps/project1'], []) |
6463b34bbcb6
svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents:
762
diff
changeset
|
255 checkdeps(ui, repo, 1, ['deps/project1', 'deps/project2'], []) |
6463b34bbcb6
svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents:
762
diff
changeset
|
256 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
|
257 'deps/project2'], |
6463b34bbcb6
svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents:
762
diff
changeset
|
258 ['deps/project1']) |
6463b34bbcb6
svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents:
762
diff
changeset
|
259 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
|
260 ['subdir2/deps/project1']) |
6463b34bbcb6
svnexternals: support subrepos based externals checkout
Patrick Mezard <pmezard@gmail.com>
parents:
762
diff
changeset
|
261 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
|
262 |
784
f214fb3f92cd
svnexternals: handle new overwrite argument of subrepo.get()
Patrick Mezard <pmezard@gmail.com>
parents:
776
diff
changeset
|
263 # Test update --clean, used to crash |
f214fb3f92cd
svnexternals: handle new overwrite argument of subrepo.get()
Patrick Mezard <pmezard@gmail.com>
parents:
776
diff
changeset
|
264 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
|
265 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
|
266 |
1060
7d82131e7801
test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1055
diff
changeset
|
267 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
|
268 if subrepo is None: |
6f0b0a47938c
test_externals: flag another case as using hgsub, use assertMultiLineEqual
Augie Fackler <durin42@gmail.com>
parents:
792
diff
changeset
|
269 return |
792
ba65c0b01d4f
replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents:
789
diff
changeset
|
270 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
|
271 externals='subrepos') |
792
ba65c0b01d4f
replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents:
789
diff
changeset
|
272 # Check merged directories externals are fine |
ba65c0b01d4f
replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents:
789
diff
changeset
|
273 self.assertEqual("""\ |
ba65c0b01d4f
replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents:
789
diff
changeset
|
274 d1/ext = [hgsubversion] d1:^/trunk/common/ext ext |
ba65c0b01d4f
replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents:
789
diff
changeset
|
275 d2/ext = [hgsubversion] d2:^/trunk/common/ext ext |
ba65c0b01d4f
replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents:
789
diff
changeset
|
276 d3/ext3 = [hgsubversion] d3:^/trunk/common/ext ext3 |
ba65c0b01d4f
replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents:
789
diff
changeset
|
277 """, repo['tip']['.hgsub'].data()) |
ba65c0b01d4f
replay: copy copied directories externals
Patrick Mezard <pmezard@gmail.com>
parents:
789
diff
changeset
|
278 |
175
2412800b1258
Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
279 class TestPushExternals(test_util.TestBase): |
1060
7d82131e7801
test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1055
diff
changeset
|
280 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
|
281 obsolete_mode_tests = True |
2d7398fffd0d
push: obsolete rather than rebase & strip when enabled
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents:
1044
diff
changeset
|
282 |
1554
258fb67fb956
externals: correctly enable hgsubversion externals support during tests
Augie Fackler <raf@durin42.com>
parents:
1060
diff
changeset
|
283 def setUp(self): |
258fb67fb956
externals: correctly enable hgsubversion externals support during tests
Augie Fackler <raf@durin42.com>
parents:
1060
diff
changeset
|
284 test_util.TestBase.setUp(self) |
258fb67fb956
externals: correctly enable hgsubversion externals support during tests
Augie Fackler <raf@durin42.com>
parents:
1060
diff
changeset
|
285 with open(self.hgrc, 'a') as rc: |
258fb67fb956
externals: correctly enable hgsubversion externals support during tests
Augie Fackler <raf@durin42.com>
parents:
1060
diff
changeset
|
286 rc.write('\n[subrepos]\nhgsubversion:allowed = true\n') |
258fb67fb956
externals: correctly enable hgsubversion externals support during tests
Augie Fackler <raf@durin42.com>
parents:
1060
diff
changeset
|
287 |
258fb67fb956
externals: correctly enable hgsubversion externals support during tests
Augie Fackler <raf@durin42.com>
parents:
1060
diff
changeset
|
288 def ui(self, *args, **kwargs): |
258fb67fb956
externals: correctly enable hgsubversion externals support during tests
Augie Fackler <raf@durin42.com>
parents:
1060
diff
changeset
|
289 kwargs['subrepo'] = True |
258fb67fb956
externals: correctly enable hgsubversion externals support during tests
Augie Fackler <raf@durin42.com>
parents:
1060
diff
changeset
|
290 return test_util.TestBase.ui(self, *args, **kwargs) |
258fb67fb956
externals: correctly enable hgsubversion externals support during tests
Augie Fackler <raf@durin42.com>
parents:
1060
diff
changeset
|
291 |
1060
7d82131e7801
test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1055
diff
changeset
|
292 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
|
293 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
|
294 # 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
|
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 """[dir] |
175
2412800b1258
Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
298 ../externals/project2 deps/project2 |
2412800b1258
Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
299 [subdir1] |
2412800b1258
Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
300 ../externals/project1 deps/project1 |
2412800b1258
Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
301 [subdir2] |
2412800b1258
Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
302 ../externals/project2 deps/project2 |
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 ('subdir1/a', 'subdir1/a', 'a'), |
2412800b1258
Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
305 ('subdir2/a', 'subdir2/a', 'a'), |
2412800b1258
Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
306 ] |
2412800b1258
Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
307 self.commitchanges(changes) |
1060
7d82131e7801
test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1055
diff
changeset
|
308 self.pushrevisions() |
175
2412800b1258
Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
309 self.assertchanges(changes, self.repo['tip']) |
2412800b1258
Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
310 |
2412800b1258
Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
311 # 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
|
312 # to the other (test multiline entries) |
2412800b1258
Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
313 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
|
314 ('.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
|
315 """[subdir1] |
175
2412800b1258
Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
316 ../externals/project1 deps/project1 |
2412800b1258
Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
317 ../externals/project2 deps/project2 |
2412800b1258
Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
318 """), |
2412800b1258
Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
319 # 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
|
320 ('subdir1/a', None, None), |
2412800b1258
Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
321 ] |
2412800b1258
Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
322 self.commitchanges(changes) |
1060
7d82131e7801
test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1055
diff
changeset
|
323 self.pushrevisions() |
175
2412800b1258
Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
324 self.assertchanges(changes, self.repo['tip']) |
2412800b1258
Support svn:externals changes via .hgsvnexternals updates
Patrick Mezard <pmezard@gmail.com>
parents:
174
diff
changeset
|
325 # 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
|
326 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
|
327 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
|
328 |
176
c4115b3918e9
Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents:
175
diff
changeset
|
329 # Test externals removal |
c4115b3918e9
Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents:
175
diff
changeset
|
330 changes = [ |
c4115b3918e9
Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents:
175
diff
changeset
|
331 ('.hgsvnexternals', None, None), |
c4115b3918e9
Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents:
175
diff
changeset
|
332 ] |
c4115b3918e9
Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents:
175
diff
changeset
|
333 self.commitchanges(changes) |
1060
7d82131e7801
test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1055
diff
changeset
|
334 self.pushrevisions() |
176
c4115b3918e9
Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents:
175
diff
changeset
|
335 self.assertchanges(changes, self.repo['tip']) |
c4115b3918e9
Really delete the .hgsvnexternals file when explicitely removed
Patrick Mezard <pmezard@gmail.com>
parents:
175
diff
changeset
|
336 |
1060
7d82131e7801
test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1055
diff
changeset
|
337 def test_push_hgsub(self): |
764
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
338 if subrepo is None: |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
339 return |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
340 |
869
db3a651494f9
test_util: pass repo_path to svnls(), turn it into a function
Patrick Mezard <patrick@mezard.eu>
parents:
865
diff
changeset
|
341 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
|
342 externals='subrepos') |
764
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
343 # 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
|
344 changes = [ |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
345 ('.hgsub', '.hgsub', """\ |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
346 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
|
347 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
|
348 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
|
349 """), |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
350 ('.hgsubstate', '.hgsubstate', """\ |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
351 HEAD dir/deps/project2 |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
352 HEAD subdir1/deps/project1 |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
353 HEAD subdir2/deps/project2 |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
354 """), |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
355 ('subdir1/a', 'subdir1/a', 'a'), |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
356 ('subdir2/a', 'subdir2/a', 'a'), |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
357 ] |
870
1eb2a4428c42
test_util: pass repo_path to svnco() explicitely
Patrick Mezard <patrick@mezard.eu>
parents:
869
diff
changeset
|
358 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
|
359 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
|
360 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
|
361 self.commitchanges(changes) |
1060
7d82131e7801
test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1055
diff
changeset
|
362 self.pushrevisions() |
764
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
363 self.assertchanges(changes, self.repo['tip']) |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
364 |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
365 # 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
|
366 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
|
367 '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
|
368 |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
369 # 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
|
370 # to the other (test multiline entries) |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
371 changes = [ |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
372 ('.hgsub', '.hgsub', """\ |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
373 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
|
374 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
|
375 """), |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
376 ('.hgsubstate', '.hgsubstate', """\ |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
377 HEAD subdir1/deps/project1 |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
378 HEAD subdir1/deps/project2 |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
379 """), |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
380 # 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
|
381 ('subdir1/a', None, None), |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
382 ] |
870
1eb2a4428c42
test_util: pass repo_path to svnco() explicitely
Patrick Mezard <patrick@mezard.eu>
parents:
869
diff
changeset
|
383 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
|
384 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
|
385 self.commitchanges(changes) |
1060
7d82131e7801
test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1055
diff
changeset
|
386 self.pushrevisions() |
764
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
387 self.assertchanges(changes, self.repo['tip']) |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
388 # 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
|
389 self.assertTrue('subdir2/a' in self.repo['tip']) |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
390 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
|
391 |
785
40ddf8213fa2
pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents:
784
diff
changeset
|
392 # 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
|
393 # 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
|
394 changes = [ |
40ddf8213fa2
pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents:
784
diff
changeset
|
395 ('.hgsub', '.hgsub', """\ |
40ddf8213fa2
pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents:
784
diff
changeset
|
396 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
|
397 """), |
40ddf8213fa2
pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents:
784
diff
changeset
|
398 ('.hgsubstate', '.hgsubstate', """\ |
40ddf8213fa2
pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents:
784
diff
changeset
|
399 HEAD subdir1/deps/project1 |
40ddf8213fa2
pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents:
784
diff
changeset
|
400 """), |
40ddf8213fa2
pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents:
784
diff
changeset
|
401 ] |
40ddf8213fa2
pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents:
784
diff
changeset
|
402 self.commitchanges(changes) |
1060
7d82131e7801
test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1055
diff
changeset
|
403 self.pushrevisions() |
785
40ddf8213fa2
pushmod: do not delete the whole branch when deleting .hgsub
Patrick Mezard <pmezard@gmail.com>
parents:
784
diff
changeset
|
404 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
|
405 |
764
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
406 # Test externals removal |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
407 changes = [ |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
408 ('.hgsub', None, None), |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
409 ('.hgsubstate', None, None), |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
410 ] |
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
411 self.commitchanges(changes) |
1060
7d82131e7801
test_externals: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1055
diff
changeset
|
412 self.pushrevisions() |
764
bc5c176b63eb
svnexternals: support pushing subrepo based externals
Patrick Mezard <pmezard@gmail.com>
parents:
763
diff
changeset
|
413 self.assertchanges(changes, self.repo['tip']) |