Rev 6302: (gz) Fix style checking testcase for option help (Martin Packman) in file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

Patch Queue Manager pqm at pqm.ubuntu.com
Fri Nov 25 16:28:43 UTC 2011


At file:///srv/pqm.bazaar-vcs.org/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 6302 [merge]
revision-id: pqm at pqm.ubuntu.com-20111125162842-2g618aviwm32lie4
parent: pqm at pqm.ubuntu.com-20111125160251-zz514fqebn1gqgbi
parent: martin.packman at canonical.com-20111123124323-iy1x7wovy0io0pxa
committer: Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2011-11-25 16:28:42 +0000
message:
  (gz) Fix style checking testcase for option help (Martin Packman)
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/config.py               config.py-20051011043216-070c74f4e9e338e8
  bzrlib/option.py               option.py-20051014052914-661fb36e76e7362f
  bzrlib/tests/test_options.py   testoptions.py-20051014093702-96457cfc86319a8f
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2011-11-17 19:50:38 +0000
+++ b/bzrlib/builtins.py	2011-11-25 16:28:42 +0000
@@ -558,7 +558,7 @@
     _see_also = ['info']
     takes_args = ['location?']
     takes_options = [
-        Option('tree', help='Show revno of working tree'),
+        Option('tree', help='Show revno of working tree.'),
         'revision',
         ]
 
@@ -606,7 +606,7 @@
         custom_help('directory',
             help='Branch to examine, '
                  'rather than the one containing the working directory.'),
-        Option('tree', help='Show revno of working tree'),
+        Option('tree', help='Show revno of working tree.'),
         ]
 
     @display_command
@@ -2514,10 +2514,10 @@
                    help='Do not report commits with more than one parent.'),
             Option('exclude-common-ancestry',
                    help='Display only the revisions that are not part'
-                   ' of both ancestries (require -rX..Y)'
+                   ' of both ancestries (require -rX..Y).'
                    ),
             Option('signatures',
-                   help='Show digital signature validity'),
+                   help='Show digital signature validity.'),
             ListOption('match',
                 short_name='m',
                 help='Show revisions whose properties match this '

=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py	2011-11-24 14:30:59 +0000
+++ b/bzrlib/config.py	2011-11-25 16:28:42 +0000
@@ -3481,13 +3481,13 @@
         # their own config files (or not) and will also address
         # http://pad.lv/788991 -- vila 20101115
         commands.Option('scope', help='Reduce the scope to the specified'
-                        ' configuration file',
+                        ' configuration file.',
                         type=unicode),
         commands.Option('all',
             help='Display all the defined values for the matching options.',
             ),
         commands.Option('remove', help='Remove the option from'
-                        ' the configuration file'),
+                        ' the configuration file.'),
         ]
 
     _see_also = ['configuration']

=== modified file 'bzrlib/option.py'
--- a/bzrlib/option.py	2011-11-14 14:32:15 +0000
+++ b/bzrlib/option.py	2011-11-23 12:43:23 +0000
@@ -553,7 +553,7 @@
                param_name='revision',
                help='Select changes introduced by the specified revision. See also "help revisionspec".')
 _global_option('directory', short_name='d', type=unicode,
-               help='Branch to operate on, instead of working directory')
+               help='Branch to operate on, instead of working directory.')
 _global_option('file', type=unicode, short_name='F')
 _global_registry_option('log-format', "Use specified log format.",
                         lazy_registry=('bzrlib.log', 'log_formatter_registry'),

=== modified file 'bzrlib/tests/test_options.py'
--- a/bzrlib/tests/test_options.py	2011-09-29 15:50:58 +0000
+++ b/bzrlib/tests/test_options.py	2011-11-23 11:19:21 +0000
@@ -341,43 +341,14 @@
 
     def get_builtin_command_options(self):
         g = []
-        for cmd_name in sorted(commands.all_command_names()):
+        commands.install_bzr_command_hooks()
+        for cmd_name in sorted(commands.builtin_command_names()):
             cmd = commands.get_cmd_object(cmd_name)
             for opt_name, opt in sorted(cmd.options().items()):
                 g.append((cmd_name, opt))
+        self.assert_(g)
         return g
 
-    def test_global_options_used(self):
-        # In the distant memory, options could only be declared globally.  Now
-        # we prefer to declare them in the command, unless like -r they really
-        # are used very widely with the exact same meaning.  So this checks
-        # for any that should be garbage collected.
-        g = dict(option.Option.OPTIONS.items())
-        used_globals = {}
-        msgs = []
-        for cmd_name in sorted(commands.all_command_names()):
-            cmd = commands.get_cmd_object(cmd_name)
-            for option_or_name in sorted(cmd.takes_options):
-                if not isinstance(option_or_name, basestring):
-                    self.assertIsInstance(option_or_name, option.Option)
-                elif not option_or_name in g:
-                    msgs.append("apparent reference to undefined "
-                        "global option %r from %r"
-                        % (option_or_name, cmd))
-                else:
-                    used_globals.setdefault(option_or_name, []).append(cmd_name)
-        unused_globals = set(g.keys()) - set(used_globals.keys())
-        # not enforced because there might be plugins that use these globals
-        ## for option_name in sorted(unused_globals):
-        ##    msgs.append("unused global option %r" % option_name)
-        ## for option_name, cmds in sorted(used_globals.items()):
-        ##     if len(cmds) <= 1:
-        ##         msgs.append("global option %r is only used by %r"
-        ##                 % (option_name, cmds))
-        if msgs:
-            self.fail("problems with global option definitions:\n"
-                    + '\n'.join(msgs))
-
     def test_option_grammar(self):
         msgs = []
         # Option help should be written in sentence form, and have a final
@@ -395,6 +366,9 @@
             self.fail("The following options don't match the style guide:\n"
                     + '\n'.join(msgs))
 
+
+class TestOptionMisc(TestCase):
+
     def test_is_hidden(self):
         registry = controldir.ControlDirFormatRegistry()
         bzrdir.register_metadir(registry, 'hidden', 'HiddenFormat',




More information about the bazaar-commits mailing list