changeset 22251:d0d3e5c6eb3c

rebase: change "editform" to distinguish merge commits from others "editform" argument for "getcommiteditor" is decided according to the format below: EXTENSION[.COMMAND][.ROUTE] - EXTENSION: name of extension - COMMAND: name of command, if there are two or more commands in EXTENSION - ROUTE: name of route, if there are two or more routes in COMMAND This patch newly adds "merge" as ROUTE, to distinguish merge commits from other. This patch passes bool as "ctxorbool" to "mergeeditform", because working context has always 2 parents at this point. Dropping the second parent of non-merging commits is executed in "concludenode". Unlike other patches in this series (e.g. for "hg commit"), this patch doesn't add "normal.normal"/"normal.merge" style ROUTEs, because there is no "merge" case in "collapse" ROUTE.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sat, 16 Aug 2014 10:43:59 +0900
parents f3200bf460a8
children de783f2403c4
files hgext/rebase.py mercurial/help/config.txt tests/test-rebase-cache.t
diffstat 3 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Sat Aug 16 10:43:59 2014 +0900
+++ b/hgext/rebase.py	Sat Aug 16 10:43:59 2014 +0900
@@ -138,7 +138,6 @@
     skipped = set()
     targetancestors = set()
 
-    editor = cmdutil.getcommiteditor(editform='rebase.normal', **opts)
 
     lock = wlock = None
     try:
@@ -354,6 +353,9 @@
                     p1rev = repo[rev].p1().rev()
                     cmdutil.duplicatecopies(repo, rev, p1rev, skiprev=target)
                 if not collapsef:
+                    merging = repo[p2].rev() != nullrev
+                    editform = cmdutil.mergeeditform(merging, 'rebase')
+                    editor = cmdutil.getcommiteditor(editform=editform, **opts)
                     newrev = concludenode(repo, rev, p1, p2, extrafn=extrafn,
                                           editor=editor)
                 else:
--- a/mercurial/help/config.txt	Sat Aug 16 10:43:59 2014 +0900
+++ b/mercurial/help/config.txt	Sat Aug 16 10:43:59 2014 +0900
@@ -412,7 +412,8 @@
 - ``changeset.mq.qfold`` for :hg:`qfold`
 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
-- ``changeset.rebase.normal`` for :hg:`rebase` without ``--collapse``
+- ``changeset.rebase.merge`` for :hg:`rebase` on merges
+- ``changeset.rebase.normal`` for :hg:`rebase` on other
 - ``changeset.shelve.shelve`` for :hg:`shelve`
 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
 - ``changeset.tag.remove`` for :hg:`tag --remove`
--- a/tests/test-rebase-cache.t	Sat Aug 16 10:43:59 2014 +0900
+++ b/tests/test-rebase-cache.t	Sat Aug 16 10:43:59 2014 +0900
@@ -470,5 +470,11 @@
   o  0 A public
   
 
-  $ hg rebase --dest 7 --source 5
+  $ cat > $TESTTMP/checkeditform.sh <<EOF
+  > env | grep HGEDITFORM
+  > true
+  > EOF
+  $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg rebase --dest 7 --source 5 -e
+  HGEDITFORM=rebase.merge
+  HGEDITFORM=rebase.normal
   saved backup bundle to $TESTTMP/a3/c4/.hg/strip-backup/*-backup.hg (glob)