[PATCH] convert: deprecate --authors in preference for --authormap

Martin Geisler mg at lazybytes.net
Thu Sep 9 19:31:47 CDT 2010


# HG changeset patch
# User Martin Geisler <mg at lazybytes.net>
# Date 1284075254 -7200
# Node ID b5d9a08a402aa7d42861ca36705b8f52dc94a309
# Parent  6045d467abd77b8756b73c650f446ae1ef4f4810
convert: deprecate --authors in preference for --authormap

This aligns the authormap option with the other three mapping options.
The old --authors option is still supported and 'hg help convert -v'
will still show it.

diff --git a/hgext/convert/__init__.py b/hgext/convert/__init__.py
--- a/hgext/convert/__init__.py
+++ b/hgext/convert/__init__.py
@@ -70,10 +70,10 @@
     updated on each commit copied, so :hg:`convert` can be interrupted
     and can be run repeatedly to copy new commits.
 
-    The username mapping file is a simple text file that maps each
-    source commit author to a destination commit author. It is handy
-    for source SCMs that use unix logins to identify authors (eg:
-    CVS). One line per author mapping and the line format is::
+    The authormap is a simple text file that maps each source commit
+    author to a destination commit author. It is handy for source SCMs
+    that use unix logins to identify authors (eg: CVS). One line per
+    author mapping and the line format is::
 
       source author = destination author
 
@@ -275,13 +275,16 @@
     "convert":
         (convert,
          [('A', 'authors', '',
-           _('username mapping filename'), _('FILE')),
+           _('username mapping filename (DEPRECATED, use --authormap instead)'),
+           _('FILE')),
           ('s', 'source-type', '',
            _('source repository type'), _('TYPE')),
           ('d', 'dest-type', '',
            _('destination repository type'), _('TYPE')),
           ('r', 'rev', '',
            _('import up to target revision REV'), _('REV')),
+          ('', 'authormap', '',
+           _('remap usernames using this file'), _('FILE')),
           ('', 'filemap', '',
            _('remap file names using contents of file'), _('FILE')),
           ('', 'splicemap', '',
diff --git a/hgext/convert/convcmd.py b/hgext/convert/convcmd.py
--- a/hgext/convert/convcmd.py
+++ b/hgext/convert/convcmd.py
@@ -112,8 +112,8 @@
         if authorfile and os.path.exists(authorfile):
             self.readauthormap(authorfile)
         # Extend/Override with new author map if necessary
-        if opts.get('authors'):
-            self.readauthormap(opts.get('authors'))
+        if opts.get('authormap'):
+            self.readauthormap(opts.get('authormap'))
             self.authorfile = self.dest.authorfile()
 
         self.splicemap = mapfile(ui, opts.get('splicemap'))
@@ -392,6 +392,10 @@
     orig_encoding = encoding.encoding
     encoding.encoding = 'UTF-8'
 
+    # support --authors as an alias for --authormap
+    if not opts.get('authormap'):
+        opts['authormap'] = opts.get('authors')
+
     if not dest:
         dest = hg.defaultdest(src) + "-hg"
         ui.status(_("assuming destination %s\n") % dest)
diff --git a/tests/test-convert.out b/tests/test-convert.out
--- a/tests/test-convert.out
+++ b/tests/test-convert.out
@@ -51,10 +51,10 @@
     each commit copied, so "hg convert" can be interrupted and can be run
     repeatedly to copy new commits.
 
-    The username mapping file is a simple text file that maps each source
-    commit author to a destination commit author. It is handy for source SCMs
-    that use unix logins to identify authors (eg: CVS). One line per author
-    mapping and the line format is:
+    The authormap is a simple text file that maps each source commit author to
+    a destination commit author. It is handy for source SCMs that use unix
+    logins to identify authors (eg: CVS). One line per author mapping and the
+    line format is:
 
       source author = destination author
 
@@ -236,10 +236,10 @@
 
 options:
 
- -A --authors FILE      username mapping filename
  -s --source-type TYPE  source repository type
  -d --dest-type TYPE    destination repository type
  -r --rev REV           import up to target revision REV
+    --authormap FILE    remap usernames using this file
     --filemap FILE      remap file names using contents of file
     --splicemap FILE    splice synthesized history into place
     --branchmap FILE    change branch names while converting


More information about the Mercurial-devel mailing list