Page MenuHomePhabricator

templatespec: create a factory function for each type there is
ClosedPublic

Authored by martinvonz on Wed, Jul 29, 2:38 PM.

Details

Summary

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.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

martinvonz created this revision.Wed, Jul 29, 2:38 PM
martinvonz added inline comments.Wed, Jul 29, 3:23 PM
mercurial/formatter.py
582

Is unspecified_templatespec() better? Or maybe plain_templatespec()? It seems to result in a plainformatter getting used.

indygreg accepted this revision.Sun, Aug 2, 12:14 PM
indygreg added a subscriber: indygreg.
indygreg added inline comments.
mercurial/formatter.py
582

Naming is hard. I won't let this hold up review.

This revision is now accepted and ready to land.Sun, Aug 2, 12:14 PM