changeset 22206:6122ad50e38f

rebase: use "rebase.collapse" as "editform" for "--collapse" always Before this patch, if both "--message" and "--collapse" are specified for "hg rebase", "rebaes.normal" is used as "editform" unexpectedly. Unlike patches before and after in this series for improvement, this is bug fix patch.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Fri, 15 Aug 2014 23:05:53 +0900
parents 9fa429723f26
children 8dda6f6ff564
files hgext/rebase.py tests/test-rebase-collapse.t
diffstat 2 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Fri Aug 15 23:05:53 2014 +0900
+++ b/hgext/rebase.py	Fri Aug 15 23:05:53 2014 +0900
@@ -376,6 +376,8 @@
         if collapsef and not keepopen:
             p1, p2 = defineparents(repo, min(state), target,
                                                         state, targetancestors)
+            editopt = opts.get('edit')
+            editform = 'rebase.collapse'
             if collapsemsg:
                 commitmsg = collapsemsg
             else:
@@ -383,8 +385,8 @@
                 for rebased in state:
                     if rebased not in skipped and state[rebased] > nullmerge:
                         commitmsg += '\n* %s' % repo[rebased].description()
-                editform = 'rebase.collapse'
-                editor = cmdutil.getcommiteditor(edit=True, editform=editform)
+                editopt = True
+            editor = cmdutil.getcommiteditor(edit=editopt, editform=editform)
             newrev = concludenode(repo, rev, p1, external, commitmsg=commitmsg,
                                   extrafn=extrafn, editor=editor)
             for oldrev in state.iterkeys():
--- a/tests/test-rebase-collapse.t	Fri Aug 15 23:05:53 2014 +0900
+++ b/tests/test-rebase-collapse.t	Fri Aug 15 23:05:53 2014 +0900
@@ -148,7 +148,12 @@
   abort: message can only be specified with collapse
   [255]
 
-  $ hg rebase --source 4 --collapse -m 'custom message'
+  $ cat > $TESTTMP/checkeditform.sh <<EOF
+  > env | grep HGEDITFORM
+  > true
+  > EOF
+  $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg rebase --source 4 --collapse -m 'custom message' -e
+  HGEDITFORM=rebase.collapse
   saved backup bundle to $TESTTMP/a3/.hg/strip-backup/*-backup.hg (glob)
 
   $ hg tglog