diff -r 80628d4069be hgext/convert/__init__.py --- a/hgext/convert/__init__.py Fri Jan 31 01:12:35 2014 -0800 +++ b/hgext/convert/__init__.py Thu Feb 13 19:14:32 2014 +1100 @@ -85,6 +85,9 @@ Empty lines and lines starting with a ``#`` are ignored. + The authormapsuffix can be used to append set text to each + post-authormap-translated author name. + The filemap is a file that allows filtering and remapping of files and directories. Each line can contain one of the following directives:: @@ -321,6 +324,8 @@ _('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')), ('', 'splicemap', '', diff -r 80628d4069be hgext/convert/convcmd.py --- a/hgext/convert/convcmd.py Fri Jan 31 01:12:35 2014 -0800 +++ b/hgext/convert/convcmd.py Thu Feb 13 19:14:32 2014 +1100 @@ -103,12 +103,15 @@ 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): @@ -393,7 +396,7 @@ 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)) @@ -407,7 +410,8 @@ 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) # If commit.branch is None, this commit is coming from the source # repository's default branch and destined for the default branch in the # destination repository. For such commits, passing a literal "None" diff -r 80628d4069be tests/test-convert-authormap.t --- a/tests/test-convert-authormap.t Fri Jan 31 01:12:35 2014 -0800 +++ b/tests/test-convert-authormap.t Thu Feb 13 19:14:32 2014 +1100 @@ -10,6 +10,8 @@ $ cd orig $ echo foo > foo $ HGUSER='user name' hg ci -qAm 'foo' + $ echo bar > bar + $ HGUSER='user name 2' hg ci -qAm 'bar' $ cd .. Explicit --authors @@ -26,13 +28,19 @@ scanning source... sorting... converting... - 0 foo + 1 foo + 0 bar writing author map file $TESTTMP/new/.hg/authormap (glob) $ cat new/.hg/authormap user name=Long User Name $ hg -Rnew log + changeset: 1:263e7765e4b7 + tag: tip + user: user name 2 + date: Thu Jan 01 00:00:00 1970 +0000 + summary: bar + changeset: 0:d89716e88087 - tag: tip user: Long User Name date: Thu Jan 01 00:00:00 1970 +0000 summary: foo @@ -48,11 +56,72 @@ scanning source... sorting... converting... - 0 foo + 1 foo + 0 bar $ hg -Rnew log + changeset: 1:263e7765e4b7 + tag: tip + user: user name 2 + date: Thu Jan 01 00:00:00 1970 +0000 + summary: bar + changeset: 0:d89716e88087 - tag: tip user: Long User Name date: Thu Jan 01 00:00:00 1970 +0000 summary: foo + $ rm -rf new + +Use authormapsuffix together with authormap + + $ cat > authormap.txt < user name = username + > user name 2 = username2 + > EOF + $ hg convert --authormap authormap.txt --authormapsuffix '@test.org' orig new + initializing destination new repository + scanning source... + sorting... + converting... + 1 foo + 0 bar + writing author map file $TESTTMP/new/.hg/authormap + $ cat new/.hg/authormap + user name 2=username2@test.org + user name=username@test.org + $ hg -Rnew log + changeset: 1:aeeaab422b32 + tag: tip + user: username2@test.org + date: Thu Jan 01 00:00:00 1970 +0000 + summary: bar + + changeset: 0:51317d63da9e + user: username@test.org + date: Thu Jan 01 00:00:00 1970 +0000 + summary: foo + + $ rm -rf new + +Use authormapsuffix stand alone + + $ hg convert --authormapsuffix '@test.org' orig new + initializing destination new repository + scanning source... + sorting... + converting... + 1 foo + 0 bar + $ hg -Rnew log + changeset: 1:94e0dcfe3b0d + tag: tip + user: user name 2@test.org + date: Thu Jan 01 00:00:00 1970 +0000 + summary: bar + + changeset: 0:e2ff155c86b8 + user: user name@test.org + date: Thu Jan 01 00:00:00 1970 +0000 + summary: foo + +