From patchwork Mon Apr 14 20:48:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [2, of, 4, evolve-ext, V2] rewrite: use cmdutil.logmessage instead of ad-hoc methods From: =?utf-8?q?Jordi_Guti=C3=A9rrez_Hermoso?= X-Patchwork-Id: 4346 Message-Id: To: mercurial-devel@selenic.com Date: Mon, 14 Apr 2014 16:48:43 -0400 # HG changeset patch # User Jordi GutiƩrrez Hermoso # 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()