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

Jordi Gutiérrez Hermoso jordigh at octave.org
Mon Apr 14 15:48:43 CDT 2014


# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh at 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.

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()


More information about the Mercurial-devel mailing list