Mercurial > hgsubversion
changeset 451:e533e78f1b2f
tags: handle tags from edited tags.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Fri, 26 Jun 2009 11:12:14 -0500 |
parents | 7ca49177991a |
children | ae35c389cdef |
files | hgsubversion/svnmeta.py tests/fixtures/commit-to-tag.sh tests/fixtures/commit-to-tag.svndump tests/test_tags.py |
diffstat | 4 files changed, 40 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/hgsubversion/svnmeta.py +++ b/hgsubversion/svnmeta.py @@ -459,7 +459,7 @@ class SVNMeta(object): branches.setdefault(branch, []).append(('rm', tag, None)) for b, tags in branches.iteritems(): - + fromtag = self.is_path_tag(self.remotename(b)) # modify parent's .hgtags source parent = self.repo[self.get_parent_revision(rev.revnum, b)] if '.hgtags' not in parent: @@ -468,8 +468,11 @@ class SVNMeta(object): src = parent['.hgtags'].data() for op, tag, r in sorted(tags, reverse=True): if op == 'add': - tagged = node.hex(self.revmap[ - self.get_parent_svn_branch_and_rev(r+1, b)]) + if fromtag: + tagged = node.hex(self.tags[fromtag]) + else: + tagged = node.hex(self.revmap[ + self.get_parent_svn_branch_and_rev(r+1, b)]) elif op == 'rm': tagged = node.hex(node.nullid) src += '%s %s\n' % (tagged, tag) @@ -481,9 +484,11 @@ class SVNMeta(object): islink=False, isexec=False, copied=None) extra = self.genextra(rev.revnum, b) + if fromtag: + extra['branch'] = parent.extra().get('branch', 'default') if not self.usebranchnames: extra.pop('branch', None) - if b in endbranches: + if b in endbranches or fromtag: extra['close'] = 1 ctx = context.memctx(self.repo, (parent.node(), node.nullid), @@ -494,7 +499,8 @@ class SVNMeta(object): date, extra) new = self.repo.commitctx(ctx) - if (rev.revnum, b) not in self.revmap: + + if not fromtag and (rev.revnum, b) not in self.revmap: self.revmap[rev.revnum, b] = new if b in endbranches: endbranches.pop(b)
--- a/tests/fixtures/commit-to-tag.sh +++ b/tests/fixtures/commit-to-tag.sh @@ -50,6 +50,8 @@ svn ci -m 'edit both the tag and its sou echo more stupidity > tags/also-edit/omega svn ci -m 'Edit an edited tag.' +svn cp $REPOPATH/tags/also-edit $REPOPATH/tags/did-edits -m 'Tag an edited tag' + cd ../.. svnadmin dump temp/repo > commit-to-tag.svndump echo
--- a/tests/fixtures/commit-to-tag.svndump +++ b/tests/fixtures/commit-to-tag.svndump @@ -412,3 +412,28 @@ Text-content-md5: a8d56f18cc28a34d6fe2ce Content-length: 15 more stupidity + + +Revision-number: 14 +Prop-content-length: 120 +Content-length: 120 + +K 7 +svn:log +V 17 +Tag an edited tag +K 10 +svn:author +V 5 +durin +K 8 +svn:date +V 27 +2009-06-26T15:57:06.047408Z +PROPS-END + +Node-path: tags/did-edits +Node-kind: dir +Node-action: add +Node-copyfrom-rev: 13 +Node-copyfrom-path: tags/also-edit
--- a/tests/test_tags.py +++ b/tests/test_tags.py @@ -114,8 +114,8 @@ class TestTags(test_util.TestBase): repo[alsoedit].extra(), {'close': '1', 'branch': 'magic', - 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/also-edit@13'}) - self.assertEqual(alsoedit, repo.tags()['also-edit']) + 'convert_revision': 'svn:af82cc90-c2d2-43cd-b1aa-c8a78449440a/tags/also-edit@14'}) + self.assertEqual(repo[alsoedit].parents()[0].node(), repo.tags()['also-edit']) self.assertEqual(repo['also-edit'].manifest().keys(), ['beta', '.hgtags',