Rev 2449: Add prefixes to HelpIndexes. in file:///home/robertc/source/baz/help-contexts/

Robert Collins robertc at robertcollins.net
Fri Apr 20 04:07:03 BST 2007


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

------------------------------------------------------------
revno: 2449
revision-id: robertc at robertcollins.net-20070420030701-2val6cjy3eocu77y
parent: robertc at robertcollins.net-20070420025644-sxlhafhnmv46xgfs
committer: Robert Collins <robertc at robertcollins.net>
branch nick: help-contexts
timestamp: Fri 2007-04-20 13:07:01 +1000
message:
  Add prefixes to HelpIndexes.
modified:
  bzrlib/commands.py             bzr.py-20050309040720-d10f4714595cf8c3
  bzrlib/help_topics.py          help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
  bzrlib/tests/test_help.py      test_help.py-20070419045354-6q6rq15j9e2n5fna-1
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py	2007-04-20 02:48:34 +0000
+++ b/bzrlib/commands.py	2007-04-20 03:07:01 +0000
@@ -719,6 +719,9 @@
 class HelpCommandIndex(object):
     """A index for bzr help that returns commands."""
 
+    def __init__(self):
+        self.prefix = 'commands/'
+
     def get_topics(self, topic):
         """Search for topic amongst commands.
 

=== modified file 'bzrlib/help_topics.py'
--- a/bzrlib/help_topics.py	2007-04-20 02:48:34 +0000
+++ b/bzrlib/help_topics.py	2007-04-20 03:07:01 +0000
@@ -247,6 +247,9 @@
 class HelpTopicIndex(object):
     """A index for bzr help that returns topics."""
 
+    def __init__(self):
+        self.prefix = ''
+
     def get_topics(self, topic):
         """Search for topic in the HelpTopicRegistry.
 

=== modified file 'bzrlib/tests/test_help.py'
--- a/bzrlib/tests/test_help.py	2007-04-20 02:56:44 +0000
+++ b/bzrlib/tests/test_help.py	2007-04-20 03:07:01 +0000
@@ -97,6 +97,11 @@
         index = help_topics.HelpTopicIndex()
         self.assertEqual([], index.get_topics('nothing by this name'))
 
+    def test_prefix(self):
+        """TopicIndex has a prefix of ''."""
+        index = help_topics.HelpTopicIndex()
+        self.assertEqual('', index.prefix)
+
 
 class TestCommandIndex(tests.TestCase):
     """Tests for the HelpCommandIndex class."""
@@ -121,6 +126,11 @@
         index = commands.HelpCommandIndex()
         self.assertEqual([], index.get_topics('nothing by this name'))
 
+    def test_prefix(self):
+        """CommandIndex has a prefix of 'commands/'."""
+        index = commands.HelpCommandIndex()
+        self.assertEqual('commands/', index.prefix)
+
 
 class TestHelpIndices(tests.TestCase):
     """Tests for the HelpIndices class."""



More information about the bazaar-commits mailing list