Mercurial > hgsubversion
annotate tests/test_tags.py @ 634:a400f3bf5611
replay/stupid: fix tagging on a branch renamed using a branch map
Previously, both convert_rev() functions used parentctx.extra() to
determine the branch to pass to meta.movetag(). This assumed that the
branch name stored in the changeset matches the internal branch. The
introduction of branch maps made this assumption unsafe, however: Now,
the Mercurial branch can be completely unrelated to the origin of the
changeset.
It turns out, however, that movetag() already has sufficient knowledge
to determine the branch. Given the hash of the new changeset to be
tagged, we walk its ancestors until we find an open changeset, which
we then know to be the originating branch. This assumes that there
were `few' commits made to the tag; an assumption I would consider
reasonable.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Sun, 11 Jul 2010 11:46:19 +0200 |
parents | 066453cf2014 |
children | d2ef7220a079 |
rev | line source |
---|---|
521
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
1 import os, sys, cStringIO, difflib |
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
|
2 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
|
3 |
453
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
4 from mercurial import commands |
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
|
5 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
|
6 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
|
7 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
|
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 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
|
10 |
474
63cb630d667d
tags: handle the most recent commit being an edit to an svn tag properly
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
11 from hgsubversion import svncommands |
337
46e69be8e2c8
Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
12 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
|
13 |
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 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
|
15 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
|
16 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
|
17 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
|
18 |
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
|
19 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
|
20 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
|
21 stupid=stupid) |
376
9327e9325645
Use tbdelta to push added tags into .hgtags.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
375
diff
changeset
|
22 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
|
23 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
|
24 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
|
25 |
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 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
|
27 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
|
28 |
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
|
29 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
|
30 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
|
31 stupid=stupid) |
376
9327e9325645
Use tbdelta to push added tags into .hgtags.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
375
diff
changeset
|
32 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
|
33 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
|
34 |
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
|
35 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
|
36 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
|
37 |
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_rename_tag(self, stupid=False): |
530
76e9504db03b
test_tags: rewrite both the test and the fixture script
Patrick Mezard <pmezard@gmail.com>
parents:
521
diff
changeset
|
39 expected = """\ |
76e9504db03b
test_tags: rewrite both the test and the fixture script
Patrick Mezard <pmezard@gmail.com>
parents:
521
diff
changeset
|
40 node: hg=default@2:svn=trunk@4 |
76e9504db03b
test_tags: rewrite both the test and the fixture script
Patrick Mezard <pmezard@gmail.com>
parents:
521
diff
changeset
|
41 tagging r3 |
76e9504db03b
test_tags: rewrite both the test and the fixture script
Patrick Mezard <pmezard@gmail.com>
parents:
521
diff
changeset
|
42 tag_r3: hg=default@1:svn=trunk@3 |
76e9504db03b
test_tags: rewrite both the test and the fixture script
Patrick Mezard <pmezard@gmail.com>
parents:
521
diff
changeset
|
43 |
76e9504db03b
test_tags: rewrite both the test and the fixture script
Patrick Mezard <pmezard@gmail.com>
parents:
521
diff
changeset
|
44 node: hg=default@3:svn=trunk@5 |
76e9504db03b
test_tags: rewrite both the test and the fixture script
Patrick Mezard <pmezard@gmail.com>
parents:
521
diff
changeset
|
45 tag from a tag |
76e9504db03b
test_tags: rewrite both the test and the fixture script
Patrick Mezard <pmezard@gmail.com>
parents:
521
diff
changeset
|
46 tag_r3: hg=default@1:svn=trunk@3 |
76e9504db03b
test_tags: rewrite both the test and the fixture script
Patrick Mezard <pmezard@gmail.com>
parents:
521
diff
changeset
|
47 copied_tag: hg=default@1:svn=trunk@3 |
76e9504db03b
test_tags: rewrite both the test and the fixture script
Patrick Mezard <pmezard@gmail.com>
parents:
521
diff
changeset
|
48 |
76e9504db03b
test_tags: rewrite both the test and the fixture script
Patrick Mezard <pmezard@gmail.com>
parents:
521
diff
changeset
|
49 node: hg=default@4:svn=trunk@6 |
76e9504db03b
test_tags: rewrite both the test and the fixture script
Patrick Mezard <pmezard@gmail.com>
parents:
521
diff
changeset
|
50 rename a tag |
76e9504db03b
test_tags: rewrite both the test and the fixture script
Patrick Mezard <pmezard@gmail.com>
parents:
521
diff
changeset
|
51 tag_r3: hg=default@1:svn=trunk@3 |
76e9504db03b
test_tags: rewrite both the test and the fixture script
Patrick Mezard <pmezard@gmail.com>
parents:
521
diff
changeset
|
52 copied_tag: hg=default@1:svn=trunk@3 |
76e9504db03b
test_tags: rewrite both the test and the fixture script
Patrick Mezard <pmezard@gmail.com>
parents:
521
diff
changeset
|
53 copied_tag: hg=default@-1:svn=unk@unk |
76e9504db03b
test_tags: rewrite both the test and the fixture script
Patrick Mezard <pmezard@gmail.com>
parents:
521
diff
changeset
|
54 other_tag_r3: hg=default@1:svn=trunk@3 |
76e9504db03b
test_tags: rewrite both the test and the fixture script
Patrick Mezard <pmezard@gmail.com>
parents:
521
diff
changeset
|
55 """ |
76e9504db03b
test_tags: rewrite both the test and the fixture script
Patrick Mezard <pmezard@gmail.com>
parents:
521
diff
changeset
|
56 self._test_tags('rename_tag_test.svndump', expected, stupid) |
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
|
57 |
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
|
58 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
|
59 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
|
60 |
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_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
|
62 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
|
63 stupid=stupid) |
376
9327e9325645
Use tbdelta to push added tags into .hgtags.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
375
diff
changeset
|
64 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
|
65 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
|
66 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
|
67 |
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 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
|
69 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
|
70 |
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
|
71 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
|
72 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
|
73 stupid=stupid) |
425
f5222d021665
tests: fix for new branch heads change in upstream hg.
Augie Fackler <durin42@gmail.com>
parents:
399
diff
changeset
|
74 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
|
75 self.assert_('dummy' not in branches) |
596
066453cf2014
test_tags: improve test output.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
573
diff
changeset
|
76 self.assertEqual(repo['dummy'], repo['tip'].parents()[0], |
066453cf2014
test_tags: improve test output.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
573
diff
changeset
|
77 '%r != %r[0]' % (repo['dummy'], |
066453cf2014
test_tags: improve test output.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
573
diff
changeset
|
78 repo['tip'].parents())) |
375
af9fc01299b4
Make branch closing more Mercurial-like.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
337
diff
changeset
|
79 extra = repo['tip'].extra().copy() |
af9fc01299b4
Make branch closing more Mercurial-like.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
337
diff
changeset
|
80 extra.pop('convert_revision', None) |
af9fc01299b4
Make branch closing more Mercurial-like.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
337
diff
changeset
|
81 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
|
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 |
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
|
86 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
|
87 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
|
88 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
|
89 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
|
90 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
|
91 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
|
92 {'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
|
93 '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
|
94 |
381
a441ba143ac8
tags: fix handling for certain nonstandard tag layouts.
Augie Fackler <durin42@gmail.com>
parents:
379
diff
changeset
|
95 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
|
96 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
|
97 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
|
98 for h in repo.heads()) |
381
a441ba143ac8
tags: fix handling for certain nonstandard tag layouts.
Augie Fackler <durin42@gmail.com>
parents:
379
diff
changeset
|
99 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
|
100 tags = repo.tags() |
a441ba143ac8
tags: fix handling for certain nonstandard tag layouts.
Augie Fackler <durin42@gmail.com>
parents:
379
diff
changeset
|
101 del tags['tip'] |
a441ba143ac8
tags: fix handling for certain nonstandard tag layouts.
Augie Fackler <durin42@gmail.com>
parents:
379
diff
changeset
|
102 self.assertEqual( |
a441ba143ac8
tags: fix handling for certain nonstandard tag layouts.
Augie Fackler <durin42@gmail.com>
parents:
379
diff
changeset
|
103 tags, |
a441ba143ac8
tags: fix handling for certain nonstandard tag layouts.
Augie Fackler <durin42@gmail.com>
parents:
379
diff
changeset
|
104 {'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
|
105 '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
|
106 }) |
a441ba143ac8
tags: fix handling for certain nonstandard tag layouts.
Augie Fackler <durin42@gmail.com>
parents:
379
diff
changeset
|
107 |
474
63cb630d667d
tags: handle the most recent commit being an edit to an svn tag properly
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
108 def test_most_recent_is_edited_stupid(self): |
63cb630d667d
tags: handle the most recent commit being an edit to an svn tag properly
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
109 self.test_most_recent_is_edited(True) |
63cb630d667d
tags: handle the most recent commit being an edit to an svn tag properly
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
110 |
63cb630d667d
tags: handle the most recent commit being an edit to an svn tag properly
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
111 def test_most_recent_is_edited(self, stupid=False): |
63cb630d667d
tags: handle the most recent commit being an edit to an svn tag properly
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
112 repo = self._load_fixture_and_fetch('most-recent-is-edit-tag.svndump', |
63cb630d667d
tags: handle the most recent commit being an edit to an svn tag properly
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
113 stupid=stupid) |
63cb630d667d
tags: handle the most recent commit being an edit to an svn tag properly
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
114 self.repo.ui.status( |
63cb630d667d
tags: handle the most recent commit being an edit to an svn tag properly
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
115 "Note: this test failing may be because of a rebuildmeta failure.\n" |
63cb630d667d
tags: handle the most recent commit being an edit to an svn tag properly
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
116 "You should check that before assuming issues with this test.\n") |
63cb630d667d
tags: handle the most recent commit being an edit to an svn tag properly
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
117 wc2_path = self.wc_path + '2' |
63cb630d667d
tags: handle the most recent commit being an edit to an svn tag properly
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
118 src, dest = hg.clone(repo.ui, self.wc_path, wc2_path, update=False) |
63cb630d667d
tags: handle the most recent commit being an edit to an svn tag properly
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
119 svncommands.rebuildmeta(repo.ui, |
63cb630d667d
tags: handle the most recent commit being an edit to an svn tag properly
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
120 dest, |
63cb630d667d
tags: handle the most recent commit being an edit to an svn tag properly
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
121 args=[test_util.fileurl(self.repo_path), ]) |
63cb630d667d
tags: handle the most recent commit being an edit to an svn tag properly
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
122 commands.pull(self.repo.ui, self.repo, stupid=stupid) |
63cb630d667d
tags: handle the most recent commit being an edit to an svn tag properly
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
123 dtags, srctags = dest.tags(), self.repo.tags() |
63cb630d667d
tags: handle the most recent commit being an edit to an svn tag properly
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
124 dtags.pop('tip') |
63cb630d667d
tags: handle the most recent commit being an edit to an svn tag properly
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
125 srctags.pop('tip') |
63cb630d667d
tags: handle the most recent commit being an edit to an svn tag properly
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
126 self.assertEqual(dtags, srctags) |
63cb630d667d
tags: handle the most recent commit being an edit to an svn tag properly
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
127 self.assertEqual(dest.heads(), self.repo.heads()) |
63cb630d667d
tags: handle the most recent commit being an edit to an svn tag properly
Augie Fackler <durin42@gmail.com>
parents:
453
diff
changeset
|
128 |
447
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
425
diff
changeset
|
129 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
|
130 self.test_edited_tag(True) |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
425
diff
changeset
|
131 |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
425
diff
changeset
|
132 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
|
133 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
|
134 stupid=stupid) |
547
9e6499c415a9
tags: fix files edited during tag creation
Augie Fackler <durin42@gmail.com>
parents:
545
diff
changeset
|
135 headcount = 6 |
9e6499c415a9
tags: fix files edited during tag creation
Augie Fackler <durin42@gmail.com>
parents:
545
diff
changeset
|
136 self.assertEqual(len(repo.heads()), headcount) |
447
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
425
diff
changeset
|
137 heads = repo.heads() |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
425
diff
changeset
|
138 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
|
139 closedheads = set(heads) - set(openheads) |
453
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
140 self.assertEqual(len(openheads), 1) |
545
ebd8fb1a05e4
clean up trailing whitespace
Augie Fackler <durin42@gmail.com>
parents:
541
diff
changeset
|
141 self.assertEqual(len(closedheads), headcount-1) |
453
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
142 closedheads = sorted(list(closedheads), |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
143 cmp=lambda x,y: cmp(repo[x].rev(), repo[y].rev())) |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
144 |
452
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
451
diff
changeset
|
145 # 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
|
146 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
|
147 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
|
148 |
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
451
diff
changeset
|
149 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
|
150 |
547
9e6499c415a9
tags: fix files edited during tag creation
Augie Fackler <durin42@gmail.com>
parents:
545
diff
changeset
|
151 alsoedit, editlater, closeme, willedit, editcreate, = closedheads |
447
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
425
diff
changeset
|
152 self.assertEqual( |
449
bda5b47ad2a2
tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
153 repo[willedit].extra(), |
447
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
425
diff
changeset
|
154 {'close': '1', |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
425
diff
changeset
|
155 'branch': 'magic', |
453
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
156 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/will-edit@19'}) |
449
bda5b47ad2a2
tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
157 self.assertEqual(willedit, repo.tags()['will-edit']) |
453
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
158 self.assertEqual(repo['will-edit'].manifest().keys(), ['alpha', |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
159 'beta', |
447
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
425
diff
changeset
|
160 'gamma', |
0d3b5acb1d51
tags: handle edits to tags as gracefully as possible
Augie Fackler <durin42@gmail.com>
parents:
425
diff
changeset
|
161 ]) |
449
bda5b47ad2a2
tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
162 self.assertEqual( |
bda5b47ad2a2
tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
163 repo[alsoedit].extra(), |
bda5b47ad2a2
tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
164 {'close': '1', |
bda5b47ad2a2
tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
165 'branch': 'magic', |
451
e533e78f1b2f
tags: handle tags from edited tags.
Augie Fackler <durin42@gmail.com>
parents:
450
diff
changeset
|
166 '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
|
167 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
|
168 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
|
169 ['beta', |
bda5b47ad2a2
tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
170 '.hgtags', |
bda5b47ad2a2
tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
171 'delta', |
bda5b47ad2a2
tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
172 'alpha', |
bda5b47ad2a2
tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
173 'omega', |
bda5b47ad2a2
tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
174 'iota', |
bda5b47ad2a2
tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
175 'gamma', |
bda5b47ad2a2
tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
176 'lambda', |
bda5b47ad2a2
tags: handle editing a tag and its source branch simultaneously
Augie Fackler <durin42@gmail.com>
parents:
447
diff
changeset
|
177 ]) |
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
|
178 |
452
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
451
diff
changeset
|
179 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
|
180 self.assertEqual( |
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
451
diff
changeset
|
181 repo[closeme].extra(), |
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
451
diff
changeset
|
182 {'close': '1', |
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
451
diff
changeset
|
183 'branch': 'closeme', |
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
451
diff
changeset
|
184 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/branches/closeme@17'}) |
547
9e6499c415a9
tags: fix files edited during tag creation
Augie Fackler <durin42@gmail.com>
parents:
545
diff
changeset
|
185 self.assertEqual('alpha\nalpha\n', repo['edit-at-create']['alpha'].data()) |
452
ae35c389cdef
tags: allow editing tags of closed branches without reopening the branch
Augie Fackler <durin42@gmail.com>
parents:
451
diff
changeset
|
186 |
389
a8811c84e3ee
tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents:
381
diff
changeset
|
187 def test_tags_in_unusual_location(self): |
a8811c84e3ee
tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents:
381
diff
changeset
|
188 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
|
189 self.assertEqual(len(repo.heads()), 1) |
a8811c84e3ee
tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents:
381
diff
changeset
|
190 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
|
191 for h in repo.heads()) |
389
a8811c84e3ee
tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents:
381
diff
changeset
|
192 self.assertEqual(branches, set(['magic', ])) |
a8811c84e3ee
tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents:
381
diff
changeset
|
193 tags = repo.tags() |
a8811c84e3ee
tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents:
381
diff
changeset
|
194 del tags['tip'] |
a8811c84e3ee
tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents:
381
diff
changeset
|
195 self.assertEqual( |
a8811c84e3ee
tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents:
381
diff
changeset
|
196 tags, |
a8811c84e3ee
tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents:
381
diff
changeset
|
197 {'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
|
198 '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
|
199 }) |
a8811c84e3ee
tags: Fix an improper parent calculation.
Augie Fackler <durin42@gmail.com>
parents:
381
diff
changeset
|
200 |
453
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
201 def test_old_tag_map_rebuilds(self): |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
202 repo = self._load_fixture_and_fetch('tag_name_same_as_branch.svndump') |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
203 tm = os.path.join(repo.path, 'svn', 'tagmap') |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
204 open(tm, 'w').write('1\n') |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
205 commands.pull(repo.ui, repo) |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
206 self.assertEqual(open(tm).read().splitlines()[0], '2') |
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
207 |
521
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
208 def _debug_print_tags(self, repo, ctx, fp): |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
209 def formatnode(ctx): |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
210 crev = ctx.extra().get('convert_revision', 'unk/unk@unk') |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
211 path, rev = crev.rsplit('@', 1) |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
212 path = path.split('/', 1)[-1] |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
213 branch = ctx.branch() or 'default' |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
214 return 'hg=%s@%d:svn=%s@%s' % (branch, ctx.rev(), path, rev) |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
215 |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
216 w = fp.write |
541
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
217 desc = ctx.description().splitlines()[0].strip() |
521
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
218 if '.hgtags' not in ctx or not ctx['.hgtags'].data().strip(): |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
219 return |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
220 w('node: %s\n' % formatnode(ctx)) |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
221 w('%s\n' % desc) |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
222 for line in ctx['.hgtags'].data().splitlines(False): |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
223 node, name = line.split(None, 1) |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
224 w(' %s: %s\n' % (name, formatnode(repo[node]))) |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
225 w('\n') |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
226 |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
227 def _test_tags(self, testpath, expected, stupid=False): |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
228 repo = self._load_fixture_and_fetch(testpath, stupid=stupid) |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
229 fp = cStringIO.StringIO() |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
230 for r in repo: |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
231 self._debug_print_tags(repo, repo[r], fp=fp) |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
232 output = fp.getvalue().strip() |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
233 expected = expected.strip() |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
234 if expected == output: |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
235 return |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
236 expected = expected.splitlines() |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
237 output = output.splitlines() |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
238 diff = difflib.unified_diff(expected, output, 'expected', 'output') |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
239 self.assert_(False, '\n' + '\n'.join(diff)) |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
240 |
536
460eb781d840
Handle subdirectory tags in stupid mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
530
diff
changeset
|
241 def test_tagging_into_tag(self, stupid=False): |
521
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
242 expected = """\ |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
243 node: hg=test@2:svn=branches/test@4 |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
244 First tag. |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
245 test-0.1: hg=test@1:svn=branches/test@3 |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
246 |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
247 node: hg=test@3:svn=branches/test@5 |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
248 Weird tag. |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
249 test-0.1: hg=test@1:svn=branches/test@3 |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
250 test-0.1/test: hg=test@1:svn=branches/test@3 |
541
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
251 |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
252 node: hg=test@4:svn=branches/test@6 |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
253 Fix tag pt 1. |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
254 test-0.1: hg=test@1:svn=branches/test@3 |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
255 test-0.1/test: hg=test@1:svn=branches/test@3 |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
256 test-0.1/test: hg=default@-1:svn=unk@unk |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
257 test-0.1-real: hg=test@1:svn=branches/test@3 |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
258 |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
259 node: hg=test@5:svn=branches/test@7 |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
260 Remove weird. |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
261 test-0.1: hg=test@1:svn=branches/test@3 |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
262 test-0.1/test: hg=test@1:svn=branches/test@3 |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
263 test-0.1/test: hg=default@-1:svn=unk@unk |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
264 test-0.1-real: hg=test@1:svn=branches/test@3 |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
265 test-0.1: hg=default@-1:svn=unk@unk |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
266 |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
267 node: hg=test@6:svn=branches/test@8 |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
268 Fix tag pt 2. |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
269 test-0.1: hg=test@1:svn=branches/test@3 |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
270 test-0.1/test: hg=test@1:svn=branches/test@3 |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
271 test-0.1/test: hg=default@-1:svn=unk@unk |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
272 test-0.1-real: hg=test@1:svn=branches/test@3 |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
273 test-0.1: hg=default@-1:svn=unk@unk |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
274 test-0.1-real: hg=default@-1:svn=unk@unk |
d380e7e4175a
Extend issue119 to full original weirdness
Patrick Mezard <pmezard@gmail.com>
parents:
536
diff
changeset
|
275 test-0.1: hg=test@1:svn=branches/test@3 |
521
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
276 """ |
536
460eb781d840
Handle subdirectory tags in stupid mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
530
diff
changeset
|
277 self._test_tags('renametagdir.svndump', expected, stupid=stupid) |
521
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
278 |
839734dfb5c7
Handle tag subdirectory as tag in replay mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
474
diff
changeset
|
279 def test_tagging_into_tag_stupid(self): |
536
460eb781d840
Handle subdirectory tags in stupid mode (issue119)
Patrick Mezard <pmezard@gmail.com>
parents:
530
diff
changeset
|
280 self.test_tagging_into_tag(True) |
545
ebd8fb1a05e4
clean up trailing whitespace
Augie Fackler <durin42@gmail.com>
parents:
541
diff
changeset
|
281 |
453
bb612e625be6
tags: handle copyfrom old versions of tags more correctly
Augie Fackler <durin42@gmail.com>
parents:
452
diff
changeset
|
282 |
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
|
283 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
|
284 return unittest.TestLoader().loadTestsFromTestCase(TestTags) |