Patchwork [2,of,4,evolve-ext,V2] rewrite: use cmdutil.logmessage instead of ad-hoc methods

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date April 14, 2014, 8:48 p.m.
Message ID <da022f9236b1f51392ab.1397508523@Iris>
Download mbox | patch
Permalink /patch/4346/
State Deferred
Headers show

Comments

Jordi Gutiérrez Hermoso - April 14, 2014, 8:48 p.m.
# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh@octave.org>
# Date 1397502629 14400
#      Mon Apr 14 15:10:29 2014 -0400
# Branch stable
# Node ID da022f9236b1f51392ab1cc6d24a234969c9ee9f
# Parent  78f1235e788787648d82a3b4c6527bf6a85ddd57
rewrite: use cmdutil.logmessage instead of ad-hoc methods

The logic for handling the --message and --logfile options is already
in core hg in the cmdutil.logmessage function. This patch removes this
duplicate logic from Evolve and just calls the core function.
Pierre-Yves David - April 23, 2014, 12:47 a.m.
On 04/14/2014 01:48 PM, Jordi Gutiérrez Hermoso wrote:
> # HG changeset patch
> # User Jordi Gutiérrez Hermoso <jordigh@octave.org>
> # Date 1397502629 14400
> #      Mon Apr 14 15:10:29 2014 -0400
> # Branch stable
> # Node ID da022f9236b1f51392ab1cc6d24a234969c9ee9f
> # Parent  78f1235e788787648d82a3b4c6527bf6a85ddd57
> rewrite: use cmdutil.logmessage instead of ad-hoc methods

This one pushed thanks

Patch

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -696,14 +696,9 @@ 
                                           copied=copied.get(path))
                 return mctx
             raise IOError()
-        if commitopts.get('message') and commitopts.get('logfile'):
-            raise util.Abort(_('options --message and --logfile are mutually'
-                               ' exclusive'))
-        if commitopts.get('logfile'):
-            message= open(commitopts['logfile']).read()
-        elif commitopts.get('message'):
-            message = commitopts['message']
-        else:
+
+        message = cmdutil.logmessage(repo.ui, commitopts)
+        if not message:
             message = old.description()
 
         user = commitopts.get('user') or old.user()