Rev 2427: (robertc) Merge see-also support for command help. (Robert Collins). in http://people.ubuntu.com/~robertc/baz2.0/integration

Robert Collins robertc at robertcollins.net
Thu Apr 19 08:13:20 BST 2007


At http://people.ubuntu.com/~robertc/baz2.0/integration

------------------------------------------------------------
revno: 2427
revision-id: robertc at robertcollins.net-20070419071317-p1pem58mcxxwbg9j
parent: robertc at robertcollins.net-20070419022744-pfdqz42kp1wizh43
parent: robertc at robertcollins.net-20070419053224-f5lkin1fbjj2ci0s
committer: Robert Collins <robertc at robertcollins.net>
branch nick: integration
timestamp: Thu 2007-04-19 17:13:17 +1000
message:
  (robertc) Merge see-also support for command help. (Robert Collins).
added:
  bzrlib/tests/test_help.py      test_help.py-20070419045354-6q6rq15j9e2n5fna-1
modified:
  HACKING                        HACKING-20050805200004-2a5dc975d870f78c
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/commands.py             bzr.py-20050309040720-d10f4714595cf8c3
  bzrlib/help.py                 help.py-20050505025907-4dd7a6d63912f894
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/blackbox/test_help.py test_help.py-20060216004358-4ee8a2a338f75a62
  bzrlib/tests/test_commands.py  test_command.py-20051019190109-3b17be0f52eaa7a8
  tools/doc_generate/autodoc_man.py bzrman.py-20050601153041-0ff7f74de456d15e
  tools/doc_generate/autodoc_rstx.py autodoc_rstx.py-20060420024836-3e0d4a526452193c
    ------------------------------------------------------------
    revno: 2425.1.4
    merged: robertc at robertcollins.net-20070419053224-f5lkin1fbjj2ci0s
    parent: robertc at robertcollins.net-20070419052137-vsncwlmi8epl5eel
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: see-also
    timestamp: Thu 2007-04-19 15:32:24 +1000
    message:
      Update the doc_generate logic to include see-also help topics.
      (Robert Collins)
    ------------------------------------------------------------
    revno: 2425.1.3
    merged: robertc at robertcollins.net-20070419052137-vsncwlmi8epl5eel
    parent: robertc at robertcollins.net-20070419045408-uvczw1fcfzprz7ep
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: see-also
    timestamp: Thu 2007-04-19 15:21:37 +1000
    message:
      Update existing builtin commands help text to use _see_also. (Robert Collins)
    ------------------------------------------------------------
    revno: 2425.1.2
    merged: robertc at robertcollins.net-20070419045408-uvczw1fcfzprz7ep
    parent: robertc at robertcollins.net-20070418083902-4o66h9fk7zeisvwa
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: see-also
    timestamp: Thu 2007-04-19 14:54:08 +1000
    message:
      ``bzr help`` now provides cross references to other help topics using the
      _see_also facility on command classes. (Robert Collins)
    ------------------------------------------------------------
    revno: 2425.1.1
    merged: robertc at robertcollins.net-20070418083902-4o66h9fk7zeisvwa
    parent: pqm at pqm.ubuntu.com-20070417080415-5vn25svmf95ki88z
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: see-also
    timestamp: Wed 2007-04-18 18:39:02 +1000
    message:
      Command objects can now declare related help topics by having _see_also
      set to a list of related topic. Updated the HACKING guide entry on
      documentation to be more clear about how the help for commands is
      generated and to reference this new feature. (Robert Collins)
=== added file 'bzrlib/tests/test_help.py'
--- a/bzrlib/tests/test_help.py	1970-01-01 00:00:00 +0000
+++ b/bzrlib/tests/test_help.py	2007-04-19 04:54:08 +0000
@@ -0,0 +1,46 @@
+# Copyright (C) 2007 Canonical Ltd
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+"""Unit tests for the bzrlib.help module."""
+
+from cStringIO import StringIO
+
+from bzrlib import (
+    commands,
+    help,
+    tests,
+    )
+
+
+class TestCommandHelp(tests.TestCase):
+    """Tests for help on commands."""
+
+    def test_command_help_includes_see_also(self):
+        class cmd_WithSeeAlso(commands.Command):
+            """A sample command."""
+            _see_also = ['foo', 'bar']
+        cmd = cmd_WithSeeAlso()
+        helpfile = StringIO()
+        help.help_on_command_object(cmd, 'cmd_sample', helpfile)
+        self.assertEqual('usage: bzr WithSeeAlso\n'
+            '\n'
+            'A sample command.\n'
+            '\n'
+            'Options:\n'
+            '  -h, --help  show help message\n'
+            '\n'
+            'See also: bar, foo\n',
+            helpfile.getvalue())

