Mercurial > public > mercurial-scm > hg
comparison mercurial/dispatch.py @ 11287:b901bb751999
error: change ParseError to CommandError
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 04 Jun 2010 20:19:53 -0500 |
parents | 385b95d10410 |
children | 2123aad24d56 |
comparison
equal
deleted
inserted
replaced
11286:ccfd1cbc7289 | 11287:b901bb751999 |
---|---|
71 reason = _('lock held by %s') % inst.locker | 71 reason = _('lock held by %s') % inst.locker |
72 ui.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason)) | 72 ui.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason)) |
73 except error.LockUnavailable, inst: | 73 except error.LockUnavailable, inst: |
74 ui.warn(_("abort: could not lock %s: %s\n") % | 74 ui.warn(_("abort: could not lock %s: %s\n") % |
75 (inst.desc or inst.filename, inst.strerror)) | 75 (inst.desc or inst.filename, inst.strerror)) |
76 except error.ParseError, inst: | 76 except error.CommandError, inst: |
77 if inst.args[0]: | 77 if inst.args[0]: |
78 ui.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1])) | 78 ui.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1])) |
79 commands.help_(ui, inst.args[0]) | 79 commands.help_(ui, inst.args[0]) |
80 else: | 80 else: |
81 ui.warn(_("hg: %s\n") % inst.args[1]) | 81 ui.warn(_("hg: %s\n") % inst.args[1]) |
256 cmdoptions = {} | 256 cmdoptions = {} |
257 | 257 |
258 try: | 258 try: |
259 args = fancyopts.fancyopts(args, commands.globalopts, options) | 259 args = fancyopts.fancyopts(args, commands.globalopts, options) |
260 except fancyopts.getopt.GetoptError, inst: | 260 except fancyopts.getopt.GetoptError, inst: |
261 raise error.ParseError(None, inst) | 261 raise error.CommandError(None, inst) |
262 | 262 |
263 if args: | 263 if args: |
264 cmd, args = args[0], args[1:] | 264 cmd, args = args[0], args[1:] |
265 aliases, entry = cmdutil.findcmd(cmd, commands.table, | 265 aliases, entry = cmdutil.findcmd(cmd, commands.table, |
266 ui.config("ui", "strict")) | 266 ui.config("ui", "strict")) |
279 c.append((o[0], o[1], options[o[1]], o[3])) | 279 c.append((o[0], o[1], options[o[1]], o[3])) |
280 | 280 |
281 try: | 281 try: |
282 args = fancyopts.fancyopts(args, c, cmdoptions, True) | 282 args = fancyopts.fancyopts(args, c, cmdoptions, True) |
283 except fancyopts.getopt.GetoptError, inst: | 283 except fancyopts.getopt.GetoptError, inst: |
284 raise error.ParseError(cmd, inst) | 284 raise error.CommandError(cmd, inst) |
285 | 285 |
286 # separate global options back out | 286 # separate global options back out |
287 for o in commands.globalopts: | 287 for o in commands.globalopts: |
288 n = o[1] | 288 n = o[1] |
289 options[n] = cmdoptions[n] | 289 options[n] = cmdoptions[n] |
473 def _runcommand(ui, options, cmd, cmdfunc): | 473 def _runcommand(ui, options, cmd, cmdfunc): |
474 def checkargs(): | 474 def checkargs(): |
475 try: | 475 try: |
476 return cmdfunc() | 476 return cmdfunc() |
477 except error.SignatureError: | 477 except error.SignatureError: |
478 raise error.ParseError(cmd, _("invalid arguments")) | 478 raise error.CommandError(cmd, _("invalid arguments")) |
479 | 479 |
480 if options['profile']: | 480 if options['profile']: |
481 format = ui.config('profiling', 'format', default='text') | 481 format = ui.config('profiling', 'format', default='text') |
482 | 482 |
483 if not format in ['text', 'kcachegrind']: | 483 if not format in ['text', 'kcachegrind']: |