annotate tests/test_tags.py @ 144:19aabf67c792

test_fetch_command: test file and directory deletions
author Patrick Mezard <pmezard@gmail.com>
date Mon, 15 Dec 2008 21:39:35 -0600
parents 2242dd1163c6
children 6fa97cfbf62f
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
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()
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
80 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
81 self.assertEqual(node.hex(repo['tip'].node()),
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
82 'dd2dccc3180631192f058468ec7215899223a6d8')
2242dd1163c6 hg_delta_editor: fix bad parent revision calculation in the case of a branch
Augie Fackler <durin42@gmail.com>
parents: 124
diff changeset
83 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
84 self.assertEqual(node.hex(taggedrev.node()),
2242dd1163c6 hg_delta_editor: fix bad parent revision calculation in the case of a branch
Augie Fackler <durin42@gmail.com>
parents: 124
diff changeset
85 '68f5f7d82b00a2efe3aca28b615ebab98235d55f')
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
86 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
87 '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
88
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
89 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
90 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
91
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
92 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
93 return unittest.TestLoader().loadTestsFromTestCase(TestTags)