summaryrefslogtreecommitdiff
path: root/devel/mercurial/files/extra-patch-authormapsuffix
blob: 1af2f7dcfccf0ca7cb3abde7aa1f90493a6b8904 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
--- 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