mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 09:17:30 +03:00
7b8cb0004c
Upstream 608e426d0577d44f4d5030dc6d71e57d691ca3da changed the API. Now template ref should be passed instead of template itself. This diff fixes it.
46 lines
1.1 KiB
Python
46 lines
1.1 KiB
Python
from mercurial import (
|
|
cmdutil,
|
|
context,
|
|
error,
|
|
registrar,
|
|
)
|
|
from mercurial.i18n import _
|
|
|
|
cmdtable = {}
|
|
command = registrar.command(cmdtable)
|
|
|
|
@command('debugcommitmessage', [], _('FORM'))
|
|
def debugcommitmessage(ui, repo, *args):
|
|
form = None
|
|
if len(args) > 1:
|
|
raise error.Abort(_('provide at most one form'))
|
|
elif len(args) > 0:
|
|
form = args[0]
|
|
|
|
status = repo.status()
|
|
text = ''
|
|
user = None
|
|
date = None
|
|
extra = None
|
|
|
|
ctx = context.workingcommitctx(repo, status, text, user, date, extra)
|
|
|
|
subs = []
|
|
editform = form or 'commit.normal.normal'
|
|
extramsg = _('Leave message empty to abort commit.')
|
|
|
|
forms = [e for e in editform.split('.') if e]
|
|
forms.insert(0, 'changeset')
|
|
while forms:
|
|
ref = '.'.join(forms)
|
|
tmpl = repo.ui.config('committemplate', ref)
|
|
if tmpl:
|
|
committext = cmdutil.buildcommittemplate(
|
|
repo, ctx, subs, extramsg, ref)
|
|
break
|
|
forms.pop()
|
|
else:
|
|
committext = cmdutil.buildcommittext(repo, ctx, subs, extramsg)
|
|
|
|
ui.status(committext)
|