[PATCH 0 of 6] Extract changeset template keywords in a module

Patrick Mezard pmezard at gmail.com
Mon Nov 30 22:34:40 UTC 2009


This series of patches extracts changeset template keywords into a new templatekw module, with the following benefits:
- The keywords can easily be extended by third-party extensions. A followup will probably be my third attempt to add keywords for transplant and convert extensions records.
- The code is more legible and it's easier to find the place where keywords are implemented.

The drawback is the introduction of non-templating items in the templater map, to pass repository, changectx and cache arguments to all keywords.

Also, 'parents' is still defined in cmdutil. It depends on ui debug level which is wrong in my opinion but can hardly be changed now. Still, I am reluctant to add more hacks to support this behaviour in the general case and prefer to keep it as an exception. 

Finally, I'd like we consider a change in 'copies' behaviour. Right now, 'copies' is silent if --copies is not passed to the log command. I have always found this behaviour surprising for a templating system, and I suggest that 'copies' always displays copies if set in the template/style. This is easy to achieve by adding the copies detection logic of log command to a templatekw.showcopies() function, and using the 'copies' argument passed to changeset_templater._show() as an optimization, initializing the 'cache' property.



More information about the Mercurial-devel mailing list