~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Andrew Bennetts
  • Date: 2010-09-17 04:35:23 UTC
  • mfrom: (5050.17.20 2.2)
  • mto: This revision was merged to the branch mainline in revision 5431.
  • Revision ID: andrew.bennetts@canonical.com-20100917043523-c5t63gmvxqxmqh5j
Merge lp:bzr/2.2, including fixes for #625574, #636930, #254278.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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()
225
226
    return builtin_command_registry.keys()
226
227
 
227
228
 
397
398
            will not mangled.
398
399
 
399
400
    :cvar hooks: An instance of CommandHooks.
 
401
    :ivar __doc__: The help shown by 'bzr help command' for this command.
 
402
        This is set by assigning explicitly to __doc__ so that -OO can
 
403
        be used::
 
404
 
 
405
        class Foo(Command):
 
406
            __doc__ = "My help goes here"
400
407
    """
401
408
    aliases = []
402
409
    takes_args = []
407
414
 
408
415
    def __init__(self):
409
416
        """Construct an instance of this command."""
410
 
        if self.__doc__ == Command.__doc__:
411
 
            warn("No help message set for %r" % self)
412
417
        # List of standard options directly supported
413
418
        self.supported_std_options = []
414
419
        self._setup_run()
482
487
            message explaining how to obtain full help.
483
488
        """
484
489
        doc = self.help()
485
 
        if doc is None:
486
 
            raise NotImplementedError("sorry, no detailed help yet for %r" % self.name())
 
490
        if not doc:
 
491
            doc = "No help for this command."
487
492
 
488
493
        # Extract the summary (purpose) and sections out from the text
489
494
        purpose,sections,order = self._get_help_parts(doc)
1050
1055
        elif a == '--coverage':
1051
1056
            opt_coverage_dir = argv[i + 1]
1052
1057
            i += 1
 
1058
        elif a == '--profile-imports':
 
1059
            pass # already handled in startup script Bug #588277
1053
1060
        elif a.startswith('-D'):
1054
1061
            debug.debug_flags.add(a[2:])
1055
1062
        else:
1077
1084
    if not opt_no_aliases:
1078
1085
        alias_argv = get_alias(argv[0])
1079
1086
        if alias_argv:
1080
 
            user_encoding = osutils.get_user_encoding()
1081
 
            alias_argv = [a.decode(user_encoding) for a in alias_argv]
1082
1087
            argv[0] = alias_argv.pop(0)
1083
1088
 
1084
1089
    cmd = argv.pop(0)
1085
 
    # We want only 'ascii' command names, but the user may have typed
1086
 
    # in a Unicode name. In that case, they should just get a
1087
 
    # 'command not found' error later.
1088
 
 
1089
1090
    cmd_obj = get_cmd_object(cmd, plugins_override=not opt_builtin)
1090
1091
    run = cmd_obj.run_argv_aliases
1091
1092
    run_argv = [argv, alias_argv]