Show More
@@ -490,6 +490,10 def _earlygetopt(aliases, args): | |||
|
490 | 490 | >>> _earlygetopt(['--cwd'], args), args |
|
491 | 491 | (['foo'], ['x', 'y']) |
|
492 | 492 | |
|
493 | >>> args = ['x', '--cwd=bar', 'y'] | |
|
494 | >>> _earlygetopt(['--cwd'], args), args | |
|
495 | (['bar'], ['x', 'y']) | |
|
496 | ||
|
493 | 497 | >>> args = ['x', '-R', 'foo', 'y'] |
|
494 | 498 | >>> _earlygetopt(['-R'], args), args |
|
495 | 499 | (['foo'], ['x', 'y']) |
@@ -506,14 +510,22 def _earlygetopt(aliases, args): | |||
|
506 | 510 | values = [] |
|
507 | 511 | pos = 0 |
|
508 | 512 | while pos < argcount: |
|
509 | if args[pos] in aliases: | |
|
513 | fullarg = arg = args[pos] | |
|
514 | equals = arg.find('=') | |
|
515 | if equals > -1: | |
|
516 | arg = arg[:equals] | |
|
517 | if arg in aliases: | |
|
518 | del args[pos] | |
|
519 | if equals > -1: | |
|
520 | values.append(fullarg[equals + 1:]) | |
|
521 | argcount -= 1 | |
|
522 | else: | |
|
510 | 523 | if pos + 1 >= argcount: |
|
511 | 524 | # ignore and let getopt report an error if there is no value |
|
512 | 525 | break |
|
513 | del args[pos] | |
|
514 | 526 | values.append(args.pop(pos)) |
|
515 | 527 | argcount -= 2 |
|
516 |
elif arg |
|
|
528 | elif arg[:2] in shortopts: | |
|
517 | 529 | # short option can have no following space, e.g. hg log -Rfoo |
|
518 | 530 | values.append(args.pop(pos)[2:]) |
|
519 | 531 | argcount -= 1 |
General Comments 0
You need to be logged in to leave comments.
Login now