annotate tests/test_fetch_branches.py @ 232:c0063328587f

Fix and test for directory deletes during branch creation.
author Augie Fackler <durin42@gmail.com>
date Tue, 07 Apr 2009 17:38:13 -0500
parents 883976b654b6
children 60acc38eac96
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
117
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
1 import unittest
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
2
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
3 from mercurial import node
2242dd1163c6 hg_delta_editor: fix bad parent revision calculation in the case of a branch
Augie Fackler <durin42@gmail.com>
parents: 131
diff changeset
4
117
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
5 import test_util
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
6
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
7
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
8 class TestFetchBranches(test_util.TestBase):
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
9 def _load_fixture_and_fetch(self, fixture_name, stupid):
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
10 return test_util.load_fixture_and_fetch(fixture_name, self.repo_path,
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
11 self.wc_path, stupid=stupid)
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
12
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
13 def test_unrelatedbranch(self, stupid=False):
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
14 repo = self._load_fixture_and_fetch('unrelatedbranch.svndump', stupid)
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
15 heads = [repo[n] for n in repo.heads()]
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
16 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
17 # 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
18 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
19 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
20
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
21 def test_unrelatedbranch_stupid(self):
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
22 self.test_unrelatedbranch(True)
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
23
131
4d42dbbb5127 hg_delta_editor: fix parent revision detection on branch copy
Patrick Mezard <pmezard@gmail.com>
parents: 120
diff changeset
24 def test_unorderedbranch(self, stupid=False):
4d42dbbb5127 hg_delta_editor: fix parent revision detection on branch copy
Patrick Mezard <pmezard@gmail.com>
parents: 120
diff changeset
25 repo = self._load_fixture_and_fetch('unorderedbranch.svndump', stupid)
4d42dbbb5127 hg_delta_editor: fix parent revision detection on branch copy
Patrick Mezard <pmezard@gmail.com>
parents: 120
diff changeset
26 r = repo['branch']
4d42dbbb5127 hg_delta_editor: fix parent revision detection on branch copy
Patrick Mezard <pmezard@gmail.com>
parents: 120
diff changeset
27 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
28 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
29
4d42dbbb5127 hg_delta_editor: fix parent revision detection on branch copy
Patrick Mezard <pmezard@gmail.com>
parents: 120
diff changeset
30 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
31 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
32
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
33 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
34 repo = self._load_fixture_and_fetch('branch_rename_to_trunk.svndump',
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
35 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
36 self.assertEqual(node.hex(repo['default'].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 147
diff changeset
37 '14d252aef315857df241dd3fa4bc7833b09bd2f5')
201
883976b654b6 Be more explicit about which branch I'm checking.
Augie Fackler <durin42@gmail.com>
parents: 158
diff changeset
38 self.assertEqual(repo['default'].parents()[0].branch(), 'dev_branch')
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
39 self.assertEqual(repo['old_trunk'].parents()[0].branch(), 'default')
2242dd1163c6 hg_delta_editor: fix bad parent revision calculation in the case of a branch
Augie Fackler <durin42@gmail.com>
parents: 131
diff changeset
40
2242dd1163c6 hg_delta_editor: fix bad parent revision calculation in the case of a branch
Augie Fackler <durin42@gmail.com>
parents: 131
diff changeset
41 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
42 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
43
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
44 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
45 repo = self._load_fixture_and_fetch('replace_trunk_with_branch.svndump',
22162380c4b9 Improve branch closing in the case of a single-rev replacement of one branch
Augie Fackler <durin42@gmail.com>
parents: 133
diff changeset
46 stupid)
22162380c4b9 Improve branch closing in the case of a single-rev replacement of one branch
Augie Fackler <durin42@gmail.com>
parents: 133
diff changeset
47 self.assertEqual(repo['default'].parents()[0].branch(), 'test')
22162380c4b9 Improve branch closing in the case of a single-rev replacement of one branch
Augie Fackler <durin42@gmail.com>
parents: 133
diff changeset
48 self.assertEqual(node.hex(repo['closed-branches'].parents()[0].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 147
diff changeset
49 '2cd09772e0f6ddf2d13c60ef3c1be11ad5a7dfae')
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
50 self.assertEqual(node.hex(repo['default'].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 147
diff changeset
51 '8a525ca0671f456e6b1417187bf86c6115d2cb78')
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
52
22162380c4b9 Improve branch closing in the case of a single-rev replacement of one branch
Augie Fackler <durin42@gmail.com>
parents: 133
diff changeset
53 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
54 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
55
232
c0063328587f Fix and test for directory deletes during branch creation.
Augie Fackler <durin42@gmail.com>
parents: 201
diff changeset
56 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
57 repo = self._load_fixture_and_fetch('branch_create_with_dir_delete.svndump',
c0063328587f Fix and test for directory deletes during branch creation.
Augie Fackler <durin42@gmail.com>
parents: 201
diff changeset
58 stupid)
c0063328587f Fix and test for directory deletes during branch creation.
Augie Fackler <durin42@gmail.com>
parents: 201
diff changeset
59 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
60 ['alpha', 'beta', 'iota', 'gamma', ])
c0063328587f Fix and test for directory deletes during branch creation.
Augie Fackler <durin42@gmail.com>
parents: 201
diff changeset
61
117
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
62 def suite():
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
63 all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchBranches),
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
64 ]
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
65 return unittest.TestSuite(all)