##// END OF EJS Templates
dispatch: extract command execution block into method...
Bill Barry -
r7819:14b70325 default
parent child Browse files
Show More
@@ -239,6 +239,17 def _earlygetopt(aliases, args):
239 239 pos += 1
240 240 return values
241 241
242 def runcommand(lui, repo, cmd, fullargs, ui, options, d):
243 # run pre-hook, and abort if it fails
244 ret = hook.hook(lui, repo, "pre-%s" % cmd, False, args=" ".join(fullargs))
245 if ret:
246 return ret
247 ret = _runcommand(ui, options, cmd, d)
248 # run post-hook, passing command result
249 hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs),
250 result = ret)
251 return ret
252
242 253 _loaded = {}
243 254 def _dispatch(ui, args):
244 255 # read --config before doing anything else
@@ -358,16 +369,7 def _dispatch(ui, args):
358 369 ui.warn("warning: --repository ignored\n")
359 370
360 371 d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
361
362 # run pre-hook, and abort if it fails
363 ret = hook.hook(lui, repo, "pre-%s" % cmd, False, args=" ".join(fullargs))
364 if ret:
365 return ret
366 ret = _runcommand(ui, options, cmd, d)
367 # run post-hook, passing command result
368 hook.hook(lui, repo, "post-%s" % cmd, False, args=" ".join(fullargs),
369 result = ret)
370 return ret
372 return runcommand(lui, repo, cmd, fullargs, ui, options, d)
371 373
372 374 def _runcommand(ui, options, cmd, cmdfunc):
373 375 def checkargs():
General Comments 0
You need to be logged in to leave comments. Login now