Mercurial > hgsubversion
annotate tests/test_fetch_branches.py @ 867:50c13e01c7e3
test_util: add a load_and_fetch() returning the repo_path
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Thu, 19 Apr 2012 18:29:28 +0200 |
parents | 20e73b5ab6f7 |
children | a80b01ceb1fc |
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:
588
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:
588
diff
changeset
|
2 |
117
3afe404042a3
Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
3 import unittest |
3afe404042a3
Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
4 |
284
f8f9a2993705
Implement parseurl support (#revision in repository urls)
Martijn Pieters <mj@zopatista.com>
parents:
278
diff
changeset
|
5 from mercurial import hg |
133
2242dd1163c6
hg_delta_editor: fix bad parent revision calculation in the case of a branch
Augie Fackler <durin42@gmail.com>
parents:
131
diff
changeset
|
6 from mercurial import node |
344
4dfab1b8b7be
Mention what failed when given a non-numeric revision to clone/pull.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
7 from mercurial import util as hgutil |
133
2242dd1163c6
hg_delta_editor: fix bad parent revision calculation in the case of a branch
Augie Fackler <durin42@gmail.com>
parents:
131
diff
changeset
|
8 |
117
3afe404042a3
Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
9 class TestFetchBranches(test_util.TestBase): |
284
f8f9a2993705
Implement parseurl support (#revision in repository urls)
Martijn Pieters <mj@zopatista.com>
parents:
278
diff
changeset
|
10 def _load_fixture_and_fetch_with_anchor(self, fixture_name, anchor): |
866
20e73b5ab6f7
test_util: merge load_svndump_fixture() into TestBase
Patrick Mezard <patrick@mezard.eu>
parents:
865
diff
changeset
|
11 repo_path = self.load_svndump(fixture_name) |
20e73b5ab6f7
test_util: merge load_svndump_fixture() into TestBase
Patrick Mezard <patrick@mezard.eu>
parents:
865
diff
changeset
|
12 source = '%s#%s' % (test_util.fileurl(repo_path), anchor) |
816
86d124a8768e
Fix hg.clone() calls changed by d976542986d2
Patrick Mezard <pmezard@gmail.com>
parents:
815
diff
changeset
|
13 test_util.hgclone(self.ui(), source, self.wc_path) |
576
d96aa92d9ad9
tests: silence test suite by using quiet UIs everywhere
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
551
diff
changeset
|
14 return hg.repository(self.ui(), self.wc_path) |
284
f8f9a2993705
Implement parseurl support (#revision in repository urls)
Martijn Pieters <mj@zopatista.com>
parents:
278
diff
changeset
|
15 |
815
e62e84a9464b
test_fetch_branches: stop comparing converted nodeids
Patrick Mezard <pmezard@gmail.com>
parents:
643
diff
changeset
|
16 def branches(self, repo): |
425
f5222d021665
tests: fix for new branch heads change in upstream hg.
Augie Fackler <durin42@gmail.com>
parents:
397
diff
changeset
|
17 hctxs = [repo[hn] for hn in repo.heads()] |
815
e62e84a9464b
test_fetch_branches: stop comparing converted nodeids
Patrick Mezard <pmezard@gmail.com>
parents:
643
diff
changeset
|
18 openbranches = set(ctx.branch() for ctx in hctxs if |
e62e84a9464b
test_fetch_branches: stop comparing converted nodeids
Patrick Mezard <pmezard@gmail.com>
parents:
643
diff
changeset
|
19 ctx.extra().get('close', None) != '1') |
e62e84a9464b
test_fetch_branches: stop comparing converted nodeids
Patrick Mezard <pmezard@gmail.com>
parents:
643
diff
changeset
|
20 closedbranches = set(ctx.branch() for ctx in hctxs if |
e62e84a9464b
test_fetch_branches: stop comparing converted nodeids
Patrick Mezard <pmezard@gmail.com>
parents:
643
diff
changeset
|
21 ctx.extra().get('close', None) == '1') |
e62e84a9464b
test_fetch_branches: stop comparing converted nodeids
Patrick Mezard <pmezard@gmail.com>
parents:
643
diff
changeset
|
22 return sorted(openbranches), sorted(closedbranches) |
e62e84a9464b
test_fetch_branches: stop comparing converted nodeids
Patrick Mezard <pmezard@gmail.com>
parents:
643
diff
changeset
|
23 |
e62e84a9464b
test_fetch_branches: stop comparing converted nodeids
Patrick Mezard <pmezard@gmail.com>
parents:
643
diff
changeset
|
24 def openbranches(self, repo): |
e62e84a9464b
test_fetch_branches: stop comparing converted nodeids
Patrick Mezard <pmezard@gmail.com>
parents:
643
diff
changeset
|
25 return self.branches(repo)[0] |
372
a62965b179c1
Test for open branches in the pull result.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
344
diff
changeset
|
26 |
551
d17cec76e769
replay: correctly handle renaming the parent dir of a branch
Augie Fackler <durin42@gmail.com>
parents:
473
diff
changeset
|
27 def test_rename_branch_parent(self, stupid=False): |
865
04729f3a3d17
test_util: merge load_fixture_and_fetch() into TestBase method
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
28 repo = self._load_fixture_and_fetch('rename_branch_parent_dir.svndump', |
04729f3a3d17
test_util: merge load_fixture_and_fetch() into TestBase method
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
29 stupid=stupid) |
551
d17cec76e769
replay: correctly handle renaming the parent dir of a branch
Augie Fackler <durin42@gmail.com>
parents:
473
diff
changeset
|
30 heads = [repo[n] for n in repo.heads()] |
d17cec76e769
replay: correctly handle renaming the parent dir of a branch
Augie Fackler <durin42@gmail.com>
parents:
473
diff
changeset
|
31 heads = dict([(ctx.branch(), ctx) for ctx in heads]) |
d17cec76e769
replay: correctly handle renaming the parent dir of a branch
Augie Fackler <durin42@gmail.com>
parents:
473
diff
changeset
|
32 # Let these tests disabled yet as the fix is not obvious |
d17cec76e769
replay: correctly handle renaming the parent dir of a branch
Augie Fackler <durin42@gmail.com>
parents:
473
diff
changeset
|
33 self.assertEqual(['dev_branch'], self.openbranches(repo)) |
d17cec76e769
replay: correctly handle renaming the parent dir of a branch
Augie Fackler <durin42@gmail.com>
parents:
473
diff
changeset
|
34 |
d17cec76e769
replay: correctly handle renaming the parent dir of a branch
Augie Fackler <durin42@gmail.com>
parents:
473
diff
changeset
|
35 def test_rename_branch_parent_stupid(self): |
d17cec76e769
replay: correctly handle renaming the parent dir of a branch
Augie Fackler <durin42@gmail.com>
parents:
473
diff
changeset
|
36 self.test_rename_branch_parent(stupid=True) |
d17cec76e769
replay: correctly handle renaming the parent dir of a branch
Augie Fackler <durin42@gmail.com>
parents:
473
diff
changeset
|
37 |
117
3afe404042a3
Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
38 def test_unrelatedbranch(self, stupid=False): |
865
04729f3a3d17
test_util: merge load_fixture_and_fetch() into TestBase method
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
39 repo = self._load_fixture_and_fetch('unrelatedbranch.svndump', |
04729f3a3d17
test_util: merge load_fixture_and_fetch() into TestBase method
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
40 stupid=stupid) |
117
3afe404042a3
Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
41 heads = [repo[n] for n in repo.heads()] |
3afe404042a3
Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
42 heads = dict([(ctx.branch(), ctx) for ctx in heads]) |
3afe404042a3
Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
43 # Let these tests disabled yet as the fix is not obvious |
120
f508c1fa19a5
hg_delta_editor: do not assume branches are copied from trunk by default
Patrick Mezard <pmezard@gmail.com>
parents:
117
diff
changeset
|
44 self.assertEqual(heads['branch1'].manifest().keys(), ['b']) |
f508c1fa19a5
hg_delta_editor: do not assume branches are copied from trunk by default
Patrick Mezard <pmezard@gmail.com>
parents:
117
diff
changeset
|
45 self.assertEqual(heads['branch2'].manifest().keys(), ['a', 'b']) |
117
3afe404042a3
Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
46 |
3afe404042a3
Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
47 def test_unrelatedbranch_stupid(self): |
3afe404042a3
Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
48 self.test_unrelatedbranch(True) |
3afe404042a3
Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
49 |
131
4d42dbbb5127
hg_delta_editor: fix parent revision detection on branch copy
Patrick Mezard <pmezard@gmail.com>
parents:
120
diff
changeset
|
50 def test_unorderedbranch(self, stupid=False): |
865
04729f3a3d17
test_util: merge load_fixture_and_fetch() into TestBase method
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
51 repo = self._load_fixture_and_fetch('unorderedbranch.svndump', |
04729f3a3d17
test_util: merge load_fixture_and_fetch() into TestBase method
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
52 stupid=stupid) |
131
4d42dbbb5127
hg_delta_editor: fix parent revision detection on branch copy
Patrick Mezard <pmezard@gmail.com>
parents:
120
diff
changeset
|
53 r = repo['branch'] |
4d42dbbb5127
hg_delta_editor: fix parent revision detection on branch copy
Patrick Mezard <pmezard@gmail.com>
parents:
120
diff
changeset
|
54 self.assertEqual(0, r.parents()[0].rev()) |
4d42dbbb5127
hg_delta_editor: fix parent revision detection on branch copy
Patrick Mezard <pmezard@gmail.com>
parents:
120
diff
changeset
|
55 self.assertEqual(['a', 'c', 'z'], sorted(r.manifest())) |
4d42dbbb5127
hg_delta_editor: fix parent revision detection on branch copy
Patrick Mezard <pmezard@gmail.com>
parents:
120
diff
changeset
|
56 |
4d42dbbb5127
hg_delta_editor: fix parent revision detection on branch copy
Patrick Mezard <pmezard@gmail.com>
parents:
120
diff
changeset
|
57 def test_unorderedbranch_stupid(self): |
4d42dbbb5127
hg_delta_editor: fix parent revision detection on branch copy
Patrick Mezard <pmezard@gmail.com>
parents:
120
diff
changeset
|
58 self.test_unorderedbranch(True) |
147
22162380c4b9
Improve branch closing in the case of a single-rev replacement of one branch
Augie Fackler <durin42@gmail.com>
parents:
133
diff
changeset
|
59 |
133
2242dd1163c6
hg_delta_editor: fix bad parent revision calculation in the case of a branch
Augie Fackler <durin42@gmail.com>
parents:
131
diff
changeset
|
60 def test_renamed_branch_to_trunk(self, stupid=False): |
147
22162380c4b9
Improve branch closing in the case of a single-rev replacement of one branch
Augie Fackler <durin42@gmail.com>
parents:
133
diff
changeset
|
61 repo = self._load_fixture_and_fetch('branch_rename_to_trunk.svndump', |
865
04729f3a3d17
test_util: merge load_fixture_and_fetch() into TestBase method
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
62 stupid=stupid) |
201
883976b654b6
Be more explicit about which branch I'm checking.
Augie Fackler <durin42@gmail.com>
parents:
158
diff
changeset
|
63 self.assertEqual(repo['default'].parents()[0].branch(), 'dev_branch') |
815
e62e84a9464b
test_fetch_branches: stop comparing converted nodeids
Patrick Mezard <pmezard@gmail.com>
parents:
643
diff
changeset
|
64 self.assert_('iota' in repo['default']) |
133
2242dd1163c6
hg_delta_editor: fix bad parent revision calculation in the case of a branch
Augie Fackler <durin42@gmail.com>
parents:
131
diff
changeset
|
65 self.assertEqual(repo['old_trunk'].parents()[0].branch(), 'default') |
815
e62e84a9464b
test_fetch_branches: stop comparing converted nodeids
Patrick Mezard <pmezard@gmail.com>
parents:
643
diff
changeset
|
66 self.assert_('iota' not in repo['old_trunk']) |
372
a62965b179c1
Test for open branches in the pull result.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
344
diff
changeset
|
67 expected = ['default', 'old_trunk'] |
a62965b179c1
Test for open branches in the pull result.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
344
diff
changeset
|
68 self.assertEqual(self.openbranches(repo), expected) |
133
2242dd1163c6
hg_delta_editor: fix bad parent revision calculation in the case of a branch
Augie Fackler <durin42@gmail.com>
parents:
131
diff
changeset
|
69 |
2242dd1163c6
hg_delta_editor: fix bad parent revision calculation in the case of a branch
Augie Fackler <durin42@gmail.com>
parents:
131
diff
changeset
|
70 def test_renamed_branch_to_trunk_stupid(self): |
2242dd1163c6
hg_delta_editor: fix bad parent revision calculation in the case of a branch
Augie Fackler <durin42@gmail.com>
parents:
131
diff
changeset
|
71 self.test_renamed_branch_to_trunk(stupid=True) |
131
4d42dbbb5127
hg_delta_editor: fix parent revision detection on branch copy
Patrick Mezard <pmezard@gmail.com>
parents:
120
diff
changeset
|
72 |
147
22162380c4b9
Improve branch closing in the case of a single-rev replacement of one branch
Augie Fackler <durin42@gmail.com>
parents:
133
diff
changeset
|
73 def test_replace_trunk_with_branch(self, stupid=False): |
22162380c4b9
Improve branch closing in the case of a single-rev replacement of one branch
Augie Fackler <durin42@gmail.com>
parents:
133
diff
changeset
|
74 repo = self._load_fixture_and_fetch('replace_trunk_with_branch.svndump', |
865
04729f3a3d17
test_util: merge load_fixture_and_fetch() into TestBase method
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
75 stupid=stupid) |
147
22162380c4b9
Improve branch closing in the case of a single-rev replacement of one branch
Augie Fackler <durin42@gmail.com>
parents:
133
diff
changeset
|
76 self.assertEqual(repo['default'].parents()[0].branch(), 'test') |
375
af9fc01299b4
Make branch closing more Mercurial-like.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
372
diff
changeset
|
77 self.assertEqual(repo['tip'].branch(), 'default') |
af9fc01299b4
Make branch closing more Mercurial-like.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
372
diff
changeset
|
78 self.assertEqual(repo['tip'].extra().get('close'), '1') |
372
a62965b179c1
Test for open branches in the pull result.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
344
diff
changeset
|
79 self.assertEqual(self.openbranches(repo), ['default']) |
147
22162380c4b9
Improve branch closing in the case of a single-rev replacement of one branch
Augie Fackler <durin42@gmail.com>
parents:
133
diff
changeset
|
80 |
397
1b9d004a8c0a
branches: correctly deal with branch closing directly after copy/rename
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
375
diff
changeset
|
81 def test_copybeforeclose(self, stupid=False): |
865
04729f3a3d17
test_util: merge load_fixture_and_fetch() into TestBase method
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
82 repo = self._load_fixture_and_fetch('copybeforeclose.svndump', |
04729f3a3d17
test_util: merge load_fixture_and_fetch() into TestBase method
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
83 stupid=stupid) |
397
1b9d004a8c0a
branches: correctly deal with branch closing directly after copy/rename
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
375
diff
changeset
|
84 self.assertEqual(repo['tip'].branch(), 'test') |
1b9d004a8c0a
branches: correctly deal with branch closing directly after copy/rename
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
375
diff
changeset
|
85 self.assertEqual(repo['test'].extra().get('close'), '1') |
1b9d004a8c0a
branches: correctly deal with branch closing directly after copy/rename
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
375
diff
changeset
|
86 self.assertEqual(repo['test']['b'].data(), 'a\n') |
1b9d004a8c0a
branches: correctly deal with branch closing directly after copy/rename
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
375
diff
changeset
|
87 |
1b9d004a8c0a
branches: correctly deal with branch closing directly after copy/rename
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
375
diff
changeset
|
88 def test_copybeforeclose_stupid(self): |
1b9d004a8c0a
branches: correctly deal with branch closing directly after copy/rename
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
375
diff
changeset
|
89 self.test_copybeforeclose(True) |
1b9d004a8c0a
branches: correctly deal with branch closing directly after copy/rename
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
375
diff
changeset
|
90 |
147
22162380c4b9
Improve branch closing in the case of a single-rev replacement of one branch
Augie Fackler <durin42@gmail.com>
parents:
133
diff
changeset
|
91 def test_replace_trunk_with_branch_stupid(self): |
22162380c4b9
Improve branch closing in the case of a single-rev replacement of one branch
Augie Fackler <durin42@gmail.com>
parents:
133
diff
changeset
|
92 self.test_replace_trunk_with_branch(stupid=True) |
22162380c4b9
Improve branch closing in the case of a single-rev replacement of one branch
Augie Fackler <durin42@gmail.com>
parents:
133
diff
changeset
|
93 |
232
c0063328587f
Fix and test for directory deletes during branch creation.
Augie Fackler <durin42@gmail.com>
parents:
201
diff
changeset
|
94 def test_branch_create_with_dir_delete_works(self, stupid=False): |
c0063328587f
Fix and test for directory deletes during branch creation.
Augie Fackler <durin42@gmail.com>
parents:
201
diff
changeset
|
95 repo = self._load_fixture_and_fetch('branch_create_with_dir_delete.svndump', |
865
04729f3a3d17
test_util: merge load_fixture_and_fetch() into TestBase method
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
96 stupid=stupid) |
232
c0063328587f
Fix and test for directory deletes during branch creation.
Augie Fackler <durin42@gmail.com>
parents:
201
diff
changeset
|
97 self.assertEqual(repo['tip'].manifest().keys(), |
c0063328587f
Fix and test for directory deletes during branch creation.
Augie Fackler <durin42@gmail.com>
parents:
201
diff
changeset
|
98 ['alpha', 'beta', 'iota', 'gamma', ]) |
c0063328587f
Fix and test for directory deletes during branch creation.
Augie Fackler <durin42@gmail.com>
parents:
201
diff
changeset
|
99 |
278
60acc38eac96
clone: prefer tip of default to overall tip when updating
Martijn Pieters <mj@zopatista.com>
parents:
232
diff
changeset
|
100 def test_branch_tip_update_to_default(self, stupid=False): |
60acc38eac96
clone: prefer tip of default to overall tip when updating
Martijn Pieters <mj@zopatista.com>
parents:
232
diff
changeset
|
101 repo = self._load_fixture_and_fetch('unorderedbranch.svndump', |
865
04729f3a3d17
test_util: merge load_fixture_and_fetch() into TestBase method
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
102 stupid=stupid, noupdate=False) |
278
60acc38eac96
clone: prefer tip of default to overall tip when updating
Martijn Pieters <mj@zopatista.com>
parents:
232
diff
changeset
|
103 self.assertEqual(repo[None].branch(), 'default') |
60acc38eac96
clone: prefer tip of default to overall tip when updating
Martijn Pieters <mj@zopatista.com>
parents:
232
diff
changeset
|
104 self.assertTrue('tip' not in repo[None].tags()) |
337
46e69be8e2c8
Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents:
326
diff
changeset
|
105 |
278
60acc38eac96
clone: prefer tip of default to overall tip when updating
Martijn Pieters <mj@zopatista.com>
parents:
232
diff
changeset
|
106 def test_branch_tip_update_to_default_stupid(self): |
60acc38eac96
clone: prefer tip of default to overall tip when updating
Martijn Pieters <mj@zopatista.com>
parents:
232
diff
changeset
|
107 self.test_branch_tip_update_to_default(True) |
337
46e69be8e2c8
Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents:
326
diff
changeset
|
108 |
344
4dfab1b8b7be
Mention what failed when given a non-numeric revision to clone/pull.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
109 def test_branch_pull_anchor(self): |
4dfab1b8b7be
Mention what failed when given a non-numeric revision to clone/pull.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
110 self.assertRaises(hgutil.Abort, |
4dfab1b8b7be
Mention what failed when given a non-numeric revision to clone/pull.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
111 self._load_fixture_and_fetch_with_anchor, |
4dfab1b8b7be
Mention what failed when given a non-numeric revision to clone/pull.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
112 'unorderedbranch.svndump', 'NaN') |
284
f8f9a2993705
Implement parseurl support (#revision in repository urls)
Martijn Pieters <mj@zopatista.com>
parents:
278
diff
changeset
|
113 repo = self._load_fixture_and_fetch_with_anchor( |
344
4dfab1b8b7be
Mention what failed when given a non-numeric revision to clone/pull.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
114 'unorderedbranch.svndump', '4') |
4dfab1b8b7be
Mention what failed when given a non-numeric revision to clone/pull.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
337
diff
changeset
|
115 self.assertTrue('c' not in repo.branchtags()) |
278
60acc38eac96
clone: prefer tip of default to overall tip when updating
Martijn Pieters <mj@zopatista.com>
parents:
232
diff
changeset
|
116 |
313
942f198b8ff5
hg_delta_editor: detect new branches issued from non-branch directories
Patrick Mezard <pmezard@gmail.com>
parents:
284
diff
changeset
|
117 def test_branches_weird_moves(self, stupid=False): |
865
04729f3a3d17
test_util: merge load_fixture_and_fetch() into TestBase method
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
118 repo = self._load_fixture_and_fetch('renamedproject.svndump', |
04729f3a3d17
test_util: merge load_fixture_and_fetch() into TestBase method
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
119 stupid=stupid, |
313
942f198b8ff5
hg_delta_editor: detect new branches issued from non-branch directories
Patrick Mezard <pmezard@gmail.com>
parents:
284
diff
changeset
|
120 subdir='project') |
942f198b8ff5
hg_delta_editor: detect new branches issued from non-branch directories
Patrick Mezard <pmezard@gmail.com>
parents:
284
diff
changeset
|
121 heads = [repo[n] for n in repo.heads()] |
942f198b8ff5
hg_delta_editor: detect new branches issued from non-branch directories
Patrick Mezard <pmezard@gmail.com>
parents:
284
diff
changeset
|
122 heads = dict((ctx.branch(), ctx) for ctx in heads) |
942f198b8ff5
hg_delta_editor: detect new branches issued from non-branch directories
Patrick Mezard <pmezard@gmail.com>
parents:
284
diff
changeset
|
123 mdefault = sorted(heads['default'].manifest().keys()) |
942f198b8ff5
hg_delta_editor: detect new branches issued from non-branch directories
Patrick Mezard <pmezard@gmail.com>
parents:
284
diff
changeset
|
124 mbranch = sorted(heads['branch'].manifest().keys()) |
942f198b8ff5
hg_delta_editor: detect new branches issued from non-branch directories
Patrick Mezard <pmezard@gmail.com>
parents:
284
diff
changeset
|
125 self.assertEqual(mdefault, ['a', 'b', 'd/a']) |
942f198b8ff5
hg_delta_editor: detect new branches issued from non-branch directories
Patrick Mezard <pmezard@gmail.com>
parents:
284
diff
changeset
|
126 self.assertEqual(mbranch, ['a']) |
942f198b8ff5
hg_delta_editor: detect new branches issued from non-branch directories
Patrick Mezard <pmezard@gmail.com>
parents:
284
diff
changeset
|
127 |
942f198b8ff5
hg_delta_editor: detect new branches issued from non-branch directories
Patrick Mezard <pmezard@gmail.com>
parents:
284
diff
changeset
|
128 def test_branches_weird_moves_stupid(self): |
942f198b8ff5
hg_delta_editor: detect new branches issued from non-branch directories
Patrick Mezard <pmezard@gmail.com>
parents:
284
diff
changeset
|
129 self.test_branches_weird_moves(True) |
942f198b8ff5
hg_delta_editor: detect new branches issued from non-branch directories
Patrick Mezard <pmezard@gmail.com>
parents:
284
diff
changeset
|
130 |
473
45df4d9320fa
Fix 'parent dir of a branch is deleted' refactoring from 343da84.
Max Bowsher <maxb@f2s.com>
parents:
425
diff
changeset
|
131 def test_branch_delete_parent_dir(self, stupid=False): |
45df4d9320fa
Fix 'parent dir of a branch is deleted' refactoring from 343da84.
Max Bowsher <maxb@f2s.com>
parents:
425
diff
changeset
|
132 repo = self._load_fixture_and_fetch('branch_delete_parent_dir.svndump', |
865
04729f3a3d17
test_util: merge load_fixture_and_fetch() into TestBase method
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
133 stupid=stupid) |
815
e62e84a9464b
test_fetch_branches: stop comparing converted nodeids
Patrick Mezard <pmezard@gmail.com>
parents:
643
diff
changeset
|
134 openb, closedb = self.branches(repo) |
e62e84a9464b
test_fetch_branches: stop comparing converted nodeids
Patrick Mezard <pmezard@gmail.com>
parents:
643
diff
changeset
|
135 self.assertEqual(openb, []) |
e62e84a9464b
test_fetch_branches: stop comparing converted nodeids
Patrick Mezard <pmezard@gmail.com>
parents:
643
diff
changeset
|
136 self.assertEqual(closedb, ['dev_branch']) |
e62e84a9464b
test_fetch_branches: stop comparing converted nodeids
Patrick Mezard <pmezard@gmail.com>
parents:
643
diff
changeset
|
137 self.assertEqual(list(repo['dev_branch']), ['foo']) |
473
45df4d9320fa
Fix 'parent dir of a branch is deleted' refactoring from 343da84.
Max Bowsher <maxb@f2s.com>
parents:
425
diff
changeset
|
138 |
582
44c56a7727c4
editor: fix issamefile() and copy detection in replay mode
Patrick Mezard <pmezard@gmail.com>
parents:
576
diff
changeset
|
139 def test_replace_branch_with_branch(self, stupid=False): |
44c56a7727c4
editor: fix issamefile() and copy detection in replay mode
Patrick Mezard <pmezard@gmail.com>
parents:
576
diff
changeset
|
140 repo = self._load_fixture_and_fetch('replace_branch_with_branch.svndump', |
865
04729f3a3d17
test_util: merge load_fixture_and_fetch() into TestBase method
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
141 stupid=stupid) |
582
44c56a7727c4
editor: fix issamefile() and copy detection in replay mode
Patrick Mezard <pmezard@gmail.com>
parents:
576
diff
changeset
|
142 self.assertEqual(7, len(repo)) |
44c56a7727c4
editor: fix issamefile() and copy detection in replay mode
Patrick Mezard <pmezard@gmail.com>
parents:
576
diff
changeset
|
143 # tip is former topological branch1 being closed |
44c56a7727c4
editor: fix issamefile() and copy detection in replay mode
Patrick Mezard <pmezard@gmail.com>
parents:
576
diff
changeset
|
144 ctx = repo['tip'] |
44c56a7727c4
editor: fix issamefile() and copy detection in replay mode
Patrick Mezard <pmezard@gmail.com>
parents:
576
diff
changeset
|
145 self.assertEqual('1', ctx.extra().get('close', '0')) |
44c56a7727c4
editor: fix issamefile() and copy detection in replay mode
Patrick Mezard <pmezard@gmail.com>
parents:
576
diff
changeset
|
146 self.assertEqual('branch1', ctx.branch()) |
44c56a7727c4
editor: fix issamefile() and copy detection in replay mode
Patrick Mezard <pmezard@gmail.com>
parents:
576
diff
changeset
|
147 # r5 is where the replacement takes place |
44c56a7727c4
editor: fix issamefile() and copy detection in replay mode
Patrick Mezard <pmezard@gmail.com>
parents:
576
diff
changeset
|
148 ctx = repo[5] |
588
2723152c8111
stupid: fix getcopies() logic
Patrick Mezard <pmezard@gmail.com>
parents:
587
diff
changeset
|
149 self.assertEqual(set(['a', 'c', 'dir/e', 'dir2/e', 'f', 'g']), set(ctx)) |
582
44c56a7727c4
editor: fix issamefile() and copy detection in replay mode
Patrick Mezard <pmezard@gmail.com>
parents:
576
diff
changeset
|
150 self.assertEqual('0', ctx.extra().get('close', '0')) |
44c56a7727c4
editor: fix issamefile() and copy detection in replay mode
Patrick Mezard <pmezard@gmail.com>
parents:
576
diff
changeset
|
151 self.assertEqual('branch1', ctx.branch()) |
44c56a7727c4
editor: fix issamefile() and copy detection in replay mode
Patrick Mezard <pmezard@gmail.com>
parents:
576
diff
changeset
|
152 self.assertEqual('c\n', ctx['c'].data()) |
585
c3ba4ca81d16
editor: fix replaced files content in replay mode
Patrick Mezard <pmezard@gmail.com>
parents:
582
diff
changeset
|
153 self.assertEqual('d\n', ctx['a'].data()) |
587
c06f59441f8e
editor: fix replaced directory copies
Patrick Mezard <pmezard@gmail.com>
parents:
585
diff
changeset
|
154 self.assertEqual('e\n', ctx['dir/e'].data()) |
c06f59441f8e
editor: fix replaced directory copies
Patrick Mezard <pmezard@gmail.com>
parents:
585
diff
changeset
|
155 self.assertEqual('e\n', ctx['dir2/e'].data()) |
588
2723152c8111
stupid: fix getcopies() logic
Patrick Mezard <pmezard@gmail.com>
parents:
587
diff
changeset
|
156 self.assertEqual('f\n', ctx['f'].data()) |
2723152c8111
stupid: fix getcopies() logic
Patrick Mezard <pmezard@gmail.com>
parents:
587
diff
changeset
|
157 self.assertEqual('g\n', ctx['g'].data()) |
2723152c8111
stupid: fix getcopies() logic
Patrick Mezard <pmezard@gmail.com>
parents:
587
diff
changeset
|
158 for f in ctx: |
2723152c8111
stupid: fix getcopies() logic
Patrick Mezard <pmezard@gmail.com>
parents:
587
diff
changeset
|
159 self.assertTrue(not ctx[f].renamed()) |
582
44c56a7727c4
editor: fix issamefile() and copy detection in replay mode
Patrick Mezard <pmezard@gmail.com>
parents:
576
diff
changeset
|
160 |
44c56a7727c4
editor: fix issamefile() and copy detection in replay mode
Patrick Mezard <pmezard@gmail.com>
parents:
576
diff
changeset
|
161 def test_replace_branch_with_branch_stupid(self, stupid=False): |
44c56a7727c4
editor: fix issamefile() and copy detection in replay mode
Patrick Mezard <pmezard@gmail.com>
parents:
576
diff
changeset
|
162 self.test_replace_branch_with_branch(True) |
44c56a7727c4
editor: fix issamefile() and copy detection in replay mode
Patrick Mezard <pmezard@gmail.com>
parents:
576
diff
changeset
|
163 |
117
3afe404042a3
Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
164 def suite(): |
833
312b37bc5e20
tests: avoid shadowing Python builtin all()
Yonggang Luo <luoyonggang@gmail.com>
parents:
816
diff
changeset
|
165 all_tests = [unittest.TestLoader().loadTestsFromTestCase(TestFetchBranches), |
117
3afe404042a3
Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
166 ] |
833
312b37bc5e20
tests: avoid shadowing Python builtin all()
Yonggang Luo <luoyonggang@gmail.com>
parents:
816
diff
changeset
|
167 return unittest.TestSuite(all_tests) |