Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
22011:97acb4504704 | 22012:9d92b9d1e282 |
---|---|
2191 | 2191 |
2192 def commitforceeditor(repo, ctx, subs, finishdesc=None, extramsg=None, | 2192 def commitforceeditor(repo, ctx, subs, finishdesc=None, extramsg=None, |
2193 editform=''): | 2193 editform=''): |
2194 if not extramsg: | 2194 if not extramsg: |
2195 extramsg = _("Leave message empty to abort commit.") | 2195 extramsg = _("Leave message empty to abort commit.") |
2196 tmpl = repo.ui.config('committemplate', 'changeset', '').strip() | 2196 |
2197 if tmpl: | 2197 forms = [e for e in editform.split('.') if e] |
2198 committext = buildcommittemplate(repo, ctx, subs, extramsg, tmpl) | 2198 forms.insert(0, 'changeset') |
2199 while forms: | |
2200 tmpl = repo.ui.config('committemplate', '.'.join(forms)) | |
2201 if tmpl: | |
2202 committext = buildcommittemplate(repo, ctx, subs, extramsg, tmpl) | |
2203 break | |
2204 forms.pop() | |
2199 else: | 2205 else: |
2200 committext = buildcommittext(repo, ctx, subs, extramsg) | 2206 committext = buildcommittext(repo, ctx, subs, extramsg) |
2201 | 2207 |
2202 # run editor in the repository root | 2208 # run editor in the repository root |
2203 olddir = os.getcwd() | 2209 olddir = os.getcwd() |