[PATCH STABLE] histedit: fix rollup prompting for a commit message (issue4606)

Durham Goode durham at fb.com
Tue Apr 21 01:54:15 UTC 2015


# HG changeset patch
# User Durham Goode <durham at fb.com>
# Date 1429580697 25200
#      Mon Apr 20 18:44:57 2015 -0700
# Branch stable
# Node ID 1c924e354ed90f0dc9ea3eee05ce2cc7ae03177d
# Parent  9b02b678888ed7b600e94bca0613e800bbe29dee
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.

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -413,7 +413,7 @@ def applychanges(ui, repo, ctx, opts):
             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 @@ def collapse(repo, first, last, commitop
 
     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 @@ class fold(histeditaction):
         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:
diff --git a/tests/test-histedit-fold.t b/tests/test-histedit-fold.t
--- a/tests/test-histedit-fold.t
+++ b/tests/test-histedit-fold.t
@@ -107,6 +107,8 @@ check histedit_source
 
 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 @@ rollup will fold without preserving the 
   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


More information about the Mercurial-devel mailing list