histedit: fix rollup prompting for a commit message (issue4606)
Commit 090da03361c5 broke histedit's rollup by causing it to open the editor.
Turns out I missed a spot where the rollup option was read.
This fixes that and adjusts the test to catch this case.
--- a/hgext/histedit.py Mon Apr 20 13:43:10 2015 -0400
+++ b/hgext/histedit.py Mon Apr 20 18:44:57 2015 -0700
@@ -413,7 +413,7 @@
repo.ui.setconfig('ui', 'forcemerge', '', 'histedit')
return stats
-def collapse(repo, first, last, commitopts):
+def collapse(repo, first, last, commitopts, skipprompt=False):
"""collapse the set of revisions from first to last as new one.
Expected commit options are:
@@ -474,7 +474,7 @@
parents = (first.p1().node(), first.p2().node())
editor = None
- if not commitopts.get('rollup'):
+ if not skipprompt:
editor = cmdutil.getcommiteditor(edit=True, editform='histedit.fold')
new = context.memctx(repo,
parents=parents,
@@ -575,7 +575,8 @@
try:
phasemin = max(ctx.phase(), oldctx.phase())
repo.ui.setconfig('phases', 'new-commit', phasemin, 'histedit')
- n = collapse(repo, ctx, repo[newnode], commitopts)
+ n = collapse(repo, ctx, repo[newnode], commitopts,
+ skipprompt=self.skipprompt())
finally:
repo.ui.restoreconfig(phasebackup)
if n is None:
--- a/tests/test-histedit-fold.t Mon Apr 20 13:43:10 2015 -0400
+++ b/tests/test-histedit-fold.t Mon Apr 20 18:44:57 2015 -0700
@@ -107,6 +107,8 @@
rollup will fold without preserving the folded commit's message
+ $ OLDHGEDITOR=$HGEDITOR
+ $ HGEDITOR=false
$ hg histedit d2ae7f538514 --commands - 2>&1 <<EOF | fixbundle
> pick d2ae7f538514 b
> roll ee283cb5f2d5 e
@@ -120,6 +122,8 @@
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+ $ HGEDITOR=$OLDHGEDITOR
+
log after edit
$ hg logt --graph
@ 3:c4a9eb7989fc d