Write your own keyword filter for the magazine as an extension in mercurial

I checked the tutorial on how to write a mercury extension and I am wondering how can I do to add a filter for keywords?

Thanks for the help.

+4
source share
1 answer

I think an example will explain this best:

from mercurial import templatefilters def upper(s): return s.upper() def extsetup(ui): templatefilters.filters["upper"] = upper # Then run: # # hg tip --config extensions.upper=~/tmp/upper.py --template "{author|upper}\n" # # to test 

(shamelessly stolen from mg, I hope he will forgive me;)

+5
source

Source: https://habr.com/ru/post/1369122/


All Articles