Show More
@@ -43,7 +43,7 b' class lazycommand(object):' | |||||
43 | return |
|
43 | return | |
44 |
|
44 | |||
45 | try: |
|
45 | try: | |
46 |
self._cmd = findcmd(self. |
|
46 | self._cmd = findcmd(self._target, commands.table, False)[1] | |
47 | if self._cmd == self: |
|
47 | if self._cmd == self: | |
48 | raise RecursiveCommand() |
|
48 | raise RecursiveCommand() | |
49 | if self._target in commands.norepo.split(' '): |
|
49 | if self._target in commands.norepo.split(' '): |
@@ -198,7 +198,7 b' def _decoratecmd(ui, cmd, table, delegat' | |||||
198 |
|
198 | |||
199 | def _cmdtableitem(ui, cmd, table): |
|
199 | def _cmdtableitem(ui, cmd, table): | |
200 | '''Return key, value from table for cmd, or None if not found.''' |
|
200 | '''Return key, value from table for cmd, or None if not found.''' | |
201 |
aliases, entry = cmdutil.findcmd( |
|
201 | aliases, entry = cmdutil.findcmd(cmd, table) | |
202 | for candidatekey, candidateentry in table.iteritems(): |
|
202 | for candidatekey, candidateentry in table.iteritems(): | |
203 | if candidateentry is entry: |
|
203 | if candidateentry is entry: | |
204 | return candidatekey, entry |
|
204 | return candidatekey, entry |
@@ -2368,7 +2368,7 b' def reposetup(ui, repo):' | |||||
2368 |
|
2368 | |||
2369 | def uisetup(ui): |
|
2369 | def uisetup(ui): | |
2370 | # override import to disallow importing over patch |
|
2370 | # override import to disallow importing over patch | |
2371 |
importalias, importcmd = cmdutil.findcmd( |
|
2371 | importalias, importcmd = cmdutil.findcmd('import', commands.table) | |
2372 | for alias, cmd in commands.table.iteritems(): |
|
2372 | for alias, cmd in commands.table.iteritems(): | |
2373 | if cmd is importcmd: |
|
2373 | if cmd is importcmd: | |
2374 | importkey = alias |
|
2374 | importkey = alias |
@@ -370,7 +370,7 b' def pulldelegate(pullfunction, repo, *ar' | |||||
370 | def uisetup(ui): |
|
370 | def uisetup(ui): | |
371 | 'Replace pull with a decorator to provide --rebase option' |
|
371 | 'Replace pull with a decorator to provide --rebase option' | |
372 | # cribbed from color.py |
|
372 | # cribbed from color.py | |
373 |
aliases, entry = cmdutil.findcmd( |
|
373 | aliases, entry = cmdutil.findcmd('pull', commands.table) | |
374 | for candidatekey, candidateentry in commands.table.iteritems(): |
|
374 | for candidatekey, candidateentry in commands.table.iteritems(): | |
375 | if candidateentry is entry: |
|
375 | if candidateentry is entry: | |
376 | cmdkey, cmdentry = candidatekey, entry |
|
376 | cmdkey, cmdentry = candidatekey, entry |
@@ -18,7 +18,7 b' class UnknownCommand(Exception):' | |||||
18 | class AmbiguousCommand(Exception): |
|
18 | class AmbiguousCommand(Exception): | |
19 | """Exception raised if command shortcut matches more than one command.""" |
|
19 | """Exception raised if command shortcut matches more than one command.""" | |
20 |
|
20 | |||
21 |
def findpossible( |
|
21 | def findpossible(cmd, table, strict=False): | |
22 | """ |
|
22 | """ | |
23 | Return cmd -> (aliases, command table entry) |
|
23 | Return cmd -> (aliases, command table entry) | |
24 | for each matching command. |
|
24 | for each matching command. | |
@@ -31,7 +31,7 b' def findpossible(ui, cmd, table):' | |||||
31 | found = None |
|
31 | found = None | |
32 | if cmd in aliases: |
|
32 | if cmd in aliases: | |
33 | found = cmd |
|
33 | found = cmd | |
34 |
elif not |
|
34 | elif not strict: | |
35 | for a in aliases: |
|
35 | for a in aliases: | |
36 | if a.startswith(cmd): |
|
36 | if a.startswith(cmd): | |
37 | found = a |
|
37 | found = a | |
@@ -47,9 +47,9 b' def findpossible(ui, cmd, table):' | |||||
47 |
|
47 | |||
48 | return choice |
|
48 | return choice | |
49 |
|
49 | |||
50 |
def findcmd( |
|
50 | def findcmd(cmd, table, strict=True): | |
51 | """Return (aliases, command table entry) for command string.""" |
|
51 | """Return (aliases, command table entry) for command string.""" | |
52 |
choice = findpossible( |
|
52 | choice = findpossible(cmd, table, strict) | |
53 |
|
53 | |||
54 | if cmd in choice: |
|
54 | if cmd in choice: | |
55 | return choice[cmd] |
|
55 | return choice[cmd] |
@@ -655,7 +655,7 b" def debugcomplete(ui, cmd='', **opts):" | |||||
655 | options = [] |
|
655 | options = [] | |
656 | otables = [globalopts] |
|
656 | otables = [globalopts] | |
657 | if cmd: |
|
657 | if cmd: | |
658 |
aliases, entry = cmdutil.findcmd( |
|
658 | aliases, entry = cmdutil.findcmd(cmd, table, False) | |
659 | otables.append(entry[1]) |
|
659 | otables.append(entry[1]) | |
660 | for t in otables: |
|
660 | for t in otables: | |
661 | for o in t: |
|
661 | for o in t: | |
@@ -665,7 +665,7 b" def debugcomplete(ui, cmd='', **opts):" | |||||
665 | ui.write("%s\n" % "\n".join(options)) |
|
665 | ui.write("%s\n" % "\n".join(options)) | |
666 | return |
|
666 | return | |
667 |
|
667 | |||
668 |
ui.write("%s\n" % "\n".join(util.sort(cmdutil.findpossible( |
|
668 | ui.write("%s\n" % "\n".join(util.sort(cmdutil.findpossible(cmd, table)))) | |
669 |
|
669 | |||
670 | def debugfsinfo(ui, path = "."): |
|
670 | def debugfsinfo(ui, path = "."): | |
671 | file('.debugfsinfo', 'w').write('') |
|
671 | file('.debugfsinfo', 'w').write('') | |
@@ -1272,7 +1272,7 b' def help_(ui, name=None, with_version=Fa' | |||||
1272 | ui.write('\n') |
|
1272 | ui.write('\n') | |
1273 |
|
1273 | |||
1274 | try: |
|
1274 | try: | |
1275 |
aliases, i = cmdutil.findcmd( |
|
1275 | aliases, i = cmdutil.findcmd(name, table, False) | |
1276 | except cmdutil.AmbiguousCommand, inst: |
|
1276 | except cmdutil.AmbiguousCommand, inst: | |
1277 | select = lambda c: c.lstrip('^').startswith(inst.args[0]) |
|
1277 | select = lambda c: c.lstrip('^').startswith(inst.args[0]) | |
1278 | helplist(_('list of commands:\n\n'), select) |
|
1278 | helplist(_('list of commands:\n\n'), select) |
@@ -171,7 +171,8 b' def _parse(ui, args):' | |||||
171 |
|
171 | |||
172 | if args: |
|
172 | if args: | |
173 | cmd, args = args[0], args[1:] |
|
173 | cmd, args = args[0], args[1:] | |
174 |
aliases, i = cmdutil.findcmd( |
|
174 | aliases, i = cmdutil.findcmd(cmd, commands.table, | |
|
175 | ui.config("ui","strict")) | |||
175 | cmd = aliases[0] |
|
176 | cmd = aliases[0] | |
176 | defaults = ui.config("defaults", cmd) |
|
177 | defaults = ui.config("defaults", cmd) | |
177 | if defaults: |
|
178 | if defaults: |
General Comments 0
You need to be logged in to leave comments.
Login now