Mercurial > public > mercurial-scm > evolve
diff hgext/evolve.py @ 933:e5baeb8fefec stable
fold: add --message and --logfile options
Like other commit-creating commands, this add two options for
specifying the resulting commit message, with tests. If either of
these options is specified, no editor is popped up asking for a commit
message.
author | Jordi Guti?rrez Hermoso <jordigh@octave.org> |
---|---|
date | Mon, 14 Apr 2014 15:46:27 -0400 |
parents | 32915143d448 |
children | f13facb01ac5 |
line wrap: on
line diff
--- a/hgext/evolve.py Thu Jan 09 11:33:15 2014 +0100 +++ b/hgext/evolve.py Mon Apr 14 15:46:27 2014 -0400 @@ -1773,7 +1773,7 @@ @command('^fold', [('r', 'rev', [], _("explicitly specify the full set of revision to fold")), - ] + commitopts2, + ] + commitopts + commitopts2, # allow to choose the seed ? _('rev')) def fold(ui, repo, *revs, **opts): @@ -1817,11 +1817,16 @@ commitopts = opts.copy() 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 + + if commitopts.get('message') or commitopts.get('logfile'): + 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)