将自定义日志关键字过滤器编写为mercurial的扩展 [英] write custom log keyword filter as extension in mercurial
本文介绍了将自定义日志关键字过滤器编写为mercurial的扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经检查了如何编写一个mercurial扩展的教程,我想知道如何为日志关键字专门添加一个过滤器?
感谢您的帮助。
解决方案
我认为一个例子会最好的解释:
<$ p $从$ mercurial import templatefilters
$ b def上:
返回s.upper()
def extsetup(ui):
templatefilters.filters [upper] = upper
#然后运行:
#
#hg tip --config extensions.upper =〜/ tmp / upper .py --template{author | upper} \\\
#
#to test
(无耻地从mg身上偷走,我希望他能原谅我);
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.
解决方案
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 ;)
这篇关于将自定义日志关键字过滤器编写为mercurial的扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文