[PATCH evolve-ext] amend: allow the --logfile argument to work properly

Matt Harbison matt_harbison at yahoo.com
Sat Oct 25 21:38:42 CDT 2014


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1414290342 14400
#      Sat Oct 25 22:25:42 2014 -0400
# Node ID 97ac52bf79b356d044987fb2ed09f35283628d74
# Parent  07ccf868dfe1720fcf1faa1eeb7f8b11273d8f25
amend: allow the --logfile argument to work properly

Though documented to work, using --logfile previously set the message option to
that of the parent commit, and cause amend to abort with this message:

    abort: options --message and --logfile are mutually exclusive

It's not clear why the 'edit' option is popped, but this option is only fetched
in order to let the core commit command do the work.

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -1825,8 +1825,9 @@
     """
     opts = opts.copy()
     edit = opts.pop('edit', False)
+    log = opts.get('logfile')
     opts['amend'] = True
-    if not (edit or opts['message']):
+    if not (edit or opts['message'] or log):
         opts['message'] = repo['.'].description()
     _resolveoptions(ui, opts)
     _alias, commitcmd = cmdutil.findcmd('commit', commands.table)
diff --git a/tests/test-amend.t b/tests/test-amend.t
--- a/tests/test-amend.t
+++ b/tests/test-amend.t
@@ -97,3 +97,9 @@
   $ HGUSER=newbie hg amend -U
   $ hg parents --template '{rev}  {author}\n'
   7  newbie
+
+Check that --logfile works
+  $ echo "logfile message" > logfile.txt
+  $ hg amend -l logfile.txt
+  $ hg log -r . -T "{desc}\n"
+  logfile message


More information about the Mercurial-devel mailing list