#!/usr/bin/env python # # a short script to call the hook with the remote user from mercurial import util import os vcslogcmd = "/path/to/vcslog2mysql" def hook(ui, repo, **args): """VCSLogHook for running the vcslog2mysql command with the REMOTE_USER""" name = 'VCSLogHook' user = os.getenv('REMOTE_USER') if user is None: user = '' cmd = "%s -t hg -u %s" % (vcslogcmd, user, ) ui.note("running hook %s: %s\n" % (name, cmd)) env = dict([('HG_' + k.upper(), v) for k, v in args.iteritems()]) if repo: cwd = repo.root else: cwd = os.getcwd() r = util.system(cmd, environ=env, cwd=cwd) if r: desc, r = util.explain_exit(r) ui.warn('warning: %s hook %s\n' % (name, desc)) return r # vim: ts=4:sw=4:ai:si:et: