rewrite: use cmdutil.logmessage instead of ad-hoc methods
authorJordi Gutiérrez Hermoso <jordigh@octave.org>
Mon, 14 Apr 2014 15:10:29 -0400
changeset 909 ff71b83a4bbe
parent 908 06100fbc05e5
child 919 ffce88754767
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.
hgext/evolve.py
--- a/hgext/evolve.py	Fri Apr 11 19:24:29 2014 -0400
+++ b/hgext/evolve.py	Mon Apr 14 15:10:29 2014 -0400
@@ -753,14 +753,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()