~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/commands.py

  • Committer: Michael Ellerman
  • Date: 2006-06-18 23:19:23 UTC
  • mto: (1711.2.63 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1792.
  • Revision ID: michael@ellerman.id.au-20060618231923-8a362933a83c8660
Show which plugin (if any) provides a command.

Changes 'bzr help <foo>' and 'bzr help commands', to show which plugin
provides a command. If the command is a builtin the output is unchanged.
Tests included. Based on an original patch by Robert Widhopf-Fenk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
312
312
    def name(self):
313
313
        return _unsquish_command_name(self.__class__.__name__)
314
314
 
 
315
    def plugin_name(self):
 
316
        """Get the name of the plugin that provides this command.
 
317
 
 
318
        :return: The name of the plugin or None if the command is builtin.
 
319
        """
 
320
        mod_parts = self.__module__.split('.')
 
321
        if len(mod_parts) >= 3 and mod_parts[1] == 'plugins':
 
322
            return mod_parts[2]
 
323
        else:
 
324
            return None
 
325
 
315
326
 
316
327
def parse_spec(spec):
317
328
    """