Rev 2456: Add plugins as a help index. in file:///home/robertc/source/baz/help-contexts/

Robert Collins robertc at robertcollins.net
Fri Apr 20 05:17:55 BST 2007


At file:///home/robertc/source/baz/help-contexts/

------------------------------------------------------------
revno: 2456
revision-id: robertc at robertcollins.net-20070420041751-l6xl915vq4qxuzgh
parent: robertc at robertcollins.net-20070420041049-bgb64kfpv3fd13sr
committer: Robert Collins <robertc at robertcollins.net>
branch nick: help-contexts
timestamp: Fri 2007-04-20 14:17:51 +1000
message:
  Add plugins as a help index.
modified:
  bzrlib/help.py                 help.py-20050505025907-4dd7a6d63912f894
  bzrlib/plugin.py               plugin.py-20050622060424-829b654519533d69
  bzrlib/tests/test_help.py      test_help.py-20070419045354-6q6rq15j9e2n5fna-1
=== modified file 'bzrlib/help.py'
--- a/bzrlib/help.py	2007-04-20 04:10:49 +0000
+++ b/bzrlib/help.py	2007-04-20 04:17:51 +0000
@@ -29,6 +29,7 @@
     errors,
     help_topics,
     osutils,
+    plugin,
     )
 
 
@@ -112,6 +113,7 @@
         self.search_path = [
             help_topics.HelpTopicIndex(),
             _mod_commands.HelpCommandIndex(),
+            plugin.PluginsHelpIndex(),
             ]
 
     def _check_prefix_uniqueness(self):

=== modified file 'bzrlib/plugin.py'
--- a/bzrlib/plugin.py	2007-02-23 06:06:54 +0000
+++ b/bzrlib/plugin.py	2007-04-20 04:17:51 +0000
@@ -267,3 +267,13 @@
             warning('Unable to load plugin %r from %r'
                     % (name, zip_name))
             log_exception_quietly()
+
+
+class PluginsHelpIndex(object):
+    """A help index that returns help topics for plugins."""
+
+    def __init__(self):
+        self.prefix = 'plugins/'
+
+    def get_topics(self, topic):
+        return []

=== modified file 'bzrlib/tests/test_help.py'
--- a/bzrlib/tests/test_help.py	2007-04-20 04:08:31 +0000
+++ b/bzrlib/tests/test_help.py	2007-04-20 04:17:51 +0000
@@ -24,6 +24,7 @@
     errors,
     help,
     help_topics,
+    plugin,
     tests,
     )
 
@@ -175,13 +176,16 @@
     def test_default_search_path(self):
         """The default search path should include internal indexs."""
         indices = help.HelpIndices()
-        self.assertEqual(2, len(indices.search_path))
+        self.assertEqual(3, len(indices.search_path))
         # help topics should be searched in first.
         self.assertIsInstance(indices.search_path[0],
             help_topics.HelpTopicIndex)
         # with commands being search second.
         self.assertIsInstance(indices.search_path[1],
             commands.HelpCommandIndex)
+        # and plugins are a third index.
+        self.assertIsInstance(indices.search_path[2],
+            plugin.PluginsHelpIndex)
 
     def test_search_for_unknown_topic_raises(self):
         """Searching for an unknown topic should raise NoHelpTopic."""



More information about the bazaar-commits mailing list