Rev 2600: Also check that option help ends in a period, and fix those that don't in http://sourcefrog.net/bzr/check-options

Martin Pool mbp at sourcefrog.net
Tue Jul 10 11:33:47 BST 2007


At http://sourcefrog.net/bzr/check-options

------------------------------------------------------------
revno: 2600
revision-id: mbp at sourcefrog.net-20070710103345-hwfpnzxcx1mfv31x
parent: mbp at sourcefrog.net-20070710102027-2os88re33c57m522
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: check-options
timestamp: Tue 2007-07-10 20:33:45 +1000
message:
  Also check that option help ends in a period, and fix those that don't
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/conflicts.py            conflicts.py-20051001061850-78ef952ba63d2b42
  bzrlib/option.py               option.py-20051014052914-661fb36e76e7362f
  bzrlib/sign_my_commits.py      sign_my_commits.py-20060215152201-5a6363365180e671
  bzrlib/tests/test_options.py   testoptions.py-20051014093702-96457cfc86319a8f
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2007-07-10 10:20:27 +0000
+++ b/bzrlib/builtins.py	2007-07-10 10:33:45 +0000
@@ -1715,20 +1715,22 @@
     _see_also = ['status', 'cat']
     takes_args = ['path?']
     # TODO: Take a revision or remote path and list that tree instead.
-    takes_options = ['verbose', 'revision',
-                     Option('non-recursive',
-                            help='Don\'t recurse into subdirectories.'),
-                     Option('from-root',
-                            help='Print all paths from the root of the branch.'),
-                     Option('unknown', help='Print unknown files'),
-                     Option('versioned', help='Print versioned files'),
-                     Option('ignored', help='Print ignored files'),
-                     Option('null',
-                            help='Write an ascii NUL (\\0) separator '
-                            'between files rather than a newline.'),
-                     'kind',
-                     'show-ids',
-                    ]
+    takes_options = [
+            'verbose',
+            'revision',
+            Option('non-recursive',
+                   help='Don\'t recurse into subdirectories.'),
+            Option('from-root',
+                   help='Print all paths from the root of the branch.'),
+            Option('unknown', help='Print unknown files.'),
+            Option('versioned', help='Print versioned files.'),
+            Option('ignored', help='Print ignored files.'),
+            Option('null',
+                   help='Write an ascii NUL (\\0) separator '
+                   'between files rather than a newline.'),
+            'kind',
+            'show-ids',
+            ]
     @display_command
     def run(self, revision=None, verbose=False, 
             non_recursive=False, from_root=False,
@@ -3515,15 +3517,17 @@
     takes_options = [
         RegistryOption.from_kwargs('patch-type',
             'The type of patch to include in the directive',
-            title='Patch type', value_switches=True, enum_switch=False,
-            bundle='Bazaar revision bundle (default)',
-            diff='Normal unified diff',
-            plain='No patch, just directive'),
-        Option('sign', help='GPG-sign the directive'), 'revision',
+            title='Patch type',
+            value_switches=True,
+            enum_switch=False,
+            bundle='Bazaar revision bundle (default).',
+            diff='Normal unified diff.',
+            plain='No patch, just directive.'),
+        Option('sign', help='GPG-sign the directive.'), 'revision',
         Option('mail-to', type=str,
-            help='Instead of printing the directive, email to this address'),
+            help='Instead of printing the directive, email to this address.'),
         Option('message', type=str, short_name='m',
-            help='Message to use when committing this merge')
+            help='Message to use when committing this merge.')
         ]
 
     encoding_type = 'exact'
@@ -3606,7 +3610,7 @@
             type=unicode,
             ),
         Option('force',
-            help='Replace existing tags',
+            help='Replace existing tags.',
             ),
         'revision',
         ]
@@ -3649,7 +3653,7 @@
     _see_also = ['tag']
     takes_options = [
         Option('directory',
-            help='Branch whose tags should be displayed',
+            help='Branch whose tags should be displayed.',
             short_name='d',
             type=unicode,
             ),

=== modified file 'bzrlib/conflicts.py'
--- a/bzrlib/conflicts.py	2007-07-10 10:20:27 +0000
+++ b/bzrlib/conflicts.py	2007-07-10 10:33:45 +0000
@@ -89,7 +89,9 @@
     """
     aliases = ['resolved']
     takes_args = ['file*']
-    takes_options = [Option('all', help='Resolve all conflicts in this tree')]
+    takes_options = [
+            Option('all', help='Resolve all conflicts in this tree.'),
+            ]
     def run(self, file_list=None, all=False):
         from bzrlib.workingtree import WorkingTree
         if all:

=== modified file 'bzrlib/option.py'
--- a/bzrlib/option.py	2007-07-10 10:20:27 +0000
+++ b/bzrlib/option.py	2007-07-10 10:33:45 +0000
@@ -395,7 +395,7 @@
 _global_option('revision',
                type=_parse_revision_str,
                short_name='r',
-               help='See \'help revisionspec\' for details')
+               help='See \'help revisionspec\' for details.')
 _global_option('show-ids',
                help='Show internal object ids.')
 _global_option('timezone',

=== modified file 'bzrlib/sign_my_commits.py'
--- a/bzrlib/sign_my_commits.py	2006-09-13 02:44:23 +0000
+++ b/bzrlib/sign_my_commits.py	2007-07-10 10:33:45 +0000
@@ -41,10 +41,11 @@
     # (both mainline and merged), but not other revisions that may be in the
     # repository
 
-    takes_options = [Option('dry-run'
-                            , help='Don\'t actually sign anything, just print'
-                                   ' the revisions that would be signed')
-                    ]
+    takes_options = [
+            Option('dry-run',
+                   help='Don\'t actually sign anything, just print'
+                        ' the revisions that would be signed.'),
+            ]
     takes_args = ['location?', 'committer?']
 
     def run(self, location=None, committer=None, dry_run=False):

=== modified file 'bzrlib/tests/test_options.py'
--- a/bzrlib/tests/test_options.py	2007-07-10 10:20:27 +0000
+++ b/bzrlib/tests/test_options.py	2007-07-10 10:33:45 +0000
@@ -298,7 +298,10 @@
 
     def test_option_grammar(self):
         msgs = []
-        option_re = re.compile(r'^[A-Z]')
+        # Option help should be written in sentence form, and have a final
+        # period and be all on a single line, because the display code will
+        # wrap it.
+        option_re = re.compile(r'^[A-Z][^\n]+\.$')
         for scope, option in self.get_all_options():
             if not option.help:
                 # TODO: Also complain about options that have no help message?




More information about the bazaar-commits mailing list