def rewritePostCommitHook(self, signature, new_hook, enable): reposdir = options.env_path('svn_dir') hook = reposdir + self.name + 'hooks' + 'post-commit' shellscript.rewriteWithSignature(hook, signature, new_hook, enable, mode=0o755)
def enable_hook(reposdir, hookname, targetname, interpreter='/usr/bin/python', args='"$@"'): """Assumes no hook is already there, or if there is, that is a shell script. If you want to overwrite the hook with a clean submin-hook, call rewrite_hook instead.""" target_script = options.static_path("hooks") + "git" + targetname new_hook = '%s %s %s\n' % (interpreter, target_script, args) hook = reposdir + 'hooks' + hookname if shellscript.hasSignature(hook, signature): return shellscript.rewriteWithSignature(hook, signature, new_hook, True, mode=0o755)