我正在尝试创建我的第一个提交钩子但它无法正常工作。 我从这里得到了这个想法http://doc.bazaar.canonical.com/beta/en/user-guide/hooks.html
我正在尝试的是开始制作我自己的自定义提交消息。但这不起作用。请帮忙吗?
我创建了一个名为commit_hook.py
from bzrlib import branch
def my_commit_hook(push_result):
print "I made this and the new revno is %d" % commit_result.new_revno
branch.Branch.hooks.install_named_hook('post_commit', post_commit_hook,
'My post_commit hook')
我将文件commit_hook.py放在我的存储库中的.bzr隐藏文件夹中。我做了插件目录?那是对的吗?
.bzr/
├──
├── branch-format
├── branch-lock
├── plugins
│ └── commit_hook.py
├── README
答案 0 :(得分:1)
调用post_commit(local,master,old_revno,old_revid, new_revno,new_revid)。
因此,
def my_commit_hook(local, master, old_revno, old_revid,
new_revno, new_revid):
此外,post_commit_hook
应为my_commit_hook
:
branch.Branch.hooks.install_named_hook('post_commit',
my_commit_hook,
'My post_commit hook')