Mercurial > public > mercurial-scm > hg
comparison mercurial/dispatch.py @ 22164:efd65e51bc0b
alias: exit from bad definition by Abort
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 13 Aug 2014 22:22:24 +0900 |
parents | 01ef4347e4ab |
children | b13b99d39a46 |
comparison
equal
deleted
inserted
replaced
22163:01ef4347e4ab | 22164:efd65e51bc0b |
---|---|
441 self.badalias = (_("alias '%s' resolves to ambiguous command '%s'") | 441 self.badalias = (_("alias '%s' resolves to ambiguous command '%s'") |
442 % (self.name, cmd)) | 442 % (self.name, cmd)) |
443 | 443 |
444 def __call__(self, ui, *args, **opts): | 444 def __call__(self, ui, *args, **opts): |
445 if self.badalias: | 445 if self.badalias: |
446 ui.warn(self.badalias + '\n') | 446 hint = None |
447 if self.unknowncmd: | 447 if self.unknowncmd: |
448 try: | 448 try: |
449 # check if the command is in a disabled extension | 449 # check if the command is in a disabled extension |
450 cmd, ext = extensions.disabledcmd(ui, self.cmdname)[:2] | 450 cmd, ext = extensions.disabledcmd(ui, self.cmdname)[:2] |
451 ui.warn(_("'%s' is provided by '%s' extension\n") | 451 hint = _("'%s' is provided by '%s' extension") % (cmd, ext) |
452 % (cmd, ext)) | |
453 except error.UnknownCommand: | 452 except error.UnknownCommand: |
454 pass | 453 pass |
455 return -1 | 454 raise util.Abort(self.badalias, hint=hint) |
456 if self.shadows: | 455 if self.shadows: |
457 ui.debug("alias '%s' shadows command '%s'\n" % | 456 ui.debug("alias '%s' shadows command '%s'\n" % |
458 (self.name, self.cmdname)) | 457 (self.name, self.cmdname)) |
459 | 458 |
460 if util.safehasattr(self, 'shell'): | 459 if util.safehasattr(self, 'shell'): |