Mercurial > hg
comparison hgext/alias.py @ 7643:9a1ea6587557
error: move UnknownCommand and AmbiguousCommand
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 12 Jan 2009 11:39:38 -0600 |
parents | b4c035057d34 |
children | a0104303f400 |
comparison
equal
deleted
inserted
replaced
7642:84346894def8 | 7643:9a1ea6587557 |
---|---|
7 | 7 |
8 [alias] | 8 [alias] |
9 mycmd = cmd --args | 9 mycmd = cmd --args |
10 ''' | 10 ''' |
11 | 11 |
12 from mercurial.cmdutil import findcmd, UnknownCommand, AmbiguousCommand | |
13 from mercurial import commands | |
14 from mercurial.i18n import _ | 12 from mercurial.i18n import _ |
13 from mercurial import commands, cmdutil, error | |
15 | 14 |
16 cmdtable = {} | 15 cmdtable = {} |
17 | 16 |
18 class RecursiveCommand(Exception): pass | 17 class RecursiveCommand(Exception): pass |
19 | 18 |
41 def _resolve(self): | 40 def _resolve(self): |
42 if self._cmd is not None: | 41 if self._cmd is not None: |
43 return | 42 return |
44 | 43 |
45 try: | 44 try: |
46 self._cmd = findcmd(self._target, commands.table, False)[1] | 45 self._cmd = cmdutil.findcmd(self._target, commands.table, False)[1] |
47 if self._cmd == self: | 46 if self._cmd == self: |
48 raise RecursiveCommand() | 47 raise RecursiveCommand() |
49 if self._target in commands.norepo.split(' '): | 48 if self._target in commands.norepo.split(' '): |
50 commands.norepo += ' %s' % self._name | 49 commands.norepo += ' %s' % self._name |
51 return | 50 return |
52 except UnknownCommand: | 51 except error.UnknownCommand: |
53 msg = _('*** [alias] %s: command %s is unknown') % \ | 52 msg = _('*** [alias] %s: command %s is unknown') % \ |
54 (self._name, self._target) | 53 (self._name, self._target) |
55 except AmbiguousCommand: | 54 except error.AmbiguousCommand: |
56 msg = _('*** [alias] %s: command %s is ambiguous') % \ | 55 msg = _('*** [alias] %s: command %s is ambiguous') % \ |
57 (self._name, self._target) | 56 (self._name, self._target) |
58 except RecursiveCommand: | 57 except RecursiveCommand: |
59 msg = _('*** [alias] %s: circular dependency on %s') % \ | 58 msg = _('*** [alias] %s: circular dependency on %s') % \ |
60 (self._name, self._target) | 59 (self._name, self._target) |