Mercurial > hg
comparison mercurial/cmdutil.py @ 45264: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 | a56ba57c837d |
children | e58e234096de |
comparison
equal
deleted
inserted
replaced
45263:b7444cfc2c05 | 45264:8cce9f77ca73 |
---|---|
3373 return text | 3373 return text |
3374 | 3374 |
3375 | 3375 |
3376 def buildcommittemplate(repo, ctx, subs, extramsg, ref): | 3376 def buildcommittemplate(repo, ctx, subs, extramsg, ref): |
3377 ui = repo.ui | 3377 ui = repo.ui |
3378 spec = formatter.templatespec(ref, None, None) | 3378 spec = formatter.reference_templatespec(ref) |
3379 t = logcmdutil.changesettemplater(ui, repo, spec) | 3379 t = logcmdutil.changesettemplater(ui, repo, spec) |
3380 t.t.cache.update( | 3380 t.t.cache.update( |
3381 (k, templater.unquotestring(v)) | 3381 (k, templater.unquotestring(v)) |
3382 for k, v in repo.ui.configitems(b'committemplate') | 3382 for k, v in repo.ui.configitems(b'committemplate') |
3383 ) | 3383 ) |