~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Martin Pool
  • Date: 2010-06-02 04:56:07 UTC
  • mto: This revision was merged to the branch mainline in revision 5279.
  • Revision ID: mbp@canonical.com-20100602045607-uhn6m12c9k5rjlxz
Change _LINUX_NL to _UNIX_NL

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2011 Canonical Ltd
 
1
# Copyright (C) 2005-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
222
222
    Use of all_command_names() is encouraged rather than builtin_command_names
223
223
    and/or plugin_command_names.
224
224
    """
225
 
    _register_builtin_commands()
226
225
    return builtin_command_registry.keys()
227
226
 
228
227
 
687
686
 
688
687
        self._setup_outf()
689
688
 
690
 
        try:
691
 
            return self.run(**all_cmd_args)
692
 
        finally:
693
 
            # reset it, so that other commands run in the same process won't
694
 
            # inherit state. Before we reset it, log any activity, so that it
695
 
            # gets properly tracked.
696
 
            ui.ui_factory.log_transport_activity(
697
 
                display=('bytes' in debug.debug_flags))
698
 
            trace.set_verbosity_level(0)
 
689
        return self.run(**all_cmd_args)
699
690
 
700
691
    def _setup_run(self):
701
692
        """Wrap the defined run method on self with a cleanup.
818
809
    else:
819
810
        args = argv
820
811
 
821
 
    # for python 2.5 and later, optparse raises this exception if a non-ascii
822
 
    # option name is given.  See http://bugs.python.org/issue2931
823
 
    try:
824
 
        options, args = parser.parse_args(args)
825
 
    except UnicodeEncodeError,e:
826
 
        raise errors.BzrCommandError('Only ASCII permitted in option names')
827
 
 
 
812
    options, args = parser.parse_args(args)
828
813
    opts = dict([(k, v) for k, v in options.__dict__.iteritems() if
829
814
                 v is not option.OptionParser.DEFAULT_VALUE])
830
815
    return args, opts
1069
1054
        elif a == '--coverage':
1070
1055
            opt_coverage_dir = argv[i + 1]
1071
1056
            i += 1
1072
 
        elif a == '--profile-imports':
1073
 
            pass # already handled in startup script Bug #588277
1074
1057
        elif a.startswith('-D'):
1075
1058
            debug.debug_flags.add(a[2:])
1076
1059
        else:
1205
1188
    argv = _specified_or_unicode_argv(argv)
1206
1189
    _register_builtin_commands()
1207
1190
    ret = run_bzr_catch_errors(argv)
 
1191
    bzrlib.ui.ui_factory.log_transport_activity(
 
1192
        display=('bytes' in debug.debug_flags))
1208
1193
    trace.mutter("return code %d", ret)
1209
1194
    return ret
1210
1195