Mercurial > hgsubversion
changeset 449:bda5b47ad2a2
tags: handle editing a tag and its source branch simultaneously
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Tue, 23 Jun 2009 22:15:20 -0500 |
parents | fbc7cf4fd701 |
children | 7ca49177991a |
files | hgsubversion/svnmeta.py tests/fixtures/commit-to-tag.sh tests/fixtures/commit-to-tag.svndump tests/test_tags.py |
diffstat | 4 files changed, 103 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/hgsubversion/svnmeta.py +++ b/hgsubversion/svnmeta.py @@ -419,7 +419,7 @@ class SVNMeta(object): def movetag(self, tag, hash, branch, rev, date): if branch == 'default': branch = None - parentctx = self.repo[self.get_parent_revision(rev.revnum, branch)] + parentctx = self.repo[self.get_parent_revision(rev.revnum+1, branch)] if '.hgtags' in parentctx: tagdata = parentctx.filectx('.hgtags').data() else:
--- a/tests/fixtures/commit-to-tag.sh +++ b/tests/fixtures/commit-to-tag.sh @@ -39,6 +39,13 @@ for a in omega; do svn ci -m "Add file $a" done cd ../.. +svn up +svn cp $REPOPATH/branches/magic $REPOPATH/tags/also-edit -m 'Make tag to edit' +svn up + +echo not omega > branches/magic/omega +echo not omega > tags/also-edit/omega +svn ci -m 'edit both the tag and its source branch at the same time' cd ../.. svnadmin dump temp/repo > commit-to-tag.svndump
--- a/tests/fixtures/commit-to-tag.svndump +++ b/tests/fixtures/commit-to-tag.svndump @@ -9,7 +9,7 @@ Content-length: 56 K 8 svn:date V 27 -2009-06-21T18:31:52.697525Z +2009-06-24T02:53:15.860217Z PROPS-END Revision-number: 1 @@ -27,7 +27,7 @@ durin K 8 svn:date V 27 -2009-06-21T18:31:53.092074Z +2009-06-24T02:53:17.530891Z PROPS-END Node-path: branches @@ -81,7 +81,7 @@ durin K 8 svn:date V 27 -2009-06-21T18:31:54.113073Z +2009-06-24T02:53:18.122469Z PROPS-END Node-path: branches/magic/alpha @@ -111,7 +111,7 @@ durin K 8 svn:date V 27 -2009-06-21T18:31:55.071743Z +2009-06-24T02:53:19.101676Z PROPS-END Node-path: branches/magic/beta @@ -141,7 +141,7 @@ durin K 8 svn:date V 27 -2009-06-21T18:31:56.073236Z +2009-06-24T02:53:20.081433Z PROPS-END Node-path: branches/magic/gamma @@ -171,7 +171,7 @@ durin K 8 svn:date V 27 -2009-06-21T18:31:58.056126Z +2009-06-24T02:53:22.103708Z PROPS-END Node-path: tags/will-edit @@ -196,7 +196,7 @@ durin K 8 svn:date V 27 -2009-06-21T18:31:59.064850Z +2009-06-24T02:53:23.077083Z PROPS-END Node-path: branches/magic/delta @@ -226,7 +226,7 @@ durin K 8 svn:date V 27 -2009-06-21T18:32:00.080479Z +2009-06-24T02:53:24.107494Z PROPS-END Node-path: branches/magic/iota @@ -256,7 +256,7 @@ durin K 8 svn:date V 27 -2009-06-21T18:32:01.079819Z +2009-06-24T02:53:25.092428Z PROPS-END Node-path: branches/magic/lambda @@ -286,7 +286,7 @@ durin K 8 svn:date V 27 -2009-06-21T18:32:02.140778Z +2009-06-24T02:53:26.443673Z PROPS-END Node-path: tags/will-edit/alpha @@ -308,7 +308,7 @@ durin K 8 svn:date V 27 -2009-06-21T18:32:03.083676Z +2009-06-24T02:53:27.067556Z PROPS-END Node-path: branches/magic/omega @@ -323,3 +323,64 @@ PROPS-END omega +Revision-number: 11 +Prop-content-length: 116 +Content-length: 116 + +K 7 +svn:log +V 16 +Make tag to edit +K 10 +svn:author +V 5 +durin +K 8 +svn:date +V 27 +2009-06-24T02:53:29.049217Z +PROPS-END + +Node-path: tags/also-edit +Node-kind: dir +Node-action: add +Node-copyfrom-rev: 10 +Node-copyfrom-path: branches/magic + + +Revision-number: 12 +Prop-content-length: 156 +Content-length: 156 + +K 7 +svn:log +V 56 +edit both the tag and its source branch at the same time +K 10 +svn:author +V 5 +durin +K 8 +svn:date +V 27 +2009-06-24T02:53:30.063026Z +PROPS-END + +Node-path: branches/magic/omega +Node-kind: file +Node-action: change +Text-content-length: 10 +Text-content-md5: 9b26a47955b0778e131aae04743f2b8c +Content-length: 10 + +not omega + + +Node-path: tags/also-edit/omega +Node-kind: file +Node-action: change +Text-content-length: 10 +Text-content-md5: 9b26a47955b0778e131aae04743f2b8c +Content-length: 10 + +not omega
--- a/tests/test_tags.py +++ b/tests/test_tags.py @@ -92,22 +92,40 @@ class TestTags(test_util.TestBase): def test_edited_tag(self, stupid=False): repo = self._load_fixture_and_fetch('commit-to-tag.svndump', stupid=stupid) - self.assertEqual(len(repo.heads()), 2) + self.assertEqual(len(repo.heads()), 3) heads = repo.heads() openheads = [h for h in heads if not repo[h].extra().get('close', False)] closedheads = set(heads) - set(openheads) self.assertEqual(len(openheads), 1) - self.assertEqual(len(closedheads), 1) - tagged = list(closedheads)[0] + self.assertEqual(len(closedheads), 2) + closedheads = sorted(list(closedheads), cmp=lambda x,y: cmp(repo[x].rev(), + repo[y].rev())) + willedit, alsoedit = closedheads self.assertEqual( - repo[tagged].extra(), + repo[willedit].extra(), {'close': '1', 'branch': 'magic', 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/will-edit@9'}) - self.assertEqual(tagged, repo.tags()['will-edit']) + self.assertEqual(willedit, repo.tags()['will-edit']) self.assertEqual(repo['will-edit'].manifest().keys(), ['beta', 'gamma', ]) + self.assertEqual( + repo[alsoedit].extra(), + {'close': '1', + 'branch': 'magic', + 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/also-edit@12'}) + self.assertEqual(alsoedit, repo.tags()['also-edit']) + self.assertEqual(repo['also-edit'].manifest().keys(), + ['beta', + '.hgtags', + 'delta', + 'alpha', + 'omega', + 'iota', + 'gamma', + 'lambda', + ]) def test_tags_in_unusual_location(self): repo = self._load_fixture_and_fetch('tag_name_same_as_branch.svndump')