2016-05-23 57 views
0

我已經在它一段時間了,我似乎無法得到它的工作。如何設置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

回答

0

回答我自己的問題,但只是作爲參考。

事實證明設置沒問題,但在絕望的行爲中,我決定重新啓動kallithea守護進程(在文檔中沒有任何地方),基本上都在想'出什麼問題了' - 而且這樣做了!

在啓動過程中的事情,我想被編譯/緩存,發現鉤定義方法和功能(如果有人有更好的解釋,對卡利塞重啓會發生什麼,請分享)

記住所以裸,在每次更改鉤子文件之後,必須重新啓動kallithea守護進程以使鉤子有效。

sudo service kallithea restart