Patchwork [12,of,15] commit: pass 'editform' argument to 'cmdutil.getcommiteditor'

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Aug. 2, 2014, 1:02 p.m.
Message ID <4b5229fa0d792d168be3.1406984541@feefifofum>
Download mbox | patch
Permalink /patch/5239/
State Accepted
Commit 41e969cb9468d735c9eabba53e282eb3fa44df31
Headers show

Comments

Katsunori FUJIWARA - Aug. 2, 2014, 1:02 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1406983587 -32400
#      Sat Aug 02 21:46:27 2014 +0900
# Node ID 4b5229fa0d792d168be3f36d21e19b5860030221
# Parent  2fc8ca7fb013d9ea652f184243ef94f36122d73a
commit: pass 'editform' argument to 'cmdutil.getcommiteditor'

This patch passes 'editform' argument according to the format below:

  COMMAND[.ROUTE]

  - ROUTE: name of route, if there are two or more routes in COMMAND

In this patch, 'normal' and 'amend' are used as ROUTE.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2100,9 +2100,10 @@ 
 
                 user = opts.get('user') or old.user()
                 date = opts.get('date') or old.date()
-            editor = getcommiteditor(**opts)
+            editform = 'commit.amend'
+            editor = getcommiteditor(editform=editform, **opts)
             if not message:
-                editor = getcommiteditor(edit=True)
+                editor = getcommiteditor(edit=True, editform=editform)
                 message = old.description()
 
             pureextra = extra.copy()
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1449,9 +1449,11 @@ 
                     repo.baseui.setconfig('phases', 'new-commit', 'secret',
                                           'commit')
 
+                editform = 'commit.normal'
+                editor = cmdutil.getcommiteditor(editform=editform, **opts)
                 return repo.commit(message, opts.get('user'), opts.get('date'),
                                    match,
-                                   editor=cmdutil.getcommiteditor(**opts),
+                                   editor=editor,
                                    extra=extra)
             finally:
                 ui.setconfig('phases', 'new-commit', oldcommitphase, 'commit')