697 else: |
697 else: |
698 pos += 1 |
698 pos += 1 |
699 return values |
699 return values |
700 |
700 |
701 def _earlyreqoptbool(req, name, aliases): |
701 def _earlyreqoptbool(req, name, aliases): |
702 assert len(aliases) == 1 |
702 """Peek a boolean option without using a full options table |
703 return aliases[0] in req.args |
703 |
|
704 >>> req = request([b'x', b'--debugger']) |
|
705 >>> _earlyreqoptbool(req, b'debugger', [b'--debugger']) |
|
706 True |
|
707 |
|
708 >>> req = request([b'x', b'--', b'--debugger']) |
|
709 >>> _earlyreqoptbool(req, b'debugger', [b'--debugger']) |
|
710 False |
|
711 """ |
|
712 try: |
|
713 argcount = req.args.index("--") |
|
714 except ValueError: |
|
715 argcount = len(req.args) |
|
716 value = False |
|
717 pos = 0 |
|
718 while pos < argcount: |
|
719 arg = req.args[pos] |
|
720 if arg in aliases: |
|
721 value = True |
|
722 pos += 1 |
|
723 return value |
704 |
724 |
705 def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions): |
725 def runcommand(lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions): |
706 # run pre-hook, and abort if it fails |
726 # run pre-hook, and abort if it fails |
707 hook.hook(lui, repo, "pre-%s" % cmd, True, args=" ".join(fullargs), |
727 hook.hook(lui, repo, "pre-%s" % cmd, True, args=" ".join(fullargs), |
708 pats=cmdpats, opts=cmdoptions) |
728 pats=cmdpats, opts=cmdoptions) |