Mercurial > hgsubversion
annotate tests/test_tags.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 | 291925677a9f |
children | 2242dd1163c6 |
rev | line source |
---|---|
23
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
1 import unittest |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
2 |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
3 from mercurial import hg |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
4 from mercurial import node |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
5 from mercurial import ui |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
6 |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
7 import test_util |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
8 |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
9 import svncommand |
124
291925677a9f
tag_repo: remove gentags command, extend repo.tags(), HgChangeEditor now takes either repo or repo_path
Luke Opperman <luke@loppear.com>
parents:
101
diff
changeset
|
10 import tag_repo |
23
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
11 |
91
7d10165cf3d9
tests: Mock the mercurial.ui.ui class like we really should to capture output.
Augie Fackler <durin42@gmail.com>
parents:
78
diff
changeset
|
12 class TestTags(test_util.TestBase): |
23
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
13 def _load_fixture_and_fetch(self, fixture_name, stupid=False): |
91
7d10165cf3d9
tests: Mock the mercurial.ui.ui class like we really should to capture output.
Augie Fackler <durin42@gmail.com>
parents:
78
diff
changeset
|
14 return test_util.load_fixture_and_fetch(fixture_name, self.repo_path, |
23
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
15 self.wc_path, stupid=stupid) |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
16 |
124
291925677a9f
tag_repo: remove gentags command, extend repo.tags(), HgChangeEditor now takes either repo or repo_path
Luke Opperman <luke@loppear.com>
parents:
101
diff
changeset
|
17 def getrepo(self): |
291925677a9f
tag_repo: remove gentags command, extend repo.tags(), HgChangeEditor now takes either repo or repo_path
Luke Opperman <luke@loppear.com>
parents:
101
diff
changeset
|
18 ui_ = ui.ui() |
291925677a9f
tag_repo: remove gentags command, extend repo.tags(), HgChangeEditor now takes either repo or repo_path
Luke Opperman <luke@loppear.com>
parents:
101
diff
changeset
|
19 repo = hg.repository(ui_, self.wc_path) |
291925677a9f
tag_repo: remove gentags command, extend repo.tags(), HgChangeEditor now takes either repo or repo_path
Luke Opperman <luke@loppear.com>
parents:
101
diff
changeset
|
20 repo.__class__ = tag_repo.generate_repo_class(ui_, repo) |
291925677a9f
tag_repo: remove gentags command, extend repo.tags(), HgChangeEditor now takes either repo or repo_path
Luke Opperman <luke@loppear.com>
parents:
101
diff
changeset
|
21 return repo |
291925677a9f
tag_repo: remove gentags command, extend repo.tags(), HgChangeEditor now takes either repo or repo_path
Luke Opperman <luke@loppear.com>
parents:
101
diff
changeset
|
22 |
23
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
23 def _test_tag_revision_info(self, repo): |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
24 self.assertEqual(node.hex(repo[0].node()), |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
25 'a47d0ce778660a91c31bf2c21c448e9ee296ac90') |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
26 self.assertEqual(node.hex(repo['tip'].node()), |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
27 'bf3767835b3b32ecc775a298c2fa27134dd91c11') |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
28 self.assertEqual(repo['tip'], repo[1]) |
91
7d10165cf3d9
tests: Mock the mercurial.ui.ui class like we really should to capture output.
Augie Fackler <durin42@gmail.com>
parents:
78
diff
changeset
|
29 |
23
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
30 def test_tags(self, stupid=False): |
91
7d10165cf3d9
tests: Mock the mercurial.ui.ui class like we really should to capture output.
Augie Fackler <durin42@gmail.com>
parents:
78
diff
changeset
|
31 repo = self._load_fixture_and_fetch('basic_tag_tests.svndump', |
23
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
32 stupid=stupid) |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
33 self._test_tag_revision_info(repo) |
124
291925677a9f
tag_repo: remove gentags command, extend repo.tags(), HgChangeEditor now takes either repo or repo_path
Luke Opperman <luke@loppear.com>
parents:
101
diff
changeset
|
34 repo = self.getrepo() |
28
9c481cae0428
Change the format of generated tags so they are tag/$tag instead of tag:$tag so that you can use them as revision args in diff.
Augie Fackler <durin42@gmail.com>
parents:
23
diff
changeset
|
35 self.assertEqual(repo['tip'].node(), repo['tag/tag_r3'].node()) |
9c481cae0428
Change the format of generated tags so they are tag/$tag instead of tag:$tag so that you can use them as revision args in diff.
Augie Fackler <durin42@gmail.com>
parents:
23
diff
changeset
|
36 self.assertEqual(repo['tip'].node(), repo['tag/copied_tag'].node()) |
91
7d10165cf3d9
tests: Mock the mercurial.ui.ui class like we really should to capture output.
Augie Fackler <durin42@gmail.com>
parents:
78
diff
changeset
|
37 |
23
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
38 def test_tags_stupid(self): |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
39 self.test_tags(stupid=True) |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
40 |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
41 def test_remove_tag(self, stupid=False): |
91
7d10165cf3d9
tests: Mock the mercurial.ui.ui class like we really should to capture output.
Augie Fackler <durin42@gmail.com>
parents:
78
diff
changeset
|
42 repo = self._load_fixture_and_fetch('remove_tag_test.svndump', |
23
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
43 stupid=stupid) |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
44 self._test_tag_revision_info(repo) |
124
291925677a9f
tag_repo: remove gentags command, extend repo.tags(), HgChangeEditor now takes either repo or repo_path
Luke Opperman <luke@loppear.com>
parents:
101
diff
changeset
|
45 repo = self.getrepo() |
28
9c481cae0428
Change the format of generated tags so they are tag/$tag instead of tag:$tag so that you can use them as revision args in diff.
Augie Fackler <durin42@gmail.com>
parents:
23
diff
changeset
|
46 self.assertEqual(repo['tip'].node(), repo['tag/tag_r3'].node()) |
9c481cae0428
Change the format of generated tags so they are tag/$tag instead of tag:$tag so that you can use them as revision args in diff.
Augie Fackler <durin42@gmail.com>
parents:
23
diff
changeset
|
47 self.assert_('tag/copied_tag' not in repo.tags()) |
91
7d10165cf3d9
tests: Mock the mercurial.ui.ui class like we really should to capture output.
Augie Fackler <durin42@gmail.com>
parents:
78
diff
changeset
|
48 |
23
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
49 def test_remove_tag_stupid(self): |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
50 self.test_remove_tag(stupid=True) |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
51 |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
52 def test_rename_tag(self, stupid=False): |
91
7d10165cf3d9
tests: Mock the mercurial.ui.ui class like we really should to capture output.
Augie Fackler <durin42@gmail.com>
parents:
78
diff
changeset
|
53 repo = self._load_fixture_and_fetch('rename_tag_test.svndump', |
23
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
54 stupid=stupid) |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
55 self._test_tag_revision_info(repo) |
124
291925677a9f
tag_repo: remove gentags command, extend repo.tags(), HgChangeEditor now takes either repo or repo_path
Luke Opperman <luke@loppear.com>
parents:
101
diff
changeset
|
56 repo = self.getrepo() |
28
9c481cae0428
Change the format of generated tags so they are tag/$tag instead of tag:$tag so that you can use them as revision args in diff.
Augie Fackler <durin42@gmail.com>
parents:
23
diff
changeset
|
57 self.assertEqual(repo['tip'].node(), repo['tag/tag_r3'].node()) |
9c481cae0428
Change the format of generated tags so they are tag/$tag instead of tag:$tag so that you can use them as revision args in diff.
Augie Fackler <durin42@gmail.com>
parents:
23
diff
changeset
|
58 self.assertEqual(repo['tip'].node(), repo['tag/other_tag_r3'].node()) |
9c481cae0428
Change the format of generated tags so they are tag/$tag instead of tag:$tag so that you can use them as revision args in diff.
Augie Fackler <durin42@gmail.com>
parents:
23
diff
changeset
|
59 self.assert_('tag/copied_tag' not in repo.tags()) |
91
7d10165cf3d9
tests: Mock the mercurial.ui.ui class like we really should to capture output.
Augie Fackler <durin42@gmail.com>
parents:
78
diff
changeset
|
60 |
23
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
61 def test_rename_tag_stupid(self): |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
62 self.test_rename_tag(stupid=True) |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
63 |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
64 def test_branch_from_tag(self, stupid=False): |
91
7d10165cf3d9
tests: Mock the mercurial.ui.ui class like we really should to capture output.
Augie Fackler <durin42@gmail.com>
parents:
78
diff
changeset
|
65 repo = self._load_fixture_and_fetch('branch_from_tag.svndump', |
23
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
66 stupid=stupid) |
124
291925677a9f
tag_repo: remove gentags command, extend repo.tags(), HgChangeEditor now takes either repo or repo_path
Luke Opperman <luke@loppear.com>
parents:
101
diff
changeset
|
67 repo = self.getrepo() |
23
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
68 self.assertEqual(repo['tip'].node(), repo['branch_from_tag'].node()) |
28
9c481cae0428
Change the format of generated tags so they are tag/$tag instead of tag:$tag so that you can use them as revision args in diff.
Augie Fackler <durin42@gmail.com>
parents:
23
diff
changeset
|
69 self.assertEqual(repo[1].node(), repo['tag/tag_r3'].node()) |
91
7d10165cf3d9
tests: Mock the mercurial.ui.ui class like we really should to capture output.
Augie Fackler <durin42@gmail.com>
parents:
78
diff
changeset
|
70 self.assertEqual(repo['branch_from_tag'].parents()[0].node(), |
28
9c481cae0428
Change the format of generated tags so they are tag/$tag instead of tag:$tag so that you can use them as revision args in diff.
Augie Fackler <durin42@gmail.com>
parents:
23
diff
changeset
|
71 repo['tag/copied_tag'].node()) |
91
7d10165cf3d9
tests: Mock the mercurial.ui.ui class like we really should to capture output.
Augie Fackler <durin42@gmail.com>
parents:
78
diff
changeset
|
72 |
23
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
73 def test_branch_from_tag_stupid(self): |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
74 self.test_branch_from_tag(stupid=True) |
91
7d10165cf3d9
tests: Mock the mercurial.ui.ui class like we really should to capture output.
Augie Fackler <durin42@gmail.com>
parents:
78
diff
changeset
|
75 |
37
2d319e162598
Add a test that proves renaming a branch to make a tag works properly.
Augie Fackler <durin42@gmail.com>
parents:
28
diff
changeset
|
76 def test_tag_by_renaming_branch(self, stupid=False): |
91
7d10165cf3d9
tests: Mock the mercurial.ui.ui class like we really should to capture output.
Augie Fackler <durin42@gmail.com>
parents:
78
diff
changeset
|
77 repo = self._load_fixture_and_fetch('tag_by_rename_branch.svndump', |
37
2d319e162598
Add a test that proves renaming a branch to make a tag works properly.
Augie Fackler <durin42@gmail.com>
parents:
28
diff
changeset
|
78 stupid=stupid) |
124
291925677a9f
tag_repo: remove gentags command, extend repo.tags(), HgChangeEditor now takes either repo or repo_path
Luke Opperman <luke@loppear.com>
parents:
101
diff
changeset
|
79 repo = self.getrepo() |
37
2d319e162598
Add a test that proves renaming a branch to make a tag works properly.
Augie Fackler <durin42@gmail.com>
parents:
28
diff
changeset
|
80 self.assertEqual(node.hex(repo['tip'].node()), |
2d319e162598
Add a test that proves renaming a branch to make a tag works properly.
Augie Fackler <durin42@gmail.com>
parents:
28
diff
changeset
|
81 '1b941f92acc343939274bd8bbf25984fa9706bb9') |
2d319e162598
Add a test that proves renaming a branch to make a tag works properly.
Augie Fackler <durin42@gmail.com>
parents:
28
diff
changeset
|
82 self.assertEqual(node.hex(repo['tag/dummy'].node()), |
2d319e162598
Add a test that proves renaming a branch to make a tag works properly.
Augie Fackler <durin42@gmail.com>
parents:
28
diff
changeset
|
83 '68f5f7d82b00a2efe3aca28b615ebab98235d55f') |
91
7d10165cf3d9
tests: Mock the mercurial.ui.ui class like we really should to capture output.
Augie Fackler <durin42@gmail.com>
parents:
78
diff
changeset
|
84 |
37
2d319e162598
Add a test that proves renaming a branch to make a tag works properly.
Augie Fackler <durin42@gmail.com>
parents:
28
diff
changeset
|
85 def test_tag_by_renaming_branch_stupid(self): |
91
7d10165cf3d9
tests: Mock the mercurial.ui.ui class like we really should to capture output.
Augie Fackler <durin42@gmail.com>
parents:
78
diff
changeset
|
86 self.test_tag_by_renaming_branch(stupid=True) |
23
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
87 |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
88 def suite(): |
1f8854804795
Add tests for tags and fix a bug in the tag-finding code that was found by the tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
89 return unittest.TestLoader().loadTestsFromTestCase(TestTags) |