ports/devel/mercurial/files/extra-patch-authormapsuffix

47 lines
2.1 KiB
Text

--- hgext/convert/__init__.py.orig 2015-07-18 22:33:53 UTC
+++ hgext/convert/__init__.py
@@ -31,6 +31,7 @@ testedwith = 'internal'
('d', 'dest-type', '', _('destination repository type'), _('TYPE')),
('r', 'rev', [], _('import up to source revision REV'), _('REV')),
('A', 'authormap', '', _('remap usernames using this file'), _('FILE')),
+ ('', 'authormapsuffix', '', _('append this suffix to remapped author names'), _('SUFFIX')),
('', 'filemap', '', _('remap file names using contents of file'),
_('FILE')),
('', 'full', None,
--- hgext/convert/convcmd.py.orig 2015-07-18 22:33:53 UTC
+++ hgext/convert/convcmd.py
@@ -136,12 +136,16 @@ class converter(object):
self.commitcache = {}
self.authors = {}
self.authorfile = None
+ self.authormapsuffix = ''
# Record converted revisions persistently: maps source revision
# ID to target revision ID (both strings). (This is how
# incremental conversions work.)
self.map = mapfile(ui, revmapfile)
+ if opts.get('authormapsuffix'):
+ self.authormapsuffix = opts.get('authormapsuffix')
+
# Read first the dst author map if any
authorfile = self.dest.authorfile()
if authorfile and os.path.exists(authorfile):
@@ -395,7 +399,7 @@ class converter(object):
continue
srcauthor = srcauthor.strip()
- dstauthor = dstauthor.strip()
+ dstauthor = dstauthor.strip() + self.authormapsuffix
if self.authors.get(srcauthor) in (None, dstauthor):
msg = _('mapping author %s to %s\n')
self.ui.debug(msg % (srcauthor, dstauthor))
@@ -409,7 +413,7 @@ class converter(object):
def cachecommit(self, rev):
commit = self.source.getcommit(rev)
- commit.author = self.authors.get(commit.author, commit.author)
+ commit.author = self.authors.get(commit.author, commit.author + self.authormapsuffix)
commit.branch = mapbranch(commit.branch, self.branchmap)
self.commitcache[rev] = commit
return commit