Rev 2608: Clean up options that are registered globally and used once or not at all. in http://sourcefrog.net/bzr/check-options

Martin Pool mbp at sourcefrog.net
Wed Jul 11 06:08:51 BST 2007


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

------------------------------------------------------------
revno: 2608
revision-id: mbp at sourcefrog.net-20070711050413-hrgdcuhrujn974gc
parent: mbp at sourcefrog.net-20070711041852-u0owtlcd1rh9ri37
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: check-options
timestamp: Wed 2007-07-11 15:04:13 +1000
message:
  Clean up options that are registered globally and used once or not at all.
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/option.py               option.py-20051014052914-661fb36e76e7362f
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2007-07-11 03:46:34 +0000
+++ b/bzrlib/builtins.py	2007-07-11 05:04:13 +0000
@@ -338,9 +338,16 @@
     into a subdirectory of this one.
     """
     takes_args = ['file*']
-    takes_options = ['no-recurse', 'dry-run', 'verbose',
-                     Option('file-ids-from', type=unicode,
-                            help='Lookup file ids from this tree.')]
+    takes_options = [
+        Option('no-recurse',
+               ),
+        Option('dry-run',
+               help="Show what would be done, but don't actually do anything."),
+        'verbose',
+        Option('file-ids-from',
+               type=unicode,
+               help='Lookup file ids from this tree.'),
+        ]
     encoding_type = 'replace'
     _see_also = ['remove']
 
@@ -1386,7 +1393,9 @@
 
     _see_also = ['status']
     takes_args = ['file*']
-    takes_options = ['revision', 'diff-options',
+    takes_options = [
+        'revision',
+        Option('diff-options', type=str),
         Option('prefix', type=str,
                short_name='p',
                help='Set prefixes to added to old and new filenames, as '
@@ -1584,7 +1593,9 @@
     takes_options = [
             Option('forward',
                    help='Show from oldest to newest.'),
-            'timezone',
+            Option('timezone',
+                   type=str,
+                   help='Display timezone as local, original, or utc.'),
             Option('verbose',
                    short_name='v',
                    help='Show files changed in each revision.'),
@@ -1975,7 +1986,15 @@
          zip                          .zip
     """
     takes_args = ['dest', 'branch?']
-    takes_options = ['revision', 'format', 'root']
+    takes_options = [
+        Option('format',
+               help="Type of file to export to.",
+               type=unicode),
+        'revision',
+        Option('root',
+               type=str,
+               help="Name of the root directory inside the exported file."),
+        ]
     def run(self, dest, branch=None, revision=None, format=None, root=None):
         from bzrlib.export import export
 
@@ -2009,7 +2028,10 @@
     """
 
     _see_also = ['ls']
-    takes_options = ['revision', 'name-from-revision']
+    takes_options = [
+        Option('name-from-revision', help='The path name in the old tree.'),
+        'revision',
+        ]
     takes_args = ['filename']
     encoding_type = 'exact'
 
@@ -2103,7 +2125,9 @@
     _see_also = ['bugs', 'uncommit']
     takes_args = ['selected*']
     takes_options = [
-            'message',
+            Option('message', type=unicode,
+                   short_name='m',
+                   help="Description of the new revision."),
             'verbose',
              Option('unchanged',
                     help='Commit even if nothing has changed.'),
@@ -2595,7 +2619,13 @@
 
     _see_also = ['update', 'remerge', 'status-flags']
     takes_args = ['branch?']
-    takes_options = ['revision', 'force', 'merge-type', 'reprocess', 'remember',
+    takes_options = [
+        'revision',
+        Option('force',
+               help='Merge even if the destination tree has uncommitted changes.'),
+        'merge-type',
+        'reprocess',
+        'remember',
         Option('show-base', help="Show base revision text in "
                "conflicts."),
         Option('uncommitted', help='Apply uncommitted changes'
@@ -2605,11 +2635,11 @@
                 ' source rather than merging.  When this happens,'
                 ' you do not need to commit the result.'),
         Option('directory',
-            help='Branch to merge into, '
-                 'rather than the one containing the working directory.',
-            short_name='d',
-            type=unicode,
-            ),
+               help='Branch to merge into, '
+                    'rather than the one containing the working directory.',
+               short_name='d',
+               type=unicode,
+               ),
     ]
 
     def run(self, branch=None, revision=None, force=False, merge_type=None,

=== modified file 'bzrlib/option.py'
--- a/bzrlib/option.py	2007-07-11 04:15:48 +0000
+++ b/bzrlib/option.py	2007-07-11 05:04:13 +0000
@@ -369,28 +369,18 @@
 
 _global_option('overwrite', help='Ignore differences between branches and '
                'overwrite unconditionally.')
-_global_option('diff-options', type=str)
-_global_option('force')
-_global_option('format', type=unicode)
-_global_option('message', type=unicode,
-               short_name='m')
-_global_option('no-recurse')
 _global_option('revision',
                type=_parse_revision_str,
                short_name='r',
                help='See \'help revisionspec\' for details.')
 _global_option('show-ids',
                help='Show internal object ids.')
-_global_option('timezone',
-               type=str,
-               help='Display timezone as local, original, or utc.')
 _global_option('verbose',
                help='Display more information.',
                short_name='v')
 _global_registry_option('log-format', "Use specified log format.",
                         log.log_formatter_registry, value_switches=True,
                         title='Log format')
-_global_option('root', type=str)
 _global_registry_option('merge-type', 'Select a particular merge algorithm.',
                         _merge_type_registry, value_switches=True,
                         title='Merge algorithm')
@@ -398,9 +388,6 @@
                ' default.')
 _global_option('reprocess', help='Reprocess to reduce spurious conflicts.')
 _global_option('kind', type=str)
-_global_option('dry-run',
-               help="Show what would be done, but don't actually do anything.")
-_global_option('name-from-revision', help='The path name in the old tree.')
 
 _help_option = Option('help',
                       help='Show help message.',




More information about the bazaar-commits mailing list