Mercurial > public > mercurial-scm > hg
comparison mercurial/dispatch.py @ 19011:12acbea17625
dispatch: print 'abort:' when a pre-command hook fails (BC)
This also changes the exit code from whatever the hook returned to 255. This
brings it in line with all the other hooks that abort.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Tue, 16 Apr 2013 14:39:37 -0700 |
parents | e5d9441ec281 |
children | f01ae031f84c |
comparison
equal
deleted
inserted
replaced
19010:e071d161b266 | 19011:12acbea17625 |
---|---|
509 pos += 1 | 509 pos += 1 |
510 return values | 510 return values |
511 | 511 |
512 def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions): | 512 def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions): |
513 # run pre-hook, and abort if it fails | 513 # run pre-hook, and abort if it fails |
514 ret = hook.hook(lui, repo, "pre-%s" % cmd, False, args=" ".join(fullargs), | 514 hook.hook(lui, repo, "pre-%s" % cmd, True, args=" ".join(fullargs), |
515 pats=cmdpats, opts=cmdoptions) | 515 pats=cmdpats, opts=cmdoptions) |
516 if ret: | |
517 return ret | |
518 ret = _runcommand(ui, options, cmd, d) | 516 ret = _runcommand(ui, options, cmd, d) |
519 # run post-hook, passing command result | 517 # run post-hook, passing command result |
520 hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs), | 518 hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs), |
521 result=ret, pats=cmdpats, opts=cmdoptions) | 519 result=ret, pats=cmdpats, opts=cmdoptions) |
522 return ret | 520 return ret |