Rev 2450: Add support for doing bzr help commands/COMMANDNAME. in file:///home/robertc/source/baz/help-contexts/
Robert Collins
robertc at robertcollins.net
Fri Apr 20 04:19:53 BST 2007
At file:///home/robertc/source/baz/help-contexts/
------------------------------------------------------------
revno: 2450
revision-id: robertc at robertcollins.net-20070420031949-sxckxqm8tjtk9tzn
parent: robertc at robertcollins.net-20070420030701-2val6cjy3eocu77y
committer: Robert Collins <robertc at robertcollins.net>
branch nick: help-contexts
timestamp: Fri 2007-04-20 13:19:49 +1000
message:
Add support for doing bzr help commands/COMMANDNAME.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/commands.py bzr.py-20050309040720-d10f4714595cf8c3
bzrlib/tests/test_help.py test_help.py-20070419045354-6q6rq15j9e2n5fna-1
=== modified file 'NEWS'
--- a/NEWS 2007-04-20 02:32:10 +0000
+++ b/NEWS 2007-04-20 03:19:49 +0000
@@ -24,6 +24,12 @@
* ``bzr help`` provides a clearer message when a help topic cannot be
found (fixes bug 107656). (Robert Collins)
+ * ``bzr help`` now accepts optional prefixes for command help. The help
+ for all commands can now be found at ``bzr help commands/COMMANDNAME``
+ as well as ``bzr help COMMANDNAME`` (which only works for commands
+ where the name is not the same as a more general help topic).
+ (Robert Collins)
+
INTERNALS:
* bzrlib API compatability with 0.8 has been dropped, cleaning up some
@@ -74,6 +80,9 @@
* Command objects can now declare related help topics by having _see_also
set to a list of related topic. (Robert Collins)
+ * ``bzrlib.help`` now delegates to the Command class for Command specific
+ help. (Robert Collins)
+
BUGFIXES:
* Don't fail bundle selftest if email has 'two' embedded.
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py 2007-04-20 03:07:01 +0000
+++ b/bzrlib/commands.py 2007-04-20 03:19:49 +0000
@@ -729,6 +729,8 @@
:return: A list which is either empty or contains a single
Command entry.
"""
+ if topic and topic.startswith(self.prefix):
+ topic = topic[len(self.prefix):]
try:
cmd = _get_cmd_object(topic)
except KeyError:
=== modified file 'bzrlib/tests/test_help.py'
--- a/bzrlib/tests/test_help.py 2007-04-20 03:07:01 +0000
+++ b/bzrlib/tests/test_help.py 2007-04-20 03:19:49 +0000
@@ -131,6 +131,13 @@
index = commands.HelpCommandIndex()
self.assertEqual('commands/', index.prefix)
+ def test_get_topic_with_prefix(self):
+ """Searching for commands/rocks returns the rocks command object."""
+ index = commands.HelpCommandIndex()
+ topics = index.get_topics('commands/rocks')
+ self.assertEqual(1, len(topics))
+ self.assertIsInstance(topics[0], builtins.cmd_rocks)
+
class TestHelpIndices(tests.TestCase):
"""Tests for the HelpIndices class."""
More information about the bazaar-commits
mailing list