~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-02-26 14:14:36 UTC
  • mfrom: (5058.2.1 commandlookup)
  • Revision ID: pqm@pqm.ubuntu.com-20100226141436-t8s3uqt5w9ktt04g
(robertc) Do not call Commands.hooks[get_missing_command] when
        looking up help topics. (Robert Collins, bug 396261)

Show diffs side-by-side

added added

removed removed

Lines of Context:
199
199
        raise errors.BzrCommandError('unknown command "%s"' % cmd_name)
200
200
 
201
201
 
202
 
def _get_cmd_object(cmd_name, plugins_override=True):
 
202
def _get_cmd_object(cmd_name, plugins_override=True, check_missing=True):
203
203
    """Get a command object.
204
204
 
205
205
    :param cmd_name: The name of the command.
206
206
    :param plugins_override: Allow plugins to override builtins.
 
207
    :param check_missing: Look up commands not found in the regular index via
 
208
        the get_missing_command hook.
207
209
    :return: A Command object instance
208
210
    :raises KeyError: If no command is found.
209
211
    """
219
221
            # We've found a non-plugin command, don't permit it to be
220
222
            # overridden.
221
223
            break
222
 
    if cmd is None:
 
224
    if cmd is None and check_missing:
223
225
        for hook in Command.hooks['get_missing_command']:
224
226
            cmd = hook(cmd_name)
225
227
            if cmd is not None:
1166
1168
        if topic and topic.startswith(self.prefix):
1167
1169
            topic = topic[len(self.prefix):]
1168
1170
        try:
1169
 
            cmd = _get_cmd_object(topic)
 
1171
            cmd = _get_cmd_object(topic, check_missing=False)
1170
1172
        except KeyError:
1171
1173
            return []
1172
1174
        else: