Rev 6156: Sort options by name to make it easier to add a new one. in http://bazaar.launchpad.net/~vila/bzr/integration/

Vincent Ladeuil v.ladeuil+lp at free.fr
Thu Sep 22 13:08:58 UTC 2011


At http://bazaar.launchpad.net/~vila/bzr/integration/

------------------------------------------------------------
revno: 6156 [merge]
revision-id: v.ladeuil+lp at free.fr-20110922130858-bgl2jio0g356jqv5
parent: v.ladeuil+lp at free.fr-20110921144529-2am6n8ys2nzwetwe
parent: v.ladeuil+lp at free.fr-20110922130753-q1ozn88kcy9g1q6h
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: trunk
timestamp: Thu 2011-09-22 15:08:58 +0200
message:
  Sort options by name to make it easier to add a new one.
modified:
  bzrlib/option.py               option.py-20051014052914-661fb36e76e7362f
-------------- next part --------------
=== modified file 'bzrlib/option.py'
--- a/bzrlib/option.py	2011-09-01 15:45:57 +0000
+++ b/bzrlib/option.py	2011-09-22 13:07:53 +0000
@@ -332,7 +332,8 @@
         :param short_name: The short name for the enum switch, if any
         :param short_value_switches: A dict mapping values to short names
         """
-        Option.__init__(self, name, help, type=self.convert, short_name=short_name)
+        Option.__init__(self, name, help, type=self.convert,
+                        short_name=short_name)
         self._registry = registry
         if registry is None:
             if lazy_registry is None:
@@ -437,6 +438,7 @@
     def error(self, message):
         raise errors.BzrCommandError(message)
 
+
 class GettextIndentedHelpFormatter(optparse.IndentedHelpFormatter):
     """Adds gettext() call to format_option()"""
     def __init__(self):
@@ -448,6 +450,7 @@
             option.help = i18n.gettext(option.help)
         return optparse.IndentedHelpFormatter.format_option(self, option)
 
+
 def get_optparser(options):
     """Generate an optparse parser for bzrlib-style options"""
 
@@ -516,88 +519,91 @@
 
 
 _merge_type_registry = MergeTypeRegistry()
+_merge_type_registry.register_lazy('diff3', 'bzrlib.merge', 'Diff3Merger',
+                                   "Merge using external diff3")
+_merge_type_registry.register_lazy('lca', 'bzrlib.merge', 'LCAMerger',
+                                   "LCA-newness merge")
 _merge_type_registry.register_lazy('merge3', 'bzrlib.merge', 'Merge3Merger',
                                    "Native diff3-style merge")
-_merge_type_registry.register_lazy('diff3', 'bzrlib.merge', 'Diff3Merger',
-                                   "Merge using external diff3")
 _merge_type_registry.register_lazy('weave', 'bzrlib.merge', 'WeaveMerger',
                                    "Weave-based merge")
-_merge_type_registry.register_lazy('lca', 'bzrlib.merge', 'LCAMerger',
-                                   "LCA-newness merge")
 
 # Declare the standard options
 _standard_option('help', short_name='h',
                  help='Show help message.')
+_standard_option('quiet', short_name='q',
+                 help="Only display errors and warnings.",
+                 custom_callback=_verbosity_level_callback)
 _standard_option('usage',
                  help='Show usage message and options.')
 _standard_option('verbose', short_name='v',
                  help='Display more information.',
                  custom_callback=_verbosity_level_callback)
-_standard_option('quiet', short_name='q',
-                 help="Only display errors and warnings.",
-                 custom_callback=_verbosity_level_callback)
 
 # Declare commonly used options
 _global_option('all')
-_global_option('overwrite', help='Ignore differences between branches and '
-               'overwrite unconditionally.')
 _global_option('basis', type=str)
 _global_option('bound')
+_global_option('change',
+               type=_parse_change_str,
+               short_name='c',
+               param_name='revision',
+               help='Select changes introduced by the specified revision. See also "help revisionspec".')
 _global_option('diff-options', type=str)
+_global_option('directory', short_name='d', type=unicode,
+               help='Branch to operate on, instead of working directory')
+_global_option('dry-run',
+               help="Show what would be done, but don't actually do anything.")
+_global_option('email')
 _global_option('file', type=unicode, short_name='F')
 _global_option('force')
 _global_option('format', type=unicode)
 _global_option('forward')
+_global_option('kind', type=str)
+_global_option('line', help='Use log format with one line per revision.'
+               ' Same as --log-format line')
+_global_registry_option('log-format', "Use specified log format.",
+                        lazy_registry=('bzrlib.log', 'log_formatter_registry'),
+                        value_switches=True, title='Log format',
+                        short_value_switches={'short': 'S'})
+_global_option('long', help='Use detailed log format.'
+               ' Same as --log-format long',
+               short_name='l')
+_global_registry_option('merge-type', 'Select a particular merge algorithm.',
+                        _merge_type_registry, value_switches=True,
+                        title='Merge algorithm')
 _global_option('message', type=unicode,
                short_name='m',
                help='Message string.')
+_global_option('name-from-revision', help='The path name in the old tree.')
+_global_option('no-backup')
 _global_option('no-recurse')
 _global_option('null', short_name='0',
                  help='Use an ASCII NUL (\\0) separator rather than '
                       'a newline.')
+_global_option('overwrite', help='Ignore differences between branches and '
+               'overwrite unconditionally.')
+_global_option('pattern', type=str)
 _global_option('profile',
                help='Show performance profiling information.')
+_global_option('reprocess', help='Reprocess to reduce spurious conflicts.')
+_global_option('remember', help='Remember the specified location as a'
+               ' default.')
 _global_option('revision',
                type=_parse_revision_str,
                short_name='r',
                help='See "help revisionspec" for details.')
-_global_option('change',
-               type=_parse_change_str,
-               short_name='c',
-               param_name='revision',
-               help='Select changes introduced by the specified revision. See also "help revisionspec".')
+_global_option('short', help='Use moderately short log format.'
+               ' Same as --log-format short')
 _global_option('show-ids',
                help='Show internal object ids.')
 _global_option('timezone',
                type=str,
                help='Display timezone as local, original, or utc.')
+_global_option('root', type=str)
 _global_option('unbound')
+_global_option('update')
 _global_option('version')
-_global_option('email')
-_global_option('update')
-_global_registry_option('log-format', "Use specified log format.",
-                        lazy_registry=('bzrlib.log', 'log_formatter_registry'),
-                        value_switches=True, title='Log format',
-                        short_value_switches={'short': 'S'})
-_global_option('long', help='Use detailed log format. Same as --log-format long',
-               short_name='l')
-_global_option('short', help='Use moderately short log format. Same as --log-format short')
-_global_option('line', help='Use log format with one line per revision. Same as --log-format line')
-_global_option('root', type=str)
-_global_option('no-backup')
-_global_registry_option('merge-type', 'Select a particular merge algorithm.',
-                        _merge_type_registry, value_switches=True,
-                        title='Merge algorithm')
-_global_option('pattern', type=str)
-_global_option('remember', help='Remember the specified location as a'
-               ' 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.')
-_global_option('directory', short_name='d', type=unicode,
-               help='Branch to operate on, instead of working directory')
 
 diff_writer_registry = _mod_registry.Registry()
 diff_writer_registry.register('plain', lambda x: x, 'Plaintext diff output.')



More information about the bazaar-commits mailing list