write custom log keyword filter as extension in mercurial
I have checked the tutorial on 开发者_Python百科how to write a mercurial extension and I wonder how do I do to specifically add a filter for log keywords?
Thanks for help.
I think an example will explain it 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 forgives me ;)
精彩评论