~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/option.py

  • Committer: Patch Queue Manager
  • Date: 2015-12-17 18:39:00 UTC
  • mfrom: (6606.1.2 fix-float)
  • Revision ID: pqm@pqm.ubuntu.com-20151217183900-0719du2uv1kwu3lc
(vila) Inline testtools private method to fix an issue in xenial (the
 private implementation has changed in an backward incompatible way).
 (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
# TODO: For things like --diff-prefix, we want a way to customize the display
18
18
# of the option argument.
19
19
 
 
20
from __future__ import absolute_import
 
21
 
20
22
import optparse
21
23
import re
22
24
 
475
477
    Option.STD_OPTIONS[name] = Option(name, **kwargs)
476
478
    Option.OPTIONS[name] = Option.STD_OPTIONS[name]
477
479
 
 
480
def _standard_list_option(name, **kwargs):
 
481
    """Register a standard option."""
 
482
    # All standard options are implicitly 'global' ones
 
483
    Option.STD_OPTIONS[name] = ListOption(name, **kwargs)
 
484
    Option.OPTIONS[name] = Option.STD_OPTIONS[name]
 
485
 
478
486
 
479
487
def _global_option(name, **kwargs):
480
488
    """Register a global option."""
513
521
            _verbosity_level = -1
514
522
 
515
523
 
516
 
class MergeTypeRegistry(_mod_registry.Registry):
517
 
 
518
 
    pass
519
 
 
520
 
 
521
 
_merge_type_registry = MergeTypeRegistry()
522
 
_merge_type_registry.register_lazy('diff3', 'bzrlib.merge', 'Diff3Merger',
523
 
                                   "Merge using external diff3")
524
 
_merge_type_registry.register_lazy('lca', 'bzrlib.merge', 'LCAMerger',
525
 
                                   "LCA-newness merge")
526
 
_merge_type_registry.register_lazy('merge3', 'bzrlib.merge', 'Merge3Merger',
527
 
                                   "Native diff3-style merge")
528
 
_merge_type_registry.register_lazy('weave', 'bzrlib.merge', 'WeaveMerger',
529
 
                                   "Weave-based merge")
530
 
 
531
524
# Declare the standard options
532
525
_standard_option('help', short_name='h',
533
526
                 help='Show help message.')
 
527
_standard_option('quiet', short_name='q',
 
528
                 help="Only display errors and warnings.",
 
529
                 custom_callback=_verbosity_level_callback)
534
530
_standard_option('usage',
535
531
                 help='Show usage message and options.')
536
532
_standard_option('verbose', short_name='v',
537
533
                 help='Display more information.',
538
534
                 custom_callback=_verbosity_level_callback)
539
 
_standard_option('quiet', short_name='q',
540
 
                 help="Only display errors and warnings.",
541
 
                 custom_callback=_verbosity_level_callback)
542
535
 
543
536
# Declare commonly used options
544
 
_global_option('all')
545
 
_global_option('basis', type=str)
546
 
_global_option('bound')
547
537
_global_option('change',
548
538
               type=_parse_change_str,
549
539
               short_name='c',
550
540
               param_name='revision',
551
541
               help='Select changes introduced by the specified revision. See also "help revisionspec".')
552
 
_global_option('diff-options', type=str)
553
542
_global_option('directory', short_name='d', type=unicode,
554
 
               help='Branch to operate on, instead of working directory')
555
 
_global_option('dry-run',
556
 
               help="Show what would be done, but don't actually do anything.")
557
 
_global_option('email')
 
543
               help='Branch to operate on, instead of working directory.')
558
544
_global_option('file', type=unicode, short_name='F')
559
 
_global_option('force')
560
 
_global_option('format', type=unicode)
561
 
_global_option('forward')
562
 
_global_option('kind', type=str)
563
 
_global_option('line', help='Use log format with one line per revision.'
564
 
               ' Same as --log-format line')
565
545
_global_registry_option('log-format', "Use specified log format.",
566
546
                        lazy_registry=('bzrlib.log', 'log_formatter_registry'),
567
547
                        value_switches=True, title='Log format',
568
548
                        short_value_switches={'short': 'S'})
569
 
_global_option('long', help='Use detailed log format.'
570
 
               ' Same as --log-format long',
571
 
               short_name='l')
572
549
_global_registry_option('merge-type', 'Select a particular merge algorithm.',
573
 
                        _merge_type_registry, value_switches=True,
574
 
                        title='Merge algorithm')
 
550
                        lazy_registry=('bzrlib.merge', 'merge_type_registry'),
 
551
                        value_switches=True, title='Merge algorithm')
575
552
_global_option('message', type=unicode,
576
553
               short_name='m',
577
554
               help='Message string.')
578
 
_global_option('name-from-revision', help='The path name in the old tree.')
579
 
_global_option('no-backup')
580
 
_global_option('no-recurse')
581
555
_global_option('null', short_name='0',
582
556
                 help='Use an ASCII NUL (\\0) separator rather than '
583
557
                      'a newline.')
584
558
_global_option('overwrite', help='Ignore differences between branches and '
585
559
               'overwrite unconditionally.')
586
 
_global_option('pattern', type=str)
587
 
_global_option('profile',
588
 
               help='Show performance profiling information.')
589
 
_global_option('reprocess', help='Reprocess to reduce spurious conflicts.')
590
560
_global_option('remember', help='Remember the specified location as a'
591
561
               ' default.')
 
562
_global_option('reprocess', help='Reprocess to reduce spurious conflicts.')
592
563
_global_option('revision',
593
564
               type=_parse_revision_str,
594
565
               short_name='r',
595
566
               help='See "help revisionspec" for details.')
596
 
_global_option('short', help='Use moderately short log format.'
597
 
               ' Same as --log-format short')
598
567
_global_option('show-ids',
599
568
               help='Show internal object ids.')
600
569
_global_option('timezone',
601
570
               type=str,
602
571
               help='Display timezone as local, original, or utc.')
603
 
_global_option('root', type=str)
604
 
_global_option('unbound')
605
 
_global_option('update')
606
 
_global_option('version')
607
572
 
608
573
diff_writer_registry = _mod_registry.Registry()
609
574
diff_writer_registry.register('plain', lambda x: x, 'Plaintext diff output.')