/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Jelmer Vernooij
  • Date: 2012-01-30 14:12:36 UTC
  • mfrom: (6437.3.28 2.5)
  • mto: This revision was merged to the branch mainline in revision 6522.
  • Revision ID: jelmer@samba.org-20120130141236-66k8qj1he6q2nq3r
Merge 2.5 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
 
17
from __future__ import absolute_import
17
18
 
18
19
# TODO: Define arguments by objects, rather than just using names.
19
20
# Those objects can specify the expected type of the argument, which
32
33
 
33
34
import bzrlib
34
35
from bzrlib import (
 
36
    config,
35
37
    cleanup,
36
38
    cmdline,
37
39
    debug,
50
52
from bzrlib.option import Option
51
53
from bzrlib.plugin import disable_plugins, load_plugins
52
54
from bzrlib import registry
53
 
from bzrlib.symbol_versioning import (
54
 
    deprecated_function,
55
 
    deprecated_in,
56
 
    deprecated_method,
57
 
    )
58
55
 
59
56
 
60
57
class CommandInfo(object):
663
660
            opts['quiet'] = trace.is_quiet()
664
661
        elif opts.has_key('quiet'):
665
662
            del opts['quiet']
666
 
 
667
663
        # mix arguments and options into one dictionary
668
664
        cmdargs = _match_argform(self.name(), self.takes_args, args)
669
665
        cmdopts = {}
816
812
    try:
817
813
        options, args = parser.parse_args(args)
818
814
    except UnicodeEncodeError,e:
819
 
        raise errors.BzrCommandError(gettext('Only ASCII permitted in option names'))
 
815
        raise errors.BzrCommandError(
 
816
            gettext('Only ASCII permitted in option names'))
820
817
 
821
818
    opts = dict([(k, v) for k, v in options.__dict__.iteritems() if
822
819
                 v is not option.OptionParser.DEFAULT_VALUE])
1040
1037
 
1041
1038
    argv_copy = []
1042
1039
    i = 0
 
1040
    override_config = []
1043
1041
    while i < len(argv):
1044
1042
        a = argv[i]
1045
1043
        if a == '--profile':
1068
1066
            pass # already handled in startup script Bug #588277
1069
1067
        elif a.startswith('-D'):
1070
1068
            debug.debug_flags.add(a[2:])
 
1069
        elif a.startswith('-O'):
 
1070
            override_config.append(a[2:])
1071
1071
        else:
1072
1072
            argv_copy.append(a)
1073
1073
        i += 1
1074
1074
 
 
1075
    if bzrlib.global_state is None:
 
1076
        # FIXME: Workaround for users that imported bzrlib but didn't call
 
1077
        # bzrlib.initialize -- vila 2012-01-19
 
1078
        cmdline_overrides = config.CommandLineStore()
 
1079
    else:
 
1080
        cmdline_overrides = bzrlib.global_state.cmdline_overrides
 
1081
    cmdline_overrides._from_cmdline(override_config)
 
1082
 
1075
1083
    debug.set_debug_flags_from_config()
1076
1084
 
1077
1085
    if not opt_no_plugins:
1129
1137
        if 'memory' in debug.debug_flags:
1130
1138
            trace.debug_memory('Process status after command:', short=False)
1131
1139
        option._verbosity_level = saved_verbosity_level
 
1140
        # Reset the overrides 
 
1141
        cmdline_overrides._reset()
1132
1142
 
1133
1143
 
1134
1144
def display_command(func):
1163
1173
        "bzr plugin commands")
1164
1174
    Command.hooks.install_named_hook("get_command", _get_external_command,
1165
1175
        "bzr external command lookup")
1166
 
    Command.hooks.install_named_hook("get_missing_command", _try_plugin_provider,
1167
 
        "bzr plugin-provider-db check")
 
1176
    Command.hooks.install_named_hook("get_missing_command",
 
1177
                                     _try_plugin_provider,
 
1178
                                     "bzr plugin-provider-db check")
1168
1179
 
1169
1180
 
1170
1181