~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Ian Clatworthy
  • Date: 2009-12-03 23:21:16 UTC
  • mfrom: (4852.4.1 RCStoVCS)
  • mto: This revision was merged to the branch mainline in revision 4860.
  • Revision ID: ian.clatworthy@canonical.com-20091203232116-f8igfvc6muqrn4yx
Revision Control -> Version Control in docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
from bzrlib.symbol_versioning import (
57
57
    deprecated_function,
58
58
    deprecated_in,
 
59
    deprecated_method,
59
60
    suppress_deprecation_warnings,
60
61
    )
61
62
 
101
102
            registry.Registry.register(self, k_unsquished, cmd,
102
103
                                       override_existing=decorate, info=info)
103
104
        except KeyError:
104
 
            trace.log_error('Two plugins defined the same command: %r' % k)
105
 
            trace.log_error('Not loading the one in %r' %
106
 
                            sys.modules[cmd.__module__])
107
 
            trace.log_error('Previously this command was registered from %r' %
108
 
                            sys.modules[previous.__module__])
 
105
            trace.warning('Two plugins defined the same command: %r' % k)
 
106
            trace.warning('Not loading the one in %r' %
 
107
                sys.modules[cmd.__module__])
 
108
            trace.warning('Previously this command was registered from %r' %
 
109
                sys.modules[previous.__module__])
109
110
        return previous
110
111
 
111
112
    def register_lazy(self, command_name, aliases, module_name):
383
384
        # List of standard options directly supported
384
385
        self.supported_std_options = []
385
386
 
 
387
    @deprecated_method(deprecated_in((2, 1, 0)))
386
388
    def _maybe_expand_globs(self, file_list):
387
389
        """Glob expand file_list if the platform does not do that itself.
388
390
 
 
391
        Not used anymore, now that the bzr command-line parser globs on
 
392
        Windows.
 
393
 
389
394
        :return: A possibly empty list of unicode paths.
390
395
 
391
396
        Introduced in bzrlib 0.18.
392
397
        """
393
 
        if not file_list:
394
 
            file_list = []
395
 
        if sys.platform == 'win32':
396
 
            file_list = win32utils.glob_expand(file_list)
397
 
        return list(file_list)
 
398
        return file_list
398
399
 
399
400
    def _usage(self):
400
401
        """Return single-line grammar for this command.
457
458
        # so we get <https://bugs.launchpad.net/bzr/+bug/249908>.  -- mbp
458
459
        # 20090319
459
460
        options = option.get_optparser(self.options()).format_option_help()
 
461
        # XXX: According to the spec, ReST option lists actually don't support 
 
462
        # options like --1.9 so that causes syntax errors (in Sphinx at least).
 
463
        # As that pattern always appears in the commands that break, we trap
 
464
        # on that and then format that block of 'format' options as a literal
 
465
        # block.
 
466
        if not plain and options.find('  --1.9  ') != -1:
 
467
            options = options.replace(' format:\n', ' format::\n\n', 1)
460
468
        if options.startswith('Options:'):
461
469
            result += ':' + options
462
470
        elif options.startswith('options:'):
932
940
 
933
941
    --coverage
934
942
        Generate line coverage report in the specified directory.
 
943
 
 
944
    --concurrency
 
945
        Specify the number of processes that can be run concurrently (selftest).
935
946
    """
936
947
    argv = list(argv)
937
948
    trace.mutter("bzr arguments: %r", argv)
962
973
            opt_no_aliases = True
963
974
        elif a == '--builtin':
964
975
            opt_builtin = True
 
976
        elif a == '--concurrency':
 
977
            os.environ['BZR_CONCURRENCY'] = argv[i + 1]
 
978
            i += 1
965
979
        elif a == '--coverage':
966
980
            opt_coverage_dir = argv[i + 1]
967
981
            i += 1
1028
1042
            ret = apply_coveraged(opt_coverage_dir, run, *run_argv)
1029
1043
        else:
1030
1044
            ret = run(*run_argv)
1031
 
        if 'memory' in debug.debug_flags:
1032
 
            trace.debug_memory('Process status after command:', short=False)
1033
1045
        return ret or 0
1034
1046
    finally:
1035
1047
        # reset, in case we may do other commands later within the same
1036
1048
        # process. Commands that want to execute sub-commands must propagate
1037
1049
        # --verbose in their own way.
 
1050
        if 'memory' in debug.debug_flags:
 
1051
            trace.debug_memory('Process status after command:', short=False)
1038
1052
        option._verbosity_level = saved_verbosity_level
1039
1053
 
1040
1054
 
1090
1104
 
1091
1105
    # Is this a final release version? If so, we should suppress warnings
1092
1106
    if bzrlib.version_info[3] == 'final':
1093
 
        suppress_deprecation_warnings(override=False)
 
1107
        suppress_deprecation_warnings(override=True)
1094
1108
    if argv is None:
1095
1109
        argv = osutils.get_unicode_argv()
1096
1110
    else:
1107
1121
        argv = new_argv
1108
1122
    ret = run_bzr_catch_errors(argv)
1109
1123
    trace.mutter("return code %d", ret)
 
1124
    osutils.report_extension_load_failures()
1110
1125
    return ret
1111
1126
 
1112
1127