Here is the script for a pre-commit though,

--- pre_commit.py ---
from bzrlib import branch
import os

script_cmds = ['make syntax-check', 'make check']

def pre_commit_hook(local, master, old_revno, old_revid,
                    future_revno, future_revid, tree_delta, future_tree):
    success, fails = ([],[])
    for c in script_cmds:
        if (os.system(c) != 0):
            fails.append(c)
        else:
            success.append(c)
    for s in success:
        print ">>> " + s + ": succeeded."
    for f in fails:
        print ">>> " + f + ": failed."


branch.Branch.hooks.install_named_hook('pre_commit', pre_commit_hook,
                                 'Patch safety scripts hook')


--- end of pre_commit.py ---


Reply via email to