##// END OF EJS Templates
hooks: fix pre- and post- hooks specified in .hg/hgrc...
Matt Mackall -
r5869:2c565b95 default
parent child Browse files
Show More
@@ -354,12 +354,12 b' def _dispatch(ui, args):'
354 d = lambda: func(ui, *args, **cmdoptions)
354 d = lambda: func(ui, *args, **cmdoptions)
355
355
356 # run pre-hook, and abort if it fails
356 # run pre-hook, and abort if it fails
357 ret = hook.hook(ui, repo, "pre-%s" % cmd, False, args=" ".join(fullargs))
357 ret = hook.hook(lui, repo, "pre-%s" % cmd, False, args=" ".join(fullargs))
358 if ret:
358 if ret:
359 return ret
359 return ret
360 ret = _runcommand(ui, options, cmd, d)
360 ret = _runcommand(ui, options, cmd, d)
361 # run post-hook, passing command result
361 # run post-hook, passing command result
362 hook.hook(ui, repo, "post-%s" % cmd, False, args=" ".join(fullargs),
362 hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs),
363 result = ret)
363 result = ret)
364 return ret
364 return ret
365
365
@@ -71,7 +71,11 b' def _pythonhook(ui, repo, name, hname, f'
71 def _exthook(ui, repo, name, cmd, args, throw):
71 def _exthook(ui, repo, name, cmd, args, throw):
72 ui.note(_("running hook %s: %s\n") % (name, cmd))
72 ui.note(_("running hook %s: %s\n") % (name, cmd))
73 env = dict([('HG_' + k.upper(), v) for k, v in args.iteritems()])
73 env = dict([('HG_' + k.upper(), v) for k, v in args.iteritems()])
74 r = util.system(cmd, environ=env, cwd=repo.root)
74 if repo:
75 cwd = repo.root
76 else:
77 cwd = os.getcwd()
78 r = util.system(cmd, environ=env, cwd=cwd)
75 if r:
79 if r:
76 desc, r = util.explain_exit(r)
80 desc, r = util.explain_exit(r)
77 if throw:
81 if throw:
General Comments 0
You need to be logged in to leave comments. Login now