Rev 2756: Ensure hidden options are hidden on the man page in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Aug 28 07:33:02 BST 2007


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 2756
revision-id: pqm at pqm.ubuntu.com-20070828063300-c92waanwl08dowu9
parent: pqm at pqm.ubuntu.com-20070828055422-9h8abp4darakavba
parent: aaron.bentley at utoronto.ca-20070828055853-13q2eewfz10fq8r2
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2007-08-28 07:33:00 +0100
message:
  Ensure hidden options are hidden on the man page
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/option.py               option.py-20051014052914-661fb36e76e7362f
  bzrlib/tests/test_options.py   testoptions.py-20051014093702-96457cfc86319a8f
  tools/doc_generate/autodoc_man.py bzrman.py-20050601153041-0ff7f74de456d15e
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.14
    merged: aaron.bentley at utoronto.ca-20070828055853-13q2eewfz10fq8r2
    parent: aaron.bentley at utoronto.ca-20070828051758-82dkroli8byt907q
    parent: pqm at pqm.ubuntu.com-20070828055422-9h8abp4darakavba
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: Aaron's mergeable stuff
    timestamp: Tue 2007-08-28 01:58:53 -0400
    message:
      Merge bzr.dev
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.13
    merged: aaron.bentley at utoronto.ca-20070828051758-82dkroli8byt907q
    parent: abentley at panoramicfeedback.com-20070824192723-q3iryq0vbbd3v954
    committer: Aaron Bentley <aaron.bentley at utoronto.ca>
    branch nick: Aaron's mergeable stuff
    timestamp: Tue 2007-08-28 01:17:58 -0400
    message:
      Update test from review suggestions
    ------------------------------------------------------------
    revno: 1551.2.49.1.40.1.22.1.42.1.31.1.39.1.17.1.77.1.3.1.12
    merged: abentley at panoramicfeedback.com-20070824192723-q3iryq0vbbd3v954
    parent: aaron.bentley at utoronto.ca-20070820052707-j2qddps1feq166j3
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: Aaron's mergeable stuff
    timestamp: Fri 2007-08-24 15:27:23 -0400
    message:
      Man page doesn't list hidden options (#131667)
=== modified file 'NEWS'
--- a/NEWS	2007-08-28 05:18:17 +0000
+++ b/NEWS	2007-08-28 05:58:53 +0000
@@ -42,6 +42,8 @@
     * ``BZR_PLUGIN_PATH`` may now contain trailing slashes.
       (Blake Winton, #129299)
 
+    * man page no longer lists hidden options (#131667, Aaron Bentley)
+
   IMPROVEMENTS:
 
     * ``pull`` and ``merge`` are much faster at installing bundle format 4.

=== modified file 'bzrlib/option.py'
--- a/bzrlib/option.py	2007-08-25 18:11:08 +0000
+++ b/bzrlib/option.py	2007-08-28 05:58:53 +0000
@@ -201,6 +201,9 @@
             argname = argname.upper()
         yield self.name, self.short_name(), argname, self.help
 
+    def is_hidden(self, name):
+        return False
+
 
 class ListOption(Option):
     """Option used to provide a list of values.
@@ -304,7 +307,7 @@
         if self.value_switches:
             for key in self.registry.keys():
                 option_strings = ['--%s' % key]
-                if getattr(self.registry.get_info(key), 'hidden', False):
+                if self.is_hidden(key):
                     help = optparse.SUPPRESS_HELP
                 else:
                     help = self.registry.get_help(key)
@@ -329,6 +332,11 @@
             for key in sorted(self.registry.keys()):
                 yield key, None, None, self.registry.get_help(key)
 
+    def is_hidden(self, name):
+        if name == self.name:
+            return Option.is_hidden(self, name)
+        return getattr(self.registry.get_info(name), 'hidden', False)
+
 
 class OptionParser(optparse.OptionParser):
     """OptionParser that raises exceptions instead of exiting"""

=== modified file 'bzrlib/tests/test_options.py'
--- a/bzrlib/tests/test_options.py	2007-08-09 05:16:53 +0000
+++ b/bzrlib/tests/test_options.py	2007-08-28 05:17:58 +0000
@@ -296,3 +296,13 @@
         if msgs:
             self.fail("The following options don't match the style guide:\n"
                     + '\n'.join(msgs))
+
+    def test_is_hidden(self):
+        registry = bzrdir.BzrDirFormatRegistry()
+        registry.register_metadir('hidden', 'HiddenFormat',
+            'hidden help text', hidden=True)
+        registry.register_metadir('visible', 'VisibleFormat',
+            'visible help text', hidden=False)
+        format = option.RegistryOption('format', '', registry, str)
+        self.assertTrue(format.is_hidden('hidden'))
+        self.assertFalse(format.is_hidden('visible'))

=== modified file 'tools/doc_generate/autodoc_man.py'
--- a/tools/doc_generate/autodoc_man.py	2007-08-06 09:13:43 +0000
+++ b/tools/doc_generate/autodoc_man.py	2007-08-24 19:27:23 +0000
@@ -112,6 +112,8 @@
         option_str = "\nOptions:\n"
         for option_name, option in sorted(options.items()):
             for name, short_name, argname, help in option.iter_switches():
+                if option.is_hidden(name):
+                    continue
                 l = '    --' + name
                 if argname is not None:
                     l += ' ' + argname




More information about the bazaar-commits mailing list