Mercurial > public > mercurial-scm > hg-stable
diff hgext/patchbomb.py @ 45288:8cce9f77ca73
templatespec: create a factory function for each type there is
Most of the arguments to the `templatespec` constructor are mutually
exclusive, so each combination creates a different type of
templatespec. Let's clarify that by creating factory functions.
I've left the callers in `logcmdutil` unchanged for now because they
are more complex and `logcmdutil.templatespec()` is slightly higher
level in that it is specific to changesets.
My larger goal is to add support frozen binaries (specifically
PyOxidizer) by adding a specific type of `templatespec` for built-in
templates. That will get its own factory function.
Differential Revision: https://phab.mercurial-scm.org/D8845
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 16 Jul 2020 13:33:46 -0700 |
parents | 3781da40eaa6 |
children | 89a2afe31e82 |
line wrap: on
line diff
--- a/hgext/patchbomb.py Wed Jul 29 10:42:09 2020 -0700 +++ b/hgext/patchbomb.py Thu Jul 16 13:33:46 2020 -0700 @@ -207,7 +207,7 @@ if not tmpl: return b' '.join(flags) out = util.stringio() - spec = formatter.templatespec(b'', templater.unquotestring(tmpl), None) + spec = formatter.literal_templatespec(templater.unquotestring(tmpl)) with formatter.templateformatter(ui, out, b'patchbombflag', {}, spec) as fm: fm.startitem() fm.context(ctx=repo[rev])