~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Patch Queue Manager
  • Date: 2011-09-29 16:16:31 UTC
  • mfrom: (6161.1.6 491196-cmdline-options)
  • Revision ID: pqm@pqm.ubuntu.com-20110929161631-39y752x3cwcljl5w
(vila) Allow configuration options to be overridden from the command line.
 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
663
663
            opts['quiet'] = trace.is_quiet()
664
664
        elif opts.has_key('quiet'):
665
665
            del opts['quiet']
666
 
 
667
666
        # mix arguments and options into one dictionary
668
667
        cmdargs = _match_argform(self.name(), self.takes_args, args)
669
668
        cmdopts = {}
1041
1040
 
1042
1041
    argv_copy = []
1043
1042
    i = 0
 
1043
    override_config = []
1044
1044
    while i < len(argv):
1045
1045
        a = argv[i]
1046
1046
        if a == '--profile':
1069
1069
            pass # already handled in startup script Bug #588277
1070
1070
        elif a.startswith('-D'):
1071
1071
            debug.debug_flags.add(a[2:])
 
1072
        elif a.startswith('-O'):
 
1073
            override_config.append(a[2:])
1072
1074
        else:
1073
1075
            argv_copy.append(a)
1074
1076
        i += 1
1075
1077
 
 
1078
    bzrlib.global_state.cmdline_overrides._from_cmdline(override_config)
 
1079
 
1076
1080
    debug.set_debug_flags_from_config()
1077
1081
 
1078
1082
    if not opt_no_plugins:
1130
1134
        if 'memory' in debug.debug_flags:
1131
1135
            trace.debug_memory('Process status after command:', short=False)
1132
1136
        option._verbosity_level = saved_verbosity_level
 
1137
        # Reset the overrides 
 
1138
        bzrlib.global_state.cmdline_overrides._reset()
1133
1139
 
1134
1140
 
1135
1141
def display_command(func):
1164
1170
        "bzr plugin commands")
1165
1171
    Command.hooks.install_named_hook("get_command", _get_external_command,
1166
1172
        "bzr external command lookup")
1167
 
    Command.hooks.install_named_hook("get_missing_command", _try_plugin_provider,
1168
 
        "bzr plugin-provider-db check")
 
1173
    Command.hooks.install_named_hook("get_missing_command",
 
1174
                                     _try_plugin_provider,
 
1175
                                     "bzr plugin-provider-db check")
1169
1176
 
1170
1177
 
1171
1178