开发者

write custom log keyword filter as extension in mercurial

开发者 https://www.devze.com 2023-03-30 18:22 出处:网络
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?

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 ;)

0

精彩评论

暂无评论...
验证码 换一张
取 消