annotate tests/test_tags.py @ 331:75f082b5897e

Switch to using url scheme wrappers instead of duplicating each command we wrap. The 'hg svn url' command has been killed; the replacement is '.hg/hgrc'. More stuff related to its disappearance has been stripped, including two tests. HgChangeReceiver now takes a UUID argument, which it uses to ensure that remote repositories remain unchanged. This is a temporary solution, and I'm not entirely satisfied with how it's done either. Access to the UUID file has been isolated in a HgChangeReceiver property. Some more tests have been updated to use ui.pushbuffer()/popbuffer(), and to pass through the Mercurial API. Moved the arguments to wrappers.pull() to the UI configuration. Also, remove HgChangeReceiver.opts in favour of a 'usebranchnames' instance & configuration variable. The name is taken from the ConvertExtension.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Fri, 15 May 2009 19:18:43 +0200
parents 91c818377703
children 46e69be8e2c8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
331
75f082b5897e Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 158
diff changeset
9 import svnrepo
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
10
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
11 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
12 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
13 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
14 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
15
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 def _test_tag_revision_info(self, repo):
331
75f082b5897e Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 158
diff changeset
17 print repo.tags()
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
18 self.assertEqual(node.hex(repo[0].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 133
diff changeset
19 '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
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
20 self.assertEqual(node.hex(repo['tip'].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 133
diff changeset
21 'c95251e0dd04697deee99b79cc407d7db76e6a5f')
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
22 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
23
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
24 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
25 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
26 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
27 self._test_tag_revision_info(repo)
331
75f082b5897e Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 158
diff changeset
28 repo = self.repo
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
29 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
30 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
31
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 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
33 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
34
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
35 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
36 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
37 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
38 self._test_tag_revision_info(repo)
331
75f082b5897e Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 158
diff changeset
39 repo = self.repo
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
40 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
41 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
42
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 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
44 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
45
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
46 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
47 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
48 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
49 self._test_tag_revision_info(repo)
331
75f082b5897e Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 158
diff changeset
50 repo = self.repo
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
51 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
52 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
53 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
54
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
55 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
56 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
57
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
58 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
59 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
60 stupid=stupid)
331
75f082b5897e Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 158
diff changeset
61 repo = self.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
62 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
63 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
64 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
65 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
66
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
67 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
68 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
69
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
70 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
71 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
72 stupid=stupid)
331
75f082b5897e Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 158
diff changeset
73 repo = self.repo
133
2242dd1163c6 hg_delta_editor: fix bad parent revision calculation in the case of a branch
Augie Fackler <durin42@gmail.com>
parents: 124
diff changeset
74 self.assertEqual(repo['tip'], repo['closed-branches'])
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
75 self.assertEqual(node.hex(repo['tip'].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 133
diff changeset
76 '2f0a3abe2004c0fa01f5f6074a8b5441e9c80c2a')
133
2242dd1163c6 hg_delta_editor: fix bad parent revision calculation in the case of a branch
Augie Fackler <durin42@gmail.com>
parents: 124
diff changeset
77 taggedrev = repo['tip'].parents()[0]
2242dd1163c6 hg_delta_editor: fix bad parent revision calculation in the case of a branch
Augie Fackler <durin42@gmail.com>
parents: 124
diff changeset
78 self.assertEqual(node.hex(taggedrev.node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 133
diff changeset
79 '50c67c73267987de705ee335183c5486641e56e9')
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['tag/dummy'].node()),
154
6fa97cfbf62f fetch: Refactor extra creation to be shared by real and diff replay.
Augie Fackler <durin42@gmail.com>
parents: 133
diff changeset
81 '50c67c73267987de705ee335183c5486641e56e9')
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
82
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
83 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
84 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
85
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
86 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
87 return unittest.TestLoader().loadTestsFromTestCase(TestTags)