D5742: histedit: add templating support to histedit's rule file generation
yuja (Yuya Nishihara)
phabricator at mercurial-scm.org
Fri Feb 1 20:50:40 EST 2019
yuja added a comment.
Queued, thanks.
> +++ b/mercurial/help.py
> @@ -394,7 +394,17 @@
>
> def addtopichook(topic, rewriter):
> helphooks.setdefault(topic, []).append(rewriter)
>
>
> -def makeitemsdoc(ui, topic, doc, marker, items, dedent=False):
> +def _templateextsyms(ui, topic, doc):
> + for name, ext in extensions.extensions(ui):
> + kw = getattr(ext, 'templatekeyword', None)
> + if kw is not None:
> + doc = addtopicsymbols(
> + 'templates', 'Filters\n=======', kw, keepmarker=True)
> + return doc
> +
> +addtopichook('templating', _templateextsyms)
> +
> +def makeitemsdoc(ui, topic, doc, marker, items, dedent=False, keepmarker=False):
>
> """Extract docstring from the items key to function mapping, build a
> single documentation block and use it to overwrite the marker in doc.
> """
>
> @@ -420,11 +430,14 @@
>
> doclines.append(' ' + l.strip())
> entries.append('\n'.join(doclines))
> entries = '\n\n'.join(entries)
>
> + if keepmarker:
> + entries = entries + '\n\n' + marker
>
> return doc.replace(marker, entries)
>
>
> -def addtopicsymbols(topic, marker, symbols, dedent=False):
> +def addtopicsymbols(topic, marker, symbols, dedent=False, keepmarker=False):
>
> def add(ui, topic, doc):
>
> - return makeitemsdoc(ui, topic, doc, marker, symbols, dedent=dedent) + return makeitemsdoc(ui, topic, doc, marker, symbols, dedent=dedent, + keepmarker=keepmarker)
Looks like unrelated change. Dropped.
> + summary = cmdutil.rendertemplate(
> + ctx, ui.config('histedit', 'summary-template')) or ''
> + summary = summary.splitlines()[0]
Still crash. `''.splitlines() == []`
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D5742
To: durin42, #hg-reviewers
Cc: yuja, mercurial-devel
More information about the Mercurial-devel
mailing list