我已經在它一段時間了,我似乎無法得到它的工作。如何設置Kallithea中的mercurial鉤子
按卡利塞文檔:
To add another custom hook simply fill in the first textbox with <name>.<hook_type> and the second with the hook path. Example hooks can be found in kallithea.lib.hooks.
所以我的第一次嘗試是添加到hooks.py的新方法。基本上要測試出鉤,我想阻止所有推到回購。所以,我將使用pretxnchangegroup和Mercurial的文檔指出
A hook that executes successfully must exit with a status of zero if external, or return boolean 「false」 if in-process. Failure is indicated with a non-zero exit status from an external hook, or an in-process hook returning boolean 「true」. If an in-process hook raises an exception, the hook is considered to have failed.
所以我做了這個返回非0非假值:
def myhook(ui, repo, **kwargs): return True
和我卡里地亞增加了鉤到GUI勾選項:
pretxnchangegroup <=> python:kallithea.lib.hooks.myhook
這howeve [R由於某種原因失敗的方法不能發現
abort: pretxnchangegroup hook is invalid ("kallithea.lib.hooks.myhook" is not defined)
於是,我把它在另一個文件(在相同的「LIB」文件夾,hooks.py是)。創建一個名爲canpush.py的文件並在其中添加相同的方法。我改變了鉤路徑來定位新的文件名:
pretxnchangegroup <=> python:kallithea.lib.hooks.myhook
然而鉤不觸發,我可以把我的回購沒有問題。我打算在未來改變實際的鉤子實現,推動將被允許,但首先我需要使用Kallithea獲得任何鉤子功能。
我在這裏做錯了什麼?
此外,如果有人知道如何使用卡里提亞個人回購的hgrc設置,那麼一個例子會很棒。原始問題here。