问题
I have checked the tutorial on how to write a mercurial extension and I wonder how do I do to specifically add a filter for log keywords?
Thanks for help.
回答1:
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 ;)
来源:https://stackoverflow.com/questions/7202052/write-custom-log-keyword-filter-as-extension-in-mercurial