annotate tests/test_fetch_branches.py @ 131:4d42dbbb5127

hg_delta_editor: fix parent revision detection on branch copy Project items copyfrom revisions are irrelevant to parent revision detection, only the project one or those of its ancestors matter. Items copyfrom is useful when retrieving items content. Former code resulted in incorrect converted graph for pyglet repository, especially on the following revision: ------------------------------------------------------------------------ r274 | r1chardj0n3s | 2006-12-21 02:02:14 +0100 (Jeu, 21 Dec 2006) | 2 lines Changed paths: A /branches/richard-glx-version (from /trunk:269) M /branches/richard-glx-version/pyglet/window/xlib/__init__.py R /branches/richard-glx-version/tests/test.py (from /trunk/tests/test.py:270) R /branches/richard-glx-version/tools/info.py (from /trunk/tools/info.py:272) R /branches/richard-glx-version/website/get_involved.php (from /trunk/website/get_involved.php:273) Branching to horribly mangle GLX
author Patrick Mezard <pmezard@gmail.com>
date Wed, 10 Dec 2008 11:03:22 -0600
parents f508c1fa19a5
children 2242dd1163c6
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 sys
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
2 import unittest
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
3
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
4 import test_util
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
5
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 class TestFetchBranches(test_util.TestBase):
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
8 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
9 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
10 self.wc_path, stupid=stupid)
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
11
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
12 def test_unrelatedbranch(self, stupid=False):
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
13 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
14 heads = [repo[n] for n in repo.heads()]
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
15 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
16 # 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
17 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
18 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
19
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
20 def test_unrelatedbranch_stupid(self):
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
21 self.test_unrelatedbranch(True)
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
22
131
4d42dbbb5127 hg_delta_editor: fix parent revision detection on branch copy
Patrick Mezard <pmezard@gmail.com>
parents: 120
diff changeset
23 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
24 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
25 r = repo['branch']
4d42dbbb5127 hg_delta_editor: fix parent revision detection on branch copy
Patrick Mezard <pmezard@gmail.com>
parents: 120
diff changeset
26 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
27 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
28
4d42dbbb5127 hg_delta_editor: fix parent revision detection on branch copy
Patrick Mezard <pmezard@gmail.com>
parents: 120
diff changeset
29 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
30 self.test_unorderedbranch(True)
4d42dbbb5127 hg_delta_editor: fix parent revision detection on branch copy
Patrick Mezard <pmezard@gmail.com>
parents: 120
diff changeset
31
117
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
32 def suite():
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
33 all = [unittest.TestLoader().loadTestsFromTestCase(TestFetchBranches),
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
34 ]
3afe404042a3 Add a disabled test for unrelated branches
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
35 return unittest.TestSuite(all)