Mercurial > public > mercurial-scm > hg
diff mercurial/cmdutil.py @ 22012:9d92b9d1e282
cmdutil: look commit template definition up by specified 'editform'
Before this patch, '[committemplate] changeset' definition is shared
between all actions invoking 'commitforceeditor()'.
This prevents template definition from showing action specific
messages: for example, 'hg tag --remove' may need specific
message to call attention, but showing it may be redundant for
other actions.
This patch looks commit template definition up by specified
'editform' introduced by prior patches. 'editform' are
dot-separated list of names, and treated as hierarchical one.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Sat, 02 Aug 2014 21:46:27 +0900 |
parents | 97acb4504704 |
children | de5cee8ba088 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Sat Aug 02 21:46:27 2014 +0900 +++ b/mercurial/cmdutil.py Sat Aug 02 21:46:27 2014 +0900 @@ -2193,9 +2193,15 @@ editform=''): if not extramsg: extramsg = _("Leave message empty to abort commit.") - tmpl = repo.ui.config('committemplate', 'changeset', '').strip() - if tmpl: - committext = buildcommittemplate(repo, ctx, subs, extramsg, tmpl) + + forms = [e for e in editform.split('.') if e] + forms.insert(0, 'changeset') + while forms: + tmpl = repo.ui.config('committemplate', '.'.join(forms)) + if tmpl: + committext = buildcommittemplate(repo, ctx, subs, extramsg, tmpl) + break + forms.pop() else: committext = buildcommittext(repo, ctx, subs, extramsg)