annotate tests/test_tags.py @ 455:54e57da61c1a

This patch fixes, partially, an issue with tagpaths. I found that, when using the tagpaths variable, I would actually get fatal exceptions when the clone was happening. This line prevents the fatal exception from occurring.
author Michael J. Pedersen <mpedersen@datapipe.com>
date Thu, 02 Jul 2009 16:12:09 -0500
parents ae35c389cdef
children bb612e625be6
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)
425
f5222d021665 tests: fix for new branch heads change in upstream hg.
Augie Fackler <durin42@gmail.com>
parents: 399
diff changeset
57 branches = set(repo[h] for h in repo.heads())
375
af9fc01299b4 Make branch closing more Mercurial-like.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 337
diff changeset
58 self.assert_('dummy' not in branches)
399
94f7e8c53c36 tags: end branch while tagging instead of creating extra changeset
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 389
diff changeset
59 self.assertEqual(repo['dummy'], repo['tip'].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
379
e1b23a6ca093 test_tags: Add a test that verifies tags get deleted properly even in the presence of somewhat odd branching.
Augie Fackler <durin42@gmail.com>
parents: 376
diff changeset
67 def test_deletion_of_tag_on_trunk_after_branching(self):
e1b23a6ca093 test_tags: Add a test that verifies tags get deleted properly even in the presence of somewhat odd branching.
Augie Fackler <durin42@gmail.com>
parents: 376
diff changeset
68 repo = self._load_fixture_and_fetch('tag_deletion_tag_branch.svndump')
425
f5222d021665 tests: fix for new branch heads change in upstream hg.
Augie Fackler <durin42@gmail.com>
parents: 399
diff changeset
69 branches = set(repo[h].extra()['branch'] for h in repo.heads())
379
e1b23a6ca093 test_tags: Add a test that verifies tags get deleted properly even in the presence of somewhat odd branching.
Augie Fackler <durin42@gmail.com>
parents: 376
diff changeset
70 self.assertEqual(branches, set(['default', 'from_2', ]))
e1b23a6ca093 test_tags: Add a test that verifies tags get deleted properly even in the presence of somewhat odd branching.
Augie Fackler <durin42@gmail.com>
parents: 376
diff changeset
71 self.assertEqual(
e1b23a6ca093 test_tags: Add a test that verifies tags get deleted properly even in the presence of somewhat odd branching.
Augie Fackler <durin42@gmail.com>
parents: 376
diff changeset
72 repo.tags(),
e1b23a6ca093 test_tags: Add a test that verifies tags get deleted properly even in the presence of somewhat odd branching.
Augie Fackler <durin42@gmail.com>
parents: 376
diff changeset
73 {'tip': 'g\xdd\xcd\x93\x03g\x1e\x7f\xa6-[V%\x99\x07\xd3\x9d>(\x94',
e1b23a6ca093 test_tags: Add a test that verifies tags get deleted properly even in the presence of somewhat odd branching.
Augie Fackler <durin42@gmail.com>
parents: 376
diff changeset
74 'new_tag': '=\xb8^\xb5\x18\xa9M\xdb\xf9\xb62Z\xa0\xb5R6+\xfe6.'})
e1b23a6ca093 test_tags: Add a test that verifies tags get deleted properly even in the presence of somewhat odd branching.
Augie Fackler <durin42@gmail.com>
parents: 376
diff changeset
75
381
a441ba143ac8 tags: fix handling for certain nonstandard tag layouts.
Augie Fackler <durin42@gmail.com>
parents: 379
diff changeset
76 def test_tags_in_unusual_location(self):
a441ba143ac8 tags: fix handling for certain nonstandard tag layouts.
Augie Fackler <durin42@gmail.com>
parents: 379
diff changeset
77 repo = self._load_fixture_and_fetch('unusual_tags.svndump')
a441ba143ac8 tags: fix handling for certain nonstandard tag layouts.
Augie Fackler <durin42@gmail.com>
parents: 379
diff changeset
78 branches = set(repo[h].extra()['branch']
425
f5222d021665 tests: fix for new branch heads change in upstream hg.
Augie Fackler <durin42@gmail.com>
parents: 399
diff changeset
79 for h in repo.heads())
381
a441ba143ac8 tags: fix handling for certain nonstandard tag layouts.
Augie Fackler <durin42@gmail.com>
parents: 379
diff changeset
80 self.assertEqual(branches, set(['default', 'dev_branch']))
a441ba143ac8 tags: fix handling for certain nonstandard tag layouts.
Augie Fackler <durin42@gmail.com>
parents: 379
diff changeset
81 tags = repo.tags()
a441ba143ac8 tags: fix handling for certain nonstandard tag layouts.
Augie Fackler <durin42@gmail.com>
parents: 379
diff changeset
82 del tags['tip']
a441ba143ac8 tags: fix handling for certain nonstandard tag layouts.
Augie Fackler <durin42@gmail.com>
parents: 379
diff changeset
83 self.assertEqual(
a441ba143ac8 tags: fix handling for certain nonstandard tag layouts.
Augie Fackler <durin42@gmail.com>
parents: 379
diff changeset
84 tags,
a441ba143ac8 tags: fix handling for certain nonstandard tag layouts.
Augie Fackler <durin42@gmail.com>
parents: 379
diff changeset
85 {'blah/trunktag': '\xd3$@\xd7\xd8Nu\xce\xa6%\xf1u\xd9b\x1a\xb2\x81\xc2\xb0\xb1',
a441ba143ac8 tags: fix handling for certain nonstandard tag layouts.
Augie Fackler <durin42@gmail.com>
parents: 379
diff changeset
86 'versions/branch_version': 'I\x89\x1c>z#\xfc._K#@:\xd6\x1f\x96\xd6\x83\x1b|',
a441ba143ac8 tags: fix handling for certain nonstandard tag layouts.
Augie Fackler <durin42@gmail.com>
parents: 379
diff changeset
87 })
a441ba143ac8 tags: fix handling for certain nonstandard tag layouts.
Augie Fackler <durin42@gmail.com>
parents: 379
diff changeset
88
447
0d3b5acb1d51 tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents: 425
diff changeset
89 def test_edited_tag_stupid(self):
0d3b5acb1d51 tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents: 425
diff changeset
90 self.test_edited_tag(True)
0d3b5acb1d51 tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents: 425
diff changeset
91
0d3b5acb1d51 tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents: 425
diff changeset
92 def test_edited_tag(self, stupid=False):
0d3b5acb1d51 tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents: 425
diff changeset
93 repo = self._load_fixture_and_fetch('commit-to-tag.svndump',
0d3b5acb1d51 tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents: 425
diff changeset
94 stupid=stupid)
452
ae35c389cdef tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents: 451
diff changeset
95 self.assertEqual(len(repo.heads()), 4)
447
0d3b5acb1d51 tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents: 425
diff changeset
96 heads = repo.heads()
0d3b5acb1d51 tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents: 425
diff changeset
97 openheads = [h for h in heads if not repo[h].extra().get('close', False)]
0d3b5acb1d51 tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents: 425
diff changeset
98 closedheads = set(heads) - set(openheads)
452
ae35c389cdef tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents: 451
diff changeset
99 self.assertEqual(len(openheads), 0)
ae35c389cdef tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents: 451
diff changeset
100 self.assertEqual(len(closedheads), 4)
449
bda5b47ad2a2 tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents: 447
diff changeset
101 closedheads = sorted(list(closedheads), cmp=lambda x,y: cmp(repo[x].rev(),
bda5b47ad2a2 tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents: 447
diff changeset
102 repo[y].rev()))
452
ae35c389cdef tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents: 451
diff changeset
103 # closeme has no open heads
ae35c389cdef tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents: 451
diff changeset
104 for h in openheads:
ae35c389cdef tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents: 451
diff changeset
105 self.assertNotEqual('closeme', repo[openheads[0]].branch())
ae35c389cdef tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents: 451
diff changeset
106
ae35c389cdef tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents: 451
diff changeset
107 self.assertEqual(1, len(self.repo.branchheads('magic')))
ae35c389cdef tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents: 451
diff changeset
108
ae35c389cdef tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents: 451
diff changeset
109 willedit, alsoedit, editlater, closeme = closedheads
447
0d3b5acb1d51 tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents: 425
diff changeset
110 self.assertEqual(
449
bda5b47ad2a2 tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents: 447
diff changeset
111 repo[willedit].extra(),
447
0d3b5acb1d51 tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents: 425
diff changeset
112 {'close': '1',
0d3b5acb1d51 tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents: 425
diff changeset
113 'branch': 'magic',
0d3b5acb1d51 tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents: 425
diff changeset
114 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/will-edit@9'})
449
bda5b47ad2a2 tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents: 447
diff changeset
115 self.assertEqual(willedit, repo.tags()['will-edit'])
447
0d3b5acb1d51 tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents: 425
diff changeset
116 self.assertEqual(repo['will-edit'].manifest().keys(), ['beta',
0d3b5acb1d51 tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents: 425
diff changeset
117 'gamma',
0d3b5acb1d51 tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents: 425
diff changeset
118 ])
449
bda5b47ad2a2 tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents: 447
diff changeset
119 self.assertEqual(
bda5b47ad2a2 tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents: 447
diff changeset
120 repo[alsoedit].extra(),
bda5b47ad2a2 tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents: 447
diff changeset
121 {'close': '1',
bda5b47ad2a2 tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents: 447
diff changeset
122 'branch': 'magic',
451
e533e78f1b2f tags: handle tags from edited tags.
Augie Fackler <durin42@gmail.com>
parents: 450
diff changeset
123 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/also-edit@14'})
e533e78f1b2f tags: handle tags from edited tags.
Augie Fackler <durin42@gmail.com>
parents: 450
diff changeset
124 self.assertEqual(repo[alsoedit].parents()[0].node(), repo.tags()['also-edit'])
449
bda5b47ad2a2 tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents: 447
diff changeset
125 self.assertEqual(repo['also-edit'].manifest().keys(),
bda5b47ad2a2 tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents: 447
diff changeset
126 ['beta',
bda5b47ad2a2 tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents: 447
diff changeset
127 '.hgtags',
bda5b47ad2a2 tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents: 447
diff changeset
128 'delta',
bda5b47ad2a2 tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents: 447
diff changeset
129 'alpha',
bda5b47ad2a2 tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents: 447
diff changeset
130 'omega',
bda5b47ad2a2 tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents: 447
diff changeset
131 'iota',
bda5b47ad2a2 tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents: 447
diff changeset
132 'gamma',
bda5b47ad2a2 tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents: 447
diff changeset
133 'lambda',
bda5b47ad2a2 tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents: 447
diff changeset
134 ])
379
e1b23a6ca093 test_tags: Add a test that verifies tags get deleted properly even in the presence of somewhat odd branching.
Augie Fackler <durin42@gmail.com>
parents: 376
diff changeset
135
452
ae35c389cdef tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents: 451
diff changeset
136 self.assertEqual(editlater, repo['edit-later'].node())
ae35c389cdef tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents: 451
diff changeset
137 self.assertEqual(
ae35c389cdef tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents: 451
diff changeset
138 repo[closeme].extra(),
ae35c389cdef tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents: 451
diff changeset
139 {'close': '1',
ae35c389cdef tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents: 451
diff changeset
140 'branch': 'closeme',
ae35c389cdef tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents: 451
diff changeset
141 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/branches/closeme@17'})
ae35c389cdef tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents: 451
diff changeset
142
389
a8811c84e3ee tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents: 381
diff changeset
143 def test_tags_in_unusual_location(self):
a8811c84e3ee tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents: 381
diff changeset
144 repo = self._load_fixture_and_fetch('tag_name_same_as_branch.svndump')
a8811c84e3ee tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents: 381
diff changeset
145 self.assertEqual(len(repo.heads()), 1)
a8811c84e3ee tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents: 381
diff changeset
146 branches = set(repo[h].extra()['branch']
425
f5222d021665 tests: fix for new branch heads change in upstream hg.
Augie Fackler <durin42@gmail.com>
parents: 399
diff changeset
147 for h in repo.heads())
389
a8811c84e3ee tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents: 381
diff changeset
148 self.assertEqual(branches, set(['magic', ]))
a8811c84e3ee tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents: 381
diff changeset
149 tags = repo.tags()
a8811c84e3ee tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents: 381
diff changeset
150 del tags['tip']
a8811c84e3ee tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents: 381
diff changeset
151 self.assertEqual(
a8811c84e3ee tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents: 381
diff changeset
152 tags,
a8811c84e3ee tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents: 381
diff changeset
153 {'magic': '\xa2b\xb9\x03\xc6\xbd\x903\x95\xf5\x0f\x94\xcey\xc4E\xfaE6\xaa',
a8811c84e3ee tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents: 381
diff changeset
154 'magic2': '\xa3\xa2D\x86aM\xc0v\xb9\xb0\x18\x14\xad\xacwBUi}\xe2',
a8811c84e3ee tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents: 381
diff changeset
155 })
a8811c84e3ee tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents: 381
diff changeset
156
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
157 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
158 return unittest.TestLoader().loadTestsFromTestCase(TestTags)