##// END OF EJS Templates
hooks: on Git, invoke hooks/post-receive-custom from hooks/post-receive...
Mads Kiilerich -
r8630:20e85009 default
parent child Browse files
Show More
@@ -348,8 +348,10 b' can be found in ``kallithea.lib.hooks``.'
348 Kallithea will also use some hooks internally. They cannot be modified, but
348 Kallithea will also use some hooks internally. They cannot be modified, but
349 some of them can be enabled or disabled in the *VCS* section.
349 some of them can be enabled or disabled in the *VCS* section.
350
350
351 Kallithea has no support for custom Git hooks. Kallithea will install and use
351 Kallithea does not actively support custom Git hooks, but hooks can be installed
352 Git hooks internally, and they might collide with manually installed hooks.
352 manually in the file system. Kallithea will install and use the
353 ``post-receive`` Git hook internally, but it will then invoke
354 ``post-receive-custom`` if present.
353
355
354
356
355 Changing default encoding
357 Changing default encoding
@@ -236,6 +236,9 b' To update the hooks of your Git reposito'
236
236
237 kallithea-cli repo-scan -c my.ini --install-git-hooks
237 kallithea-cli repo-scan -c my.ini --install-git-hooks
238
238
239 Watch out for warnings like ``skipping overwriting hook file X``, then fix it
240 and rerun, or consider using ``--overwrite-git-hooks`` instead.
241
239 Or:
242 Or:
240
243
241 * Go to *Admin > Settings > Remap and Rescan*
244 * Go to *Admin > Settings > Remap and Rescan*
@@ -52,6 +52,7 b' Troubleshooting'
52 Note that Kallithea uses the ``post-receive`` hook internally.
52 Note that Kallithea uses the ``post-receive`` hook internally.
53 Kallithea will not work properly if another post-receive hook is installed instead.
53 Kallithea will not work properly if another post-receive hook is installed instead.
54 You might also accidentally overwrite your own post-receive hook with the Kallithea hook.
54 You might also accidentally overwrite your own post-receive hook with the Kallithea hook.
55 Instead, put your post-receive hook in ``post-receive-custom``, and the Kallithea hook will invoke it.
55
56
56 You can also use Kallithea-extensions to connect to callback hooks,
57 You can also use Kallithea-extensions to connect to callback hooks,
57 for both Git and Mercurial.
58 for both Git and Mercurial.
@@ -9,6 +9,7 b' hook will use.'
9 """
9 """
10
10
11 import os
11 import os
12 import subprocess
12 import sys
13 import sys
13
14
14 import kallithea.bin.vcs_hooks
15 import kallithea.bin.vcs_hooks
@@ -30,7 +31,15 b" os.environ['KALLITHEA_HOOK_VER'] = KALLI"
30 def main():
31 def main():
31 repo_path = os.path.abspath('.')
32 repo_path = os.path.abspath('.')
32 git_stdin_lines = sys.stdin.readlines()
33 git_stdin_lines = sys.stdin.readlines()
33 sys.exit(kallithea.bin.vcs_hooks.post_receive(repo_path, git_stdin_lines))
34 status = kallithea.bin.vcs_hooks.post_receive(repo_path, git_stdin_lines)
35
36 custom_hook = os.path.join(repo_path, 'hooks', 'post-receive-custom')
37 custom_status = None
38 if os.access(custom_hook, os.X_OK):
39 result = subprocess.run([custom_hook], input=''.join(git_stdin_lines), universal_newlines=True)
40 custom_status = result.returncode
41
42 sys.exit(status or custom_status)
34
43
35
44
36 if __name__ == '__main__':
45 if __name__ == '__main__':
General Comments 0
You need to be logged in to leave comments. Login now