comparison mercurial/hook.py @ 13119:ecf7d6e0eef0 stable

hook: fix import path handling for repo=None
author Matt Mackall <mpm@selenic.com>
date Fri, 10 Dec 2010 19:18:02 -0600
parents 789e0fa2fcea
children 1775382ff833
comparison
equal deleted inserted replaced
13118:789e0fa2fcea 13119:ecf7d6e0eef0
134 r = _pythonhook(ui, repo, name, hname, cmd, args, throw) or r 134 r = _pythonhook(ui, repo, name, hname, cmd, args, throw) or r
135 elif cmd.startswith('python:'): 135 elif cmd.startswith('python:'):
136 if cmd.count(':') >= 2: 136 if cmd.count(':') >= 2:
137 path, cmd = cmd[7:].rsplit(':', 1) 137 path, cmd = cmd[7:].rsplit(':', 1)
138 path = util.expandpath(path) 138 path = util.expandpath(path)
139 mod = extensions.loadpath(os.path.join(repo.root, path), 139 if repo:
140 'hghook.%s' % hname) 140 path = os.path.join(repo.root, path)
141 mod = extensions.loadpath(path, 'hghook.%s' % hname)
141 hookfn = getattr(mod, cmd) 142 hookfn = getattr(mod, cmd)
142 else: 143 else:
143 hookfn = cmd[7:].strip() 144 hookfn = cmd[7:].strip()
144 r = _pythonhook(ui, repo, name, hname, hookfn, args, throw) or r 145 r = _pythonhook(ui, repo, name, hname, hookfn, args, throw) or r
145 else: 146 else: