~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Jelmer Vernooij
  • Date: 2011-04-17 23:06:22 UTC
  • mto: This revision was merged to the branch mainline in revision 5803.
  • Revision ID: jelmer@samba.org-20110417230622-e52xsel9m0t0umcf
Add a RevisionTree.get_file_revision() method.

Show diffs side-by-side

added added

removed removed

Lines of Context:
273
273
    # Allow plugins to extend commands
274
274
    for hook in Command.hooks['extend_command']:
275
275
        hook(cmd)
276
 
    if getattr(cmd, 'invoked_as', None) is None:
277
 
        cmd.invoked_as = cmd_name
278
276
    return cmd
279
277
 
280
278
 
396
394
            sys.stdout is forced to be a binary stream, and line-endings
397
395
            will not mangled.
398
396
 
399
 
    :ivar invoked_as:
400
 
        A string indicating the real name under which this command was
401
 
        invoked, before expansion of aliases. 
402
 
        (This may be None if the command was constructed and run in-process.)
403
 
 
404
397
    :cvar hooks: An instance of CommandHooks.
405
 
 
406
398
    :ivar __doc__: The help shown by 'bzr help command' for this command.
407
399
        This is set by assigning explicitly to __doc__ so that -OO can
408
400
        be used::
414
406
    takes_args = []
415
407
    takes_options = []
416
408
    encoding_type = 'strict'
417
 
    invoked_as = None
418
409
 
419
410
    hidden = False
420
411
 
758
749
        return getdoc(self)
759
750
 
760
751
    def name(self):
761
 
        """Return the canonical name for this command.
762
 
 
763
 
        The name under which it was actually invoked is available in invoked_as.
764
 
        """
765
752
        return _unsquish_command_name(self.__class__.__name__)
766
753
 
767
754
    def plugin_name(self):
1044
1031
        Specify the number of processes that can be run concurrently (selftest).
1045
1032
    """
1046
1033
    trace.mutter("bazaar version: " + bzrlib.__version__)
1047
 
    argv = _specified_or_unicode_argv(argv)
 
1034
    argv = list(argv)
1048
1035
    trace.mutter("bzr arguments: %r", argv)
1049
1036
 
1050
1037
    opt_lsprof = opt_profile = opt_no_plugins = opt_builtin =  \
1190
1177
        new_argv = []
1191
1178
        try:
1192
1179
            # ensure all arguments are unicode strings
1193
 
            for a in argv:
 
1180
            for a in argv[1:]:
1194
1181
                if isinstance(a, unicode):
1195
1182
                    new_argv.append(a)
1196
1183
                else:
1212
1199
 
1213
1200
    :return: exit code of bzr command.
1214
1201
    """
1215
 
    if argv is not None:
1216
 
        argv = argv[1:]
 
1202
    argv = _specified_or_unicode_argv(argv)
1217
1203
    _register_builtin_commands()
1218
1204
    ret = run_bzr_catch_errors(argv)
1219
1205
    trace.mutter("return code %d", ret)