annotate tests/test_tags.py @ 376:9327e9325645

Use tbdelta to push added tags into .hgtags.
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Fri, 29 May 2009 15:28:44 +0200
parents af9fc01299b4
children e1b23a6ca093
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
337
46e69be8e2c8 Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents: 331
diff changeset
9 from hgsubversion 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_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
17 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
18 stupid=stupid)
376
9327e9325645 Use tbdelta to push added tags into .hgtags.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 375
diff changeset
19 self.assertEqual(sorted(repo.tags()), ['copied_tag', 'tag_r3', 'tip'])
9327e9325645 Use tbdelta to push added tags into .hgtags.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 375
diff changeset
20 self.assertEqual(repo['tag_r3'], repo['copied_tag'])
9327e9325645 Use tbdelta to push added tags into .hgtags.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 375
diff changeset
21 self.assertEqual(repo['tag_r3'].rev(), 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
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_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
24 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
25
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 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
27 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
28 stupid=stupid)
376
9327e9325645 Use tbdelta to push added tags into .hgtags.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 375
diff changeset
29 self.assertEqual(repo['tag_r3'].rev(), 1)
9327e9325645 Use tbdelta to push added tags into .hgtags.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 375
diff changeset
30 self.assert_('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
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_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
33 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
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_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
36 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
37 stupid=stupid)
376
9327e9325645 Use tbdelta to push added tags into .hgtags.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 375
diff changeset
38 self.assertEqual(repo['tag_r3'], repo['other_tag_r3'])
9327e9325645 Use tbdelta to push added tags into .hgtags.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 375
diff changeset
39 self.assert_('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
40
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
41 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
42 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
43
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 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
45 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
46 stupid=stupid)
376
9327e9325645 Use tbdelta to push added tags into .hgtags.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 375
diff changeset
47 self.assert_('branch_from_tag' in repo.branchtags())
9327e9325645 Use tbdelta to push added tags into .hgtags.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 375
diff changeset
48 self.assertEqual(repo[1], repo['tag_r3'])
9327e9325645 Use tbdelta to push added tags into .hgtags.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 375
diff changeset
49 self.assertEqual(repo['branch_from_tag'].parents()[0], repo['copied_tag'])
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
50
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
51 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
52 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
53
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
54 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
55 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
56 stupid=stupid)
376
9327e9325645 Use tbdelta to push added tags into .hgtags.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 375
diff changeset
57 branches = set(repo[h] for h in repo.heads(closed=False))
375
af9fc01299b4 Make branch closing more Mercurial-like.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 337
diff changeset
58 self.assert_('dummy' not in branches)
376
9327e9325645 Use tbdelta to push added tags into .hgtags.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 375
diff changeset
59 self.assertEqual(repo['dummy'], repo['tip'].parents()[0].parents()[0])
375
af9fc01299b4 Make branch closing more Mercurial-like.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 337
diff changeset
60 extra = repo['tip'].extra().copy()
af9fc01299b4 Make branch closing more Mercurial-like.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 337
diff changeset
61 extra.pop('convert_revision', None)
af9fc01299b4 Make branch closing more Mercurial-like.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 337
diff changeset
62 self.assertEqual(extra, {'branch': 'dummy', 'close': '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
63
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
64 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
65 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
66
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 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
68 return unittest.TestLoader().loadTestsFromTestCase(TestTags)