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

login
register
mail settings
Submitter Matt Harbison
Date Oct. 26, 2014, 2:38 a.m.
Message ID <97ac52bf79b356d04498.1414291122@Envy>
Download mbox | patch
Permalink /patch/6467/
State Accepted
Headers show

Comments

Matt Harbison - Oct. 26, 2014, 2:38 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@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.
Pierre-Yves David - Oct. 26, 2014, 11:11 a.m.
On 10/26/2014 03:38 AM, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@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

pushed to main, much thanks.

Patch

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