# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1397504787 14400 # Node ID e5baeb8fefec71abf72849d30f00836a10492644 # Parent 32915143d448f8dadb1f6ea2132f041ec79b2351 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. diff -r 32915143d448 -r e5baeb8fefec README --- a/README Thu Jan 09 11:33:15 2014 +0100 +++ b/README Mon Apr 14 15:46:27 2014 -0400 @@ -53,6 +53,7 @@ (fix issues #16, #35 and #42) - adds a --obsolete flag to import (requieres Mercurial 3.0) - prune: update to successor rather than parent when pruning '.' with -s +- fold: add missing --message and --logfile option 3.3.1 -- 2014-04-23 diff -r 32915143d448 -r e5baeb8fefec hgext/evolve.py --- 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) diff -r 32915143d448 -r e5baeb8fefec tests/test-evolve.t --- a/tests/test-evolve.t Thu Jan 09 11:33:15 2014 +0100 +++ b/tests/test-evolve.t Mon Apr 14 15:46:27 2014 -0400 @@ -675,3 +675,35 @@ A c a R a + +Test fold with commit messages + + $ cd ../work + $ hg fold .^ --message "Folding with custom commit message" + 2 changesets folded + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ glog + @ 16:e6d8dace77a1@default(draft) Folding with custom commit message + | + o 13:e9c952d5bc4b@default(draft) dansk! + | + o 7:abe98aeaaa35@default(public) another feature + | + o 6:ba0ec09b1bab@default(public) a nifty feature + | + o 0:e55e0562ee93@default(public) base + + $ cat > commit-message < A longer + > commit message + > EOF + + $ hg fold .^ --logfile commit-message + 2 changesets folded + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg qlog + 17 - 2451d817c756 A longer + commit message (draft) + 7 - abe98aeaaa35 another feature (public) + 6 - ba0ec09b1bab a nifty feature (public) + 0 - e55e0562ee93 base (public) diff -r 32915143d448 -r e5baeb8fefec tests/test-tutorial.t --- a/tests/test-tutorial.t Thu Jan 09 11:33:15 2014 +0100 +++ b/tests/test-tutorial.t Mon Apr 14 15:46:27 2014 -0400 @@ -479,6 +479,8 @@ options: -r --rev VALUE [+] explicitly specify the full set of revision to fold + -m --message TEXT use text as commit message + -l --logfile FILE read commit message from file -d --date DATE record the specified date as commit date -u --user USER record the specified user as committer