~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Martin
  • Date: 2009-11-07 08:02:13 UTC
  • mfrom: (4789 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4809.
  • Revision ID: gzlist@googlemail.com-20091107080213-jad185091b3l69ih
Merge bzr.dev 4789 to resolve conflict from the disabling of plink auto-detection, and relocate NEWS

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:'):
1028
1036
            ret = apply_coveraged(opt_coverage_dir, run, *run_argv)
1029
1037
        else:
1030
1038
            ret = run(*run_argv)
1031
 
        if 'memory' in debug.debug_flags:
1032
 
            trace.debug_memory('Process status after command:', short=False)
1033
1039
        return ret or 0
1034
1040
    finally:
1035
1041
        # reset, in case we may do other commands later within the same
1036
1042
        # process. Commands that want to execute sub-commands must propagate
1037
1043
        # --verbose in their own way.
 
1044
        if 'memory' in debug.debug_flags:
 
1045
            trace.debug_memory('Process status after command:', short=False)
1038
1046
        option._verbosity_level = saved_verbosity_level
1039
1047
 
1040
1048
 
1090
1098
 
1091
1099
    # Is this a final release version? If so, we should suppress warnings
1092
1100
    if bzrlib.version_info[3] == 'final':
1093
 
        suppress_deprecation_warnings(override=False)
 
1101
        suppress_deprecation_warnings(override=True)
1094
1102
    if argv is None:
1095
1103
        argv = osutils.get_unicode_argv()
1096
1104
    else:
1107
1115
        argv = new_argv
1108
1116
    ret = run_bzr_catch_errors(argv)
1109
1117
    trace.mutter("return code %d", ret)
 
1118
    osutils.report_extension_load_failures()
1110
1119
    return ret
1111
1120
 
1112
1121