Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 1506:11c8b81f95fe
if unambigious command name are passed, use them
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Fri, 04 Nov 2005 10:22:03 -0800 |
parents | 27f08094cfe0 |
children | cd8fadd8c689 |
comparison
equal
deleted
inserted
replaced
1505:27f08094cfe0 | 1506:11c8b81f95fe |
---|---|
2372 | 2372 |
2373 norepo = ("clone init version help debugancestor debugconfig debugdata" | 2373 norepo = ("clone init version help debugancestor debugconfig debugdata" |
2374 " debugindex debugindexdot paths") | 2374 " debugindex debugindexdot paths") |
2375 | 2375 |
2376 def find(cmd): | 2376 def find(cmd): |
2377 choice = [] | |
2377 for e in table.keys(): | 2378 for e in table.keys(): |
2378 if re.match("(%s)$" % e, cmd): | 2379 aliases = e.lstrip("^").split("|") |
2380 if cmd in aliases: | |
2379 return e, table[e] | 2381 return e, table[e] |
2382 for a in aliases: | |
2383 if a.startswith(cmd): | |
2384 choice.append(e) | |
2385 if len(choice) == 1: | |
2386 e = choice[0] | |
2387 return e, table[e] | |
2380 | 2388 |
2381 raise UnknownCommand(cmd) | 2389 raise UnknownCommand(cmd) |
2382 | 2390 |
2383 class SignalInterrupt(Exception): | 2391 class SignalInterrupt(Exception): |
2384 """Exception raised on SIGTERM and SIGHUP.""" | 2392 """Exception raised on SIGTERM and SIGHUP.""" |