Show More
@@ -668,94 +668,95 b' def _dispatch(req):' | |||||
668 | for ui_ in uis: |
|
668 | for ui_ in uis: | |
669 | ui_.setconfig('profiling', 'enabled', 'true', '--profile') |
|
669 | ui_.setconfig('profiling', 'enabled', 'true', '--profile') | |
670 |
|
670 | |||
671 | # Configure extensions in phases: uisetup, extsetup, cmdtable, and |
|
671 | with profiling.maybeprofile(lui): | |
672 | # reposetup. Programs like TortoiseHg will call _dispatch several |
|
672 | # Configure extensions in phases: uisetup, extsetup, cmdtable, and | |
673 | # times so we keep track of configured extensions in _loaded. |
|
673 | # reposetup. Programs like TortoiseHg will call _dispatch several | |
674 | extensions.loadall(lui) |
|
674 | # times so we keep track of configured extensions in _loaded. | |
675 | exts = [ext for ext in extensions.extensions() if ext[0] not in _loaded] |
|
675 | extensions.loadall(lui) | |
676 | # Propagate any changes to lui.__class__ by extensions |
|
676 | exts = [ext for ext in extensions.extensions() if ext[0] not in _loaded] | |
677 | ui.__class__ = lui.__class__ |
|
677 | # Propagate any changes to lui.__class__ by extensions | |
|
678 | ui.__class__ = lui.__class__ | |||
678 |
|
679 | |||
679 | # (uisetup and extsetup are handled in extensions.loadall) |
|
680 | # (uisetup and extsetup are handled in extensions.loadall) | |
680 |
|
681 | |||
681 | for name, module in exts: |
|
682 | for name, module in exts: | |
682 | for objname, loadermod, loadername in extraloaders: |
|
683 | for objname, loadermod, loadername in extraloaders: | |
683 | extraobj = getattr(module, objname, None) |
|
684 | extraobj = getattr(module, objname, None) | |
684 | if extraobj is not None: |
|
685 | if extraobj is not None: | |
685 | getattr(loadermod, loadername)(ui, name, extraobj) |
|
686 | getattr(loadermod, loadername)(ui, name, extraobj) | |
686 | _loaded.add(name) |
|
687 | _loaded.add(name) | |
687 |
|
688 | |||
688 | # (reposetup is handled in hg.repository) |
|
689 | # (reposetup is handled in hg.repository) | |
689 |
|
690 | |||
690 | addaliases(lui, commands.table) |
|
691 | addaliases(lui, commands.table) | |
691 |
|
692 | |||
692 | # All aliases and commands are completely defined, now. |
|
693 | # All aliases and commands are completely defined, now. | |
693 | # Check abbreviation/ambiguity of shell alias. |
|
694 | # Check abbreviation/ambiguity of shell alias. | |
694 | shellaliasfn = _checkshellalias(lui, ui, args) |
|
695 | shellaliasfn = _checkshellalias(lui, ui, args) | |
695 | if shellaliasfn: |
|
696 | if shellaliasfn: | |
696 | with profiling.maybeprofile(lui): |
|
|||
697 | return shellaliasfn() |
|
697 | return shellaliasfn() | |
698 |
|
698 | |||
699 | # check for fallback encoding |
|
699 | # check for fallback encoding | |
700 | fallback = lui.config('ui', 'fallbackencoding') |
|
700 | fallback = lui.config('ui', 'fallbackencoding') | |
701 | if fallback: |
|
701 | if fallback: | |
702 | encoding.fallbackencoding = fallback |
|
702 | encoding.fallbackencoding = fallback | |
703 |
|
703 | |||
704 | fullargs = args |
|
704 | fullargs = args | |
705 | cmd, func, args, options, cmdoptions = _parse(lui, args) |
|
705 | cmd, func, args, options, cmdoptions = _parse(lui, args) | |
706 |
|
706 | |||
707 | if options["config"]: |
|
707 | if options["config"]: | |
708 | raise error.Abort(_("option --config may not be abbreviated!")) |
|
708 | raise error.Abort(_("option --config may not be abbreviated!")) | |
709 | if options["cwd"]: |
|
709 | if options["cwd"]: | |
710 | raise error.Abort(_("option --cwd may not be abbreviated!")) |
|
710 | raise error.Abort(_("option --cwd may not be abbreviated!")) | |
711 | if options["repository"]: |
|
711 | if options["repository"]: | |
712 | raise error.Abort(_( |
|
712 | raise error.Abort(_( | |
713 |
"option -R has to be separated from other options (e.g. not |
|
713 | "option -R has to be separated from other options (e.g. not " | |
714 | "and --repository may only be abbreviated as --repo!")) |
|
714 | "-qR) and --repository may only be abbreviated as --repo!")) | |
715 |
|
715 | |||
716 | if options["encoding"]: |
|
716 | if options["encoding"]: | |
717 | encoding.encoding = options["encoding"] |
|
717 | encoding.encoding = options["encoding"] | |
718 | if options["encodingmode"]: |
|
718 | if options["encodingmode"]: | |
719 | encoding.encodingmode = options["encodingmode"] |
|
719 | encoding.encodingmode = options["encodingmode"] | |
720 | if options["time"]: |
|
720 | if options["time"]: | |
721 | def get_times(): |
|
721 | def get_times(): | |
722 | t = os.times() |
|
722 | t = os.times() | |
723 | if t[4] == 0.0: # Windows leaves this as zero, so use time.clock() |
|
723 | if t[4] == 0.0: | |
724 | t = (t[0], t[1], t[2], t[3], time.clock()) |
|
724 | # Windows leaves this as zero, so use time.clock() | |
725 | return t |
|
725 | t = (t[0], t[1], t[2], t[3], time.clock()) | |
726 | s = get_times() |
|
726 | return t | |
727 |
|
|
727 | s = get_times() | |
728 |
|
|
728 | def print_time(): | |
729 | ui.warn(_("time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") % |
|
729 | t = get_times() | |
730 | (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3])) |
|
730 | ui.warn( | |
731 | atexit.register(print_time) |
|
731 | _("time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") % | |
|
732 | (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3])) | |||
|
733 | atexit.register(print_time) | |||
732 |
|
734 | |||
733 | if options['verbose'] or options['debug'] or options['quiet']: |
|
735 | if options['verbose'] or options['debug'] or options['quiet']: | |
734 | for opt in ('verbose', 'debug', 'quiet'): |
|
736 | for opt in ('verbose', 'debug', 'quiet'): | |
735 | val = str(bool(options[opt])) |
|
737 | val = str(bool(options[opt])) | |
|
738 | for ui_ in uis: | |||
|
739 | ui_.setconfig('ui', opt, val, '--' + opt) | |||
|
740 | ||||
|
741 | if options['traceback']: | |||
736 | for ui_ in uis: |
|
742 | for ui_ in uis: | |
737 |
ui_.setconfig('ui', |
|
743 | ui_.setconfig('ui', 'traceback', 'on', '--traceback') | |
738 |
|
744 | |||
739 |
if options['trace |
|
745 | if options['noninteractive']: | |
740 | for ui_ in uis: |
|
746 | for ui_ in uis: | |
741 |
ui_.setconfig('ui', 'trace |
|
747 | ui_.setconfig('ui', 'interactive', 'off', '-y') | |
742 |
|
||||
743 | if options['noninteractive']: |
|
|||
744 | for ui_ in uis: |
|
|||
745 | ui_.setconfig('ui', 'interactive', 'off', '-y') |
|
|||
746 |
|
748 | |||
747 | if cmdoptions.get('insecure', False): |
|
749 | if cmdoptions.get('insecure', False): | |
748 | for ui_ in uis: |
|
750 | for ui_ in uis: | |
749 | ui_.insecureconnections = True |
|
751 | ui_.insecureconnections = True | |
750 |
|
752 | |||
751 | if options['version']: |
|
753 | if options['version']: | |
752 | return commands.version_(ui) |
|
754 | return commands.version_(ui) | |
753 | if options['help']: |
|
755 | if options['help']: | |
754 | return commands.help_(ui, cmd, command=cmd is not None) |
|
756 | return commands.help_(ui, cmd, command=cmd is not None) | |
755 | elif not cmd: |
|
757 | elif not cmd: | |
756 | return commands.help_(ui, 'shortlist') |
|
758 | return commands.help_(ui, 'shortlist') | |
757 |
|
759 | |||
758 | with profiling.maybeprofile(lui): |
|
|||
759 | repo = None |
|
760 | repo = None | |
760 | cmdpats = args[:] |
|
761 | cmdpats = args[:] | |
761 | if not func.norepo: |
|
762 | if not func.norepo: |
General Comments 0
You need to be logged in to leave comments.
Login now