=== modified file 'HACKING'
--- a/HACKING	2007-04-11 10:46:19 +0000
+++ b/HACKING	2007-04-18 08:39:02 +0000
@@ -133,8 +133,19 @@
 Documentation
 =============
 
-If you change the behaviour of a command, please update its docstring
-in bzrlib/commands.py.  This is displayed by the 'bzr help' command.
+When you change bzrlib, please update the relevant documentation for the
+change you made: Changes to commands should update their help, and
+possibly end user tutorials; changes to the core library should be
+reflected in API documentation.
+
+Commands
+--------
+
+The docstring of a command is used by ``bzr help`` to generate help output
+for the command. The list 'takes_options' attribute on a command is used by
+``bzr help`` to document the options for the command - the command
+docstring does not need to document them. Finally, the '_see_also'
+attribute on a command can be used to reference other related help topics.
 
 NEWS file
 ---------

=== modified file 'NEWS'
--- a/NEWS	2007-04-19 02:27:44 +0000
+++ b/NEWS	2007-04-19 07:13:17 +0000
@@ -11,6 +11,11 @@
     * ``make docs`` now creates a man page at ``man1/bzr.1`` fixing bug 107388.
       (Robert Collins)
 
+    * ``bzr help`` now provides cross references to other help topics using
+      the _see_also facility on command classes. Likewise the bzr_man
+      documentation, and the bzr.1 man page also include this information.
+      (Robert Collins)
+
   INTERNALS:
 
     * bzrlib API compatability with 0.8 has been dropped, cleaning up some
@@ -58,6 +63,9 @@
      instances of those objects can share a lock if it has the right token.
      (Andrew Bennetts, Robert Collins)
 
+    * Command objects can now declare related help topics by having _see_also
+      set to a list of related topic. (Robert Collins)
+
   BUGFIXES:
 
     * Don't fail bundle selftest if email has 'two' embedded.  

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2007-04-17 06:26:23 +0000
+++ b/bzrlib/builtins.py	2007-04-19 05:21:37 +0000
@@ -189,6 +189,7 @@
     aliases = ['st', 'stat']
 
     encoding_type = 'replace'
+    _see_also = ['diff', 'revert']
     
     @display_command
     def run(self, show_ids=False, file_list=None, revision=None, short=False,
@@ -247,6 +248,7 @@
 
     To re-create the working tree, use "bzr checkout".
     """
+    _see_also = ['checkout']
 
     takes_args = ['location?']
 
@@ -276,6 +278,7 @@
     This is equal to the number of revisions on this branch.
     """
 
+    _see_also = ['info']
     takes_args = ['location?']
 
     @display_command
@@ -352,6 +355,7 @@
                      Option('file-ids-from', type=unicode,
                             help='Lookup file ids from here')]
     encoding_type = 'replace'
+    _see_also = ['remove']
 
     def run(self, file_list, no_recurse=False, dry_run=False, verbose=False,
             file_ids_from=None):
@@ -436,14 +440,11 @@
 
     It is also possible to restrict the list of files to a specific
     set. For example: bzr inventory --show-ids this/file
-
-    See also: bzr ls
     """
 
     hidden = True
-
+    _see_also = ['ls']
     takes_options = ['revision', 'show-ids', 'kind']
-
     takes_args = ['file*']
 
     @display_command
@@ -560,6 +561,7 @@
     location can be accessed.
     """
 
+    _see_also = ['push', 'update']
     takes_options = ['remember', 'overwrite', 'revision', 'verbose',
         Option('directory',
             help='branch to pull into, '
@@ -666,6 +668,7 @@
     location can be accessed.
     """
 
+    _see_also = ['pull', 'update']
     takes_options = ['remember', 'overwrite', 'verbose',
         Option('create-prefix',
                help='Create the path leading up to the branch '
@@ -848,6 +851,8 @@
     To retrieve the branch as of a particular revision, supply the --revision
     parameter, as in "branch foo/bar -r 5".
     """
+
+    _see_also = ['checkout']
     takes_args = ['from_location', 'to_location?']
     takes_options = ['revision']
     aliases = ['get', 'clone']
@@ -916,9 +921,9 @@
     parameter, as in "checkout foo/bar -r 5". Note that this will be immediately
     out of date [so you cannot commit] but it may be useful (i.e. to examine old
     code.)
+    """
 
-    See "help checkouts" for more information on checkouts.
-    """
+    _see_also = ['checkouts', 'branch']
     takes_args = ['branch_location?', 'to_location?']
     takes_options = ['revision',
                      Option('lightweight',
@@ -978,6 +983,7 @@
     # TODO: Option to show renames between two historical versions.
 
     # TODO: Only show renames under dir, rather than in the whole branch.
+    _see_also = ['status']
     takes_args = ['dir?']
 
     @display_command
@@ -1010,6 +1016,8 @@
     If you want to discard your local changes, you can just do a 
     'bzr revert' instead of 'bzr commit' after the update.
     """
+
+    _see_also = ['pull']
     takes_args = ['dir?']
     aliases = ['up']
 
@@ -1053,6 +1061,7 @@
 
     Branches and working trees will also report any missing revisions.
     """
+    _see_also = ['revno']
     takes_args = ['location?']
     takes_options = ['verbose']
 
@@ -1103,6 +1112,7 @@
     """
 
     hidden = True
+    _see_also = ['inventory', 'ls']
     takes_args = ['filename']
 
     @display_command
@@ -1155,6 +1165,8 @@
 
     The branch *MUST* be on a listable system such as local disk or sftp.
     """
+
+    _see_also = ['check']
     takes_args = ['branch?']
 
     def run(self, branch="."):
@@ -1165,6 +1177,8 @@
 
 class cmd_revision_history(Command):
     """Display the list of revision ids on a branch."""
+
+    _see_also = ['log']
     takes_args = ['location?']
 
     hidden = True
@@ -1179,6 +1193,8 @@
 
 class cmd_ancestry(Command):
     """List all revisions merged into this branch."""
+
+    _see_also = ['log', 'revision-history']
     takes_args = ['location?']
 
     hidden = True
@@ -1222,6 +1238,8 @@
         bzr status
         bzr commit -m 'imported project'
     """
+
+    _see_also = ['init-repo', 'branch', 'checkout']
     takes_args = ['location?']
     takes_options = [
          RegistryOption('format',
@@ -1293,6 +1311,7 @@
         (add files here)
     """
 
+    _see_also = ['init', 'branch', 'checkout']
     takes_args = ["location"]
     takes_options = [RegistryOption('format',
                             help='Specify a format for this repository. See'
@@ -1358,6 +1377,7 @@
 
     # TODO: This probably handles non-Unix newlines poorly.
 
+    _see_also = ['status']
     takes_args = ['file*']
     takes_options = ['revision', 'diff-options',
         Option('prefix', type=str,
@@ -1443,6 +1463,7 @@
     # directories with readdir, rather than stating each one.  Same
     # level of effort but possibly much less IO.  (Or possibly not,
     # if the directories are very large...)
+    _see_also = ['status', 'ls']
     takes_options = ['show-ids']
 
     @display_command
@@ -1468,11 +1489,10 @@
 
 class cmd_modified(Command):
     """List files modified in working tree.
-
-    See also: "bzr status".
     """
 
     hidden = True
+    _see_also = ['status', 'ls']
 
     @display_command
     def run(self):
@@ -1484,11 +1504,10 @@
 
 class cmd_added(Command):
     """List files added in working tree.
-
-    See also: "bzr status".
     """
 
     hidden = True
+    _see_also = ['status', 'ls']
 
     @display_command
     def run(self):
@@ -1520,6 +1539,7 @@
 
     The root is the nearest enclosing directory with a .bzr control
     directory."""
+
     takes_args = ['filename?']
     @display_command
     def run(self, filename=None):
@@ -1687,6 +1707,7 @@
     """List files in a tree.
     """
 
+    _see_also = ['status', 'cat']
     takes_args = ['path?']
     # TODO: Take a revision or remote path and list that tree instead.
     takes_options = ['verbose', 'revision',
@@ -1776,11 +1797,10 @@
 
 class cmd_unknowns(Command):
     """List unknown files.
-
-    See also: "bzr ls --unknown".
     """
 
     hidden = True
+    _see_also = ['ls']
 
     @display_command
     def run(self):
@@ -1821,6 +1841,8 @@
         bzr ignore 'lib/**/*.o'
         bzr ignore 'RE:lib/.*\.o'
     """
+
+    _see_also = ['status', 'ignored']
     takes_args = ['name_pattern*']
     takes_options = [
                      Option('old-default-rules',
@@ -1876,8 +1898,9 @@
 
 class cmd_ignored(Command):
     """List ignored files and the patterns that matched them.
+    """
 
-    See also: bzr ignore"""
+    _see_also = ['ignore']
     @display_command
     def run(self):
         tree = WorkingTree.open_containing(u'.')[0]
@@ -1972,6 +1995,7 @@
     binary file. 
     """
 
+    _see_also = ['ls']
     takes_options = ['revision', 'name-from-revision']
     takes_args = ['filename']
     encoding_type = 'exact'
@@ -2063,6 +2087,7 @@
 
     # XXX: verbose currently does nothing
 
+    _see_also = ['uncommit']
     takes_args = ['selected*']
     takes_options = ['message', 'verbose', 
                      Option('unchanged',
@@ -2160,6 +2185,8 @@
     This command checks various invariants about the branch storage to
     detect data corruption or bzr bugs.
     """
+
+    _see_also = ['reconcile']
     takes_args = ['branch?']
     takes_options = ['verbose']
 
@@ -2180,6 +2207,8 @@
     this command. When the default format has changed you may also be warned
     during other operations to upgrade.
     """
+
+    _see_also = ['check']
     takes_args = ['url?']
     takes_options = [
                     RegistryOption('format',
@@ -2248,6 +2277,8 @@
     If unset, the tree root directory name is used as the nickname
     To print the current nickname, execute with no argument.  
     """
+
+    _see_also = ['info']
     takes_args = ['nickname?']
     def run(self, nickname=None):
         branch = Branch.open_containing(u'.')[0]
@@ -2492,6 +2523,8 @@
     merge refuses to run if there are any uncommitted changes, unless
     --force is given.
     """
+
+    _see_also = ['update', 'remerge']
     takes_args = ['branch?']
     takes_options = ['revision', 'force', 'merge-type', 'reprocess', 'remember',
         Option('show-base', help="Show base revision text in "
@@ -2757,6 +2790,8 @@
     name.  If you name a directory, all the contents of that directory will be
     reverted.
     """
+
+    _see_also = ['cat', 'export']
     takes_options = ['revision', 'no-backup']
     takes_args = ['file*']
 
@@ -2796,9 +2831,9 @@
 
 class cmd_help(Command):
     """Show help on a command or other topic.
+    """
 
-    For a list of all available commands, say 'bzr help commands'.
-    """
+    _see_also = ['topics']
     takes_options = [Option('long', 'show help on all commands')]
     takes_args = ['topic?']
     aliases = ['?', '--help', '-?', '-h']
@@ -2845,6 +2880,8 @@
 
     OTHER_BRANCH may be local or remote.
     """
+
+    _see_also = ['merge', 'pull']
     takes_args = ['other_branch?']
     takes_options = [Option('reverse', 'Reverse the order of revisions'),
                      Option('mine-only', 
@@ -2947,7 +2984,7 @@
 
 class cmd_testament(Command):
     """Show testament (signing-form) of a revision."""
-    takes_options = ['revision', 
+    takes_options = ['revision',
                      Option('long', help='Produce long-format testament'), 
                      Option('strict', help='Produce a strict-format'
                             ' testament')]
@@ -3063,10 +3100,9 @@
 
     Once converted into a checkout, commits must succeed on the master branch
     before they will be applied to the local branch.
-
-    See "help checkouts" for more information on checkouts.
     """
 
+    _see_also = ['checkouts', 'unbind']
     takes_args = ['location?']
     takes_options = []
 
@@ -3095,10 +3131,9 @@
 
     After unbinding, the local branch is considered independent and subsequent
     commits will be local only.
-
-    See "help checkouts" for more information on checkouts.
     """
 
+    _see_also = ['checkouts', 'bind']
     takes_args = []
     takes_options = []
 
@@ -3123,6 +3158,7 @@
     # unreferenced information in 'branch-as-repository' branches.
     # TODO: jam 20060108 Add the ability for uncommit to remove unreferenced
     # information in shared branches as well.
+    _see_also = ['commit']
     takes_options = ['verbose', 'revision',
                     Option('dry-run', help='Don\'t actually make changes'),
                     Option('force', help='Say yes to all questions.')]
@@ -3279,6 +3315,7 @@
             sys.stdout.flush()
         smart_server.serve()
 
+
 class cmd_join(Command):
     """Combine a subtree into its containing tree.
     
@@ -3300,6 +3337,7 @@
     and merge, will recurse into the subtree.
     """
 
+    _see_also = ['split']
     takes_args = ['tree']
     takes_options = [Option('reference', 'join by reference')]
     hidden = True
@@ -3341,10 +3379,9 @@
     subdirectory will be converted into an independent tree, with its own
     branch.  Commits in the top-level tree will not apply to the new subtree.
     If you want that behavior, do "bzr join --reference TREE".
-
-    To undo this operation, do "bzr join TREE".
     """
 
+    _see_also = ['join']
     takes_args = ['tree']
 
     hidden = True
@@ -3460,6 +3497,7 @@
     --force, in which case the tag is moved to point to the new revision.
     """
 
+    _see_also = ['commit', 'tags']
     takes_args = ['tag_name']
     takes_options = [
         Option('delete',
@@ -3511,6 +3549,7 @@
     This tag shows a table of tag names and the revisions they reference.
     """
 
+    _see_also = ['tag']
     takes_options = [
         Option('directory',
             help='Branch whose tags should be displayed',

=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py	2007-03-21 01:34:41 +0000
+++ b/bzrlib/commands.py	2007-04-18 08:39:02 +0000
@@ -233,6 +233,15 @@
         if self.__doc__ == Command.__doc__:
             warn("No help message set for %r" % self)
 
+    def get_see_also(self):
+        """Return a list of help topics that are related to this ommand.
+        
+        The list is derived from the content of the _see_also attribute. Any
+        duplicates are removed and the result is in lexical order.
+        :return: A list of help topics.
+        """
+        return sorted(set(getattr(self, '_see_also', [])))
+
     def options(self):
         """Return dict of valid options for this command.
 

=== modified file 'bzrlib/help.py'
--- a/bzrlib/help.py	2006-12-14 21:45:21 +0000
+++ b/bzrlib/help.py	2007-04-19 04:54:08 +0000
@@ -83,12 +83,21 @@
     from bzrlib.commands import get_cmd_object
 
     cmdname = str(cmdname)
-
-    if outfile is None:
-        outfile = sys.stdout
-
     cmd_object = get_cmd_object(cmdname)
 
+    return help_on_command_object(cmd_object, cmdname, outfile)
+
+
+def help_on_command_object(cmd_object, cmdname, outfile=None):
+    """Generate help on the cmd_object with a supplied name of cmdname.
+
+    :param cmd_object: An instance of a Command.
+    :param cmdname: The user supplied name. This might be an alias for example.
+    :param outfile: A stream to write the help to.
+    """
+    if outfile is None:
+        outfile = sys.stdout
+
     doc = cmd_object.help()
     if doc is None:
         raise NotImplementedError("sorry, no detailed help yet for %r" % cmdname)
@@ -107,6 +116,11 @@
     if doc[-1] != '\n':
         outfile.write('\n')
     help_on_command_options(cmd_object, outfile)
+    see_also = cmd_object.get_see_also()
+    if see_also:
+        outfile.write('\nSee also: ')
+        outfile.write(', '.join(see_also))
+        outfile.write('\n')
 
 
 def help_on_command_options(cmd, outfile=None):

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2007-04-17 07:38:47 +0000
+++ b/bzrlib/tests/__init__.py	2007-04-19 04:54:08 +0000
@@ -2173,6 +2173,7 @@
                    'bzrlib.tests.test_gpg',
                    'bzrlib.tests.test_graph',
                    'bzrlib.tests.test_hashcache',
+                   'bzrlib.tests.test_help',
                    'bzrlib.tests.test_http',
                    'bzrlib.tests.test_http_response',
                    'bzrlib.tests.test_https_ca_bundle',

=== modified file 'bzrlib/tests/blackbox/test_help.py'
--- a/bzrlib/tests/blackbox/test_help.py	2007-02-02 00:16:10 +0000
+++ b/bzrlib/tests/blackbox/test_help.py	2007-04-19 04:54:08 +0000
@@ -91,4 +91,3 @@
         for line in help.split('\n'):
             if '--long' in line:
                 self.assertTrue('show help on all commands' in line)
-

=== modified file 'bzrlib/tests/test_commands.py'
--- a/bzrlib/tests/test_commands.py	2006-11-30 04:46:23 +0000
+++ b/bzrlib/tests/test_commands.py	2007-04-18 08:39:02 +0000
@@ -21,12 +21,13 @@
     commands,
     config,
     errors,
+    tests,
     )
 from bzrlib.commands import display_command
-from bzrlib.tests import TestCase, TestSkipped
-
-
-class TestCommands(TestCase):
+from bzrlib.tests import TestSkipped
+
+
+class TestCommands(tests.TestCase):
 
     def test_display_command(self):
         """EPIPE message is selectively suppressed"""
@@ -58,7 +59,7 @@
                           commands.run_bzr, ['log', u'--option\xb5'])
 
 
-class TestGetAlias(TestCase):
+class TestGetAlias(tests.TestCase):
 
     def _get_config(self, config_text):
         my_config = config.GlobalConfig()
@@ -93,3 +94,34 @@
             u"iam=whoami 'Erik B\u00e5gfors <erik at bagfors.nu>'\n")
         self.assertEqual([u'whoami', u'Erik B\u00e5gfors <erik at bagfors.nu>'],
                           commands.get_alias("iam", config=my_config))
+
+
+class TestSeeAlso(tests.TestCase):
+    """Tests for the see also functional of Command."""
+
+    def test_default_subclass_no_see_also(self):
+        class ACommand(commands.Command):
+            """A sample command."""
+        command = ACommand()
+        self.assertEqual([], command.get_see_also())
+
+    def test__see_also(self):
+        """When _see_also is defined, it sets the result of get_see_also()."""
+        class ACommand(commands.Command):
+            _see_also = ['bar', 'foo']
+        command = ACommand()
+        self.assertEqual(['bar', 'foo'], command.get_see_also())
+
+    def test_deduplication(self):
+        """Duplicates in _see_also are stripped out."""
+        class ACommand(commands.Command):
+            _see_also = ['foo', 'foo']
+        command = ACommand()
+        self.assertEqual(['foo'], command.get_see_also())
+
+    def test_sorted(self):
+        """_see_also is sorted by get_see_also."""
+        class ACommand(commands.Command):
+            _see_also = ['foo', 'bar']
+        command = ACommand()
+        self.assertEqual(['bar', 'foo'], command.get_see_also())

=== modified file 'tools/doc_generate/autodoc_man.py'
--- a/tools/doc_generate/autodoc_man.py	2007-03-26 09:59:49 +0000
+++ b/tools/doc_generate/autodoc_man.py	2007-04-19 05:32:24 +0000
@@ -131,7 +131,14 @@
         aliases_str += ', '.join(cmd.aliases)
         aliases_str += '\n'
 
-    return subsection_header + option_str + aliases_str + "\n" + doc + "\n"
+    see_also_str = ""
+    see_also = cmd.get_see_also()
+    if see_also:
+        see_also_str += '\nSee also: '
+        see_also_str += ', '.join(see_also)
+        see_also_str += '\n'
+
+    return subsection_header + option_str + aliases_str + see_also_str + "\n" + doc + "\n"
 
 
 man_preamble = """\

=== modified file 'tools/doc_generate/autodoc_rstx.py'
--- a/tools/doc_generate/autodoc_rstx.py	2007-03-27 00:35:29 +0000
+++ b/tools/doc_generate/autodoc_rstx.py	2007-04-19 05:32:24 +0000
@@ -135,7 +135,14 @@
         aliases_str += ', '.join(cmd.aliases)
         aliases_str += '\n'
 
-    return subsection_header + option_str + aliases_str + "\n" + doc + "\n"
+    see_also_str = ""
+    see_also = cmd.get_see_also()
+    if see_also:
+        see_also_str += '\n    See also: '
+        see_also_str += ', '.join(see_also)
+        see_also_str += '\n'
+
+    return subsection_header + option_str + aliases_str + see_also_str + "\n" + doc + "\n"
 
 
 ##



More information about the bazaar-commits mailing list