[PATCH 2 of 3 STABLE?] cmdutil: make commitforceeditor accept callable editform
FUJIWARA Katsunori
foozy at lares.dti.ne.jp
Fri Nov 13 12:46:24 CST 2015
# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1447437921 -32400
# Sat Nov 14 03:05:21 2015 +0900
# Branch stable
# Node ID 24e29f6c10ed52935786e394954e01af8b0e258b
# Parent 98381200f4c2516f7d04a550881ae92371f890f9
cmdutil: make commitforceeditor accept callable editform
This is a preparation of subsequent patch, which delays examination of
dirstate parents until editor invocation inside wlock scope for
safety.
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -363,8 +363,9 @@ def getcommiteditor(edit=False, finishde
'Leave message empty to abort commit' line. 'HG: ' prefix and EOL
is automatically added.
- 'editform' is a dot-separated list of names, to distinguish
- the purpose of commit text editing.
+ 'editform' is a dot-separated list of names (or the callable
+ object to get it), to distinguish the purpose of commit text
+ editing.
'getcommiteditor' returns 'commitforceeditor' regardless of
'edit', if one of 'finishdesc' or 'extramsg' is specified, because
@@ -2698,6 +2699,8 @@ def commitforceeditor(repo, ctx, subs, f
editform='', unchangedmessagedetection=False):
if not extramsg:
extramsg = _("Leave message empty to abort commit.")
+ if callable(editform):
+ editform = editform()
forms = [e for e in editform.split('.') if e]
forms.insert(0, 'changeset')
More information about the Mercurial-devel
mailing list