write custom log keyword filter as extension in mercurial

断了今生、忘了曾经 提交于 2019-12-10 17:06:00

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!