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
--- a/hgext/convert/__init__.py Tue Apr 15 11:53:10 2014 -0400
+++ b/hgext/convert/__init__.py Wed Apr 16 01:09:49 2014 +0200
@@ -146,10 +146,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
################
@@ -330,8 +326,6 @@
_('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')),
--- a/hgext/convert/common.py Tue Apr 15 11:53:10 2014 -0400
+++ b/hgext/convert/common.py Wed Apr 16 01:09:49 2014 +0200
@@ -204,8 +204,7 @@
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
--- a/hgext/convert/convcmd.py Tue Apr 15 11:53:10 2014 -0400
+++ b/hgext/convert/convcmd.py Wed Apr 16 01:09:49 2014 +0200
@@ -121,7 +121,6 @@
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 @@
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 @@
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]
--- a/hgext/convert/hg.py Tue Apr 15 11:53:10 2014 -0400
+++ b/hgext/convert/hg.py Wed Apr 16 01:09:49 2014 +0200
@@ -116,7 +116,7 @@
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 @@
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))
--- a/hgext/convert/subversion.py Tue Apr 15 11:53:10 2014 -0400
+++ b/hgext/convert/subversion.py Wed Apr 16 01:09:49 2014 +0200
@@ -1227,8 +1227,7 @@
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])
--- a/tests/test-convert.t Tue Apr 15 11:53:10 2014 -0400
+++ b/tests/test-convert.t Wed Apr 16 01:09:49 2014 +0200
@@ -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