[PATCH 1 of 2 convert backouts] convert: backout b75a04502ced and 9616b03113ce - tagmap
Mads Kiilerich
mads at kiilerich.com
Wed Apr 16 11:05:41 CDT 2014
# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1397603389 -7200
# Wed Apr 16 01:09:49 2014 +0200
# Node ID 319a4229e58fba95bea881cba07a62a726723227
# Parent d0cc92ba0406cb2b766165d7d82909287564f9ce
convert: backout b75a04502ced and 9616b03113ce - tagmap
Tagmap solves a very specific use case. It would be better to have a more
generic solution than to have to maintain this forever.
Tagmap has not been released yet and removing it now will not break any
backward compatibility contract.
There is no test coverage for tagmap but it seems like the same can be achieved
with a (relatively) simple and much more powerful custom extension:
import hgext.convert.hg
def f(tag):
return tag.replace('some', 'other')
class source(hgext.convert.hg.mercurial_source):
def gettags(self):
return dict((f(tag), node)
for tag, node in in super(source, self).gettags().items())
def getfile(self, name, rev):
data, flags = super(source, self).getfile(name, rev)
if name == '.hgtags':
data = ''.join(l[:41] + f(l[41:]) + '\n' for l in data.splitlines())
return data, flags
hgext.convert.hg.mercurial_source = source
diff --git a/hgext/convert/__init__.py b/hgext/convert/__init__.py
--- a/hgext/convert/__init__.py
+++ b/hgext/convert/__init__.py
@@ -146,10 +146,6 @@ def convert(ui, src, dest=None, revmapfi
you want to close a branch. Each entry contains a revision or hash
separated by white space.
- The tagmap is a file that exactly analogous to the branchmap. This will
- rename tags on the fly and prevent the 'update tags' commit usually found
- at the end of a convert process.
-
Mercurial Source
################
@@ -330,8 +326,6 @@ cmdtable = {
_('change branch names while converting'), _('FILE')),
('', 'closemap', '',
_('closes given revs'), _('FILE')),
- ('', 'tagmap', '',
- _('change tag names while converting'), _('FILE')),
('', 'branchsort', None, _('try to sort changesets by branches')),
('', 'datesort', None, _('try to sort changesets by date')),
('', 'sourcesort', None, _('preserve source changesets order')),
diff --git a/hgext/convert/common.py b/hgext/convert/common.py
--- a/hgext/convert/common.py
+++ b/hgext/convert/common.py
@@ -204,8 +204,7 @@ class converter_sink(object):
mapping equivalent authors identifiers for each system."""
return None
- def putcommit(self, files, copies, parents, commit, source,
- revmap, tagmap):
+ def putcommit(self, files, copies, parents, commit, source, revmap):
"""Create a revision with all changed files listed in 'files'
and having listed parents. 'commit' is a commit object
containing at a minimum the author, date, and message for this
diff --git a/hgext/convert/convcmd.py b/hgext/convert/convcmd.py
--- a/hgext/convert/convcmd.py
+++ b/hgext/convert/convcmd.py
@@ -121,7 +121,6 @@ class converter(object):
self.splicemap = self.parsesplicemap(opts.get('splicemap'))
self.branchmap = mapfile(ui, opts.get('branchmap'))
self.closemap = self.parseclosemap(opts.get('closemap'))
- self.tagmap = mapfile(ui, opts.get('tagmap'))
def parseclosemap(self, path):
""" check and validate the closemap format and
@@ -449,7 +448,7 @@ class converter(object):
commit.extra['close'] = 1
newnode = self.dest.putcommit(files, copies, parents, commit,
- source, self.map, self.tagmap)
+ source, self.map)
source.close()
self.source.converted(rev, newnode)
self.map[rev] = newnode
@@ -485,9 +484,6 @@ class converter(object):
self.ui.progress(_('converting'), None)
tags = self.source.gettags()
- tags = dict((self.tagmap.get(k, k), v)
- for k, v in tags.iteritems())
-
ctags = {}
for k in tags:
v = tags[k]
diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py
--- a/hgext/convert/hg.py
+++ b/hgext/convert/hg.py
@@ -116,7 +116,7 @@ class mercurial_sink(converter_sink):
self.repo.pull(prepo, [prepo.lookup(h) for h in heads])
self.before()
- def _rewritetags(self, source, revmap, tagmap, data):
+ def _rewritetags(self, source, revmap, data):
fp = cStringIO.StringIO()
for line in data.splitlines():
s = line.split(' ', 1)
@@ -125,18 +125,17 @@ class mercurial_sink(converter_sink):
revid = revmap.get(source.lookuprev(s[0]))
if not revid:
continue
- fp.write('%s %s\n' % (revid, tagmap.get(s[1], s[1])))
+ fp.write('%s %s\n' % (revid, s[1]))
return fp.getvalue()
- def putcommit(self, files, copies, parents, commit, source,
- revmap, tagmap):
+ def putcommit(self, files, copies, parents, commit, source, revmap):
files = dict(files)
def getfilectx(repo, memctx, f):
v = files[f]
data, mode = source.getfile(f, v)
if f == '.hgtags':
- data = self._rewritetags(source, revmap, tagmap, data)
+ data = self._rewritetags(source, revmap, data)
return context.memfilectx(f, data, 'l' in mode, 'x' in mode,
copies.get(f))
diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py
--- a/hgext/convert/subversion.py
+++ b/hgext/convert/subversion.py
@@ -1227,8 +1227,7 @@ class svn_sink(converter_sink, commandli
def revid(self, rev):
return u"svn:%s@%s" % (self.uuid, rev)
- def putcommit(self, files, copies, parents, commit, source,
- revmap, tagmap):
+ def putcommit(self, files, copies, parents, commit, source, revmap):
for parent in parents:
try:
return self.revid(self.childmap[parent])
diff --git a/tests/test-convert.t b/tests/test-convert.t
--- a/tests/test-convert.t
+++ b/tests/test-convert.t
@@ -126,10 +126,6 @@
you want to close a branch. Each entry contains a revision or hash
separated by white space.
- The tagmap is a file that exactly analogous to the branchmap. This will
- rename tags on the fly and prevent the 'update tags' commit usually found
- at the end of a convert process.
-
Mercurial Source
################
@@ -276,7 +272,6 @@
--splicemap FILE splice synthesized history into place
--branchmap FILE change branch names while converting
--closemap FILE closes given revs
- --tagmap FILE change tag names while converting
--branchsort try to sort changesets by branches
--datesort try to sort changesets by date
--sourcesort preserve source changesets order
More information about the Mercurial-devel
mailing list