Rev 2463: Review feedback and put help.command_usage back in as a deprecated function. in file:///home/robertc/source/baz/help-contexts/

Robert Collins robertc at robertcollins.net
Mon Apr 23 01:25:18 BST 2007


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

------------------------------------------------------------
revno: 2463
revision-id: robertc at robertcollins.net-20070423002453-6mw8b5sexbmlqer9
parent: robertc at robertcollins.net-20070420054437-5txpyqld8y7cl3k5
committer: Robert Collins <robertc at robertcollins.net>
branch nick: help-contexts
timestamp: Mon 2007-04-23 10:24:53 +1000
message:
  Review feedback and put help.command_usage back in as a deprecated function.
modified:
  bzrlib/commands.py             bzr.py-20050309040720-d10f4714595cf8c3
  bzrlib/help.py                 help.py-20050505025907-4dd7a6d63912f894
  bzrlib/tests/test_help.py      test_help.py-20070419045354-6q6rq15j9e2n5fna-1
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py	2007-04-20 05:39:19 +0000
+++ b/bzrlib/commands.py	2007-04-23 00:24:53 +0000
@@ -271,7 +271,7 @@
             raise NotImplementedError("sorry, no detailed help yet for %r" % self.name())
 
         result = ""
-        result += 'usage:%s\n' % self._usage()
+        result += 'usage: %s\n' % self._usage()
 
         if self.aliases:
             result += 'aliases:\n'

=== modified file 'bzrlib/help.py'
--- a/bzrlib/help.py	2007-04-20 05:44:37 +0000
+++ b/bzrlib/help.py	2007-04-23 00:24:53 +0000
@@ -30,6 +30,7 @@
     help_topics,
     osutils,
     plugin,
+    symbol_versioning,
     )
 
 
@@ -53,6 +54,11 @@
     outfile.write(_help_commands_to_text('commands'))
 
 
+ at symbol_versioning.deprecated_function(symbol_versioning.zero_sixteen)
+def command_usage(cmd):
+    return cmd._usage()
+
+
 def _help_commands_to_text(topic):
     """Generate the help text for the list of commands"""
     out = []
@@ -97,16 +103,18 @@
 
 
 class HelpIndices(object):
-    """An object to manage help in multiple indices.
+    """Maintainer of help topics across multiple indices.
     
-    This maintains a list of places to search for help. It is currently
-    separate to the HelpTopicRegistry because of its ordered nature, but
-    possibly we should instread structure it as a search within the registry
-    and add ordering and searching facilities to the registry. The registry
-    would probably need to be restructured to support that cleanly which is
-    why this has been implemented in parallel even though it does as a result
-    permit searching for help in indexs which are not discoverable via
+    It is currently separate to the HelpTopicRegistry because of its ordered
+    nature, but possibly we should instead structure it as a search within the
+    registry and add ordering and searching facilities to the registry. The
+    registry would probably need to be restructured to support that cleanly
+    which is why this has been implemented in parallel even though it does as a
+    result permit searching for help in indices which are not discoverable via
     'help topics'.
+
+    Each index has a unique prefix string, such as "commands", and contains
+    help topics which can be listed or searched.
     """
 
     def __init__(self):

=== modified file 'bzrlib/tests/test_help.py'
--- a/bzrlib/tests/test_help.py	2007-04-20 05:39:19 +0000
+++ b/bzrlib/tests/test_help.py	2007-04-23 00:24:53 +0000
@@ -50,7 +50,7 @@
             """A sample command."""
         cmd = cmd_Demo()
         helptext = cmd.get_help_text()
-        self.assertStartsWith(helptext, 'usage:bzr Demo')
+        self.assertStartsWith(helptext, 'usage: bzr Demo')
         self.assertEndsWith(helptext, 'show help message\n')
 
     def test_command_with_additional_see_also(self):



More information about the bazaar-commits mailing list