From patchwork Thu Mar 13 19:41:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [1,of,2,Evolve] fold: add --message and --logfile options From: =?utf-8?q?Jordi_Guti=C3=A9rrez_Hermoso?= X-Patchwork-Id: 3940 Message-Id: <196c2801544045102ce8.1394739661@Iris> To: mercurial-devel@selenic.com Date: Thu, 13 Mar 2014 15:41:01 -0400 # HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1394380515 14400 # Sun Mar 09 11:55:15 2014 -0400 # Node ID 196c2801544045102ce87b2ede3c385f1cc61138 # Parent 6cb81dbb95163806f31522a17f01cff25daf9708 fold: add --message and --logfile options This uses cmdutil.logmessage to match common usage for `hg commit`. diff --git a/hgext/evolve.py b/hgext/evolve.py --- a/hgext/evolve.py +++ b/hgext/evolve.py @@ -1929,7 +1929,7 @@ @command('^fold', [('r', 'rev', [], _("explicitly specify the full set of revision to fold")), - ], + ] + commitopts, # allow to choose the seed ? _('rev')) def fold(ui, repo, *revs, **opts): @@ -1972,11 +1972,18 @@ try: allctx = [repo[r] for r in revs] targetphase = max(c.phase() for c in allctx) - msgs = ["HG: This is a fold of %d changesets." % len(allctx)] - msgs += ["HG: Commit message of changeset %s.\n\n%s\n" % - (c.rev(), c.description()) for c in allctx] - commitopts = {'message': "\n".join(msgs)} - commitopts['edit'] = True + + message = cmdutil.logmessage(ui, opts) + if message: + commitopts = {'message': message} + commitopts['edit'] = False + else: + msgs = ["HG: This is a fold of %d changesets." % len(allctx)] + msgs += ["HG: Commit message of changeset %s.\n\n%s\n" % + (c.rev(), c.description()) for c in allctx] + commitopts = {'message': "\n".join(msgs)} + commitopts['edit'] = True + newid, _ = rewrite(repo, root, allctx, head, [root.p1().node(), root.p2().node()], commitopts=commitopts)