41
40
each revision specifier supplied.
43
42
>>> _parse_revision_str('234')
44
[<RevisionSpec_dwim 234>]
43
[<RevisionSpec_revno 234>]
45
44
>>> _parse_revision_str('234..567')
46
[<RevisionSpec_dwim 234>, <RevisionSpec_dwim 567>]
45
[<RevisionSpec_revno 234>, <RevisionSpec_revno 567>]
47
46
>>> _parse_revision_str('..')
48
47
[<RevisionSpec None>, <RevisionSpec None>]
49
48
>>> _parse_revision_str('..234')
50
[<RevisionSpec None>, <RevisionSpec_dwim 234>]
49
[<RevisionSpec None>, <RevisionSpec_revno 234>]
51
50
>>> _parse_revision_str('234..')
52
[<RevisionSpec_dwim 234>, <RevisionSpec None>]
51
[<RevisionSpec_revno 234>, <RevisionSpec None>]
53
52
>>> _parse_revision_str('234..456..789') # Maybe this should be an error
54
[<RevisionSpec_dwim 234>, <RevisionSpec_dwim 456>, <RevisionSpec_dwim 789>]
53
[<RevisionSpec_revno 234>, <RevisionSpec_revno 456>, <RevisionSpec_revno 789>]
55
54
>>> _parse_revision_str('234....789') #Error ?
56
[<RevisionSpec_dwim 234>, <RevisionSpec None>, <RevisionSpec_dwim 789>]
55
[<RevisionSpec_revno 234>, <RevisionSpec None>, <RevisionSpec_revno 789>]
57
56
>>> _parse_revision_str('revid:test@other.com-234234')
58
57
[<RevisionSpec_revid revid:test@other.com-234234>]
59
58
>>> _parse_revision_str('revid:test@other.com-234234..revid:test@other.com-234235')
60
59
[<RevisionSpec_revid revid:test@other.com-234234>, <RevisionSpec_revid revid:test@other.com-234235>]
61
60
>>> _parse_revision_str('revid:test@other.com-234234..23')
62
[<RevisionSpec_revid revid:test@other.com-234234>, <RevisionSpec_dwim 23>]
61
[<RevisionSpec_revid revid:test@other.com-234234>, <RevisionSpec_revno 23>]
63
62
>>> _parse_revision_str('date:2005-04-12')
64
63
[<RevisionSpec_date date:2005-04-12>]
65
64
>>> _parse_revision_str('date:2005-04-12 12:24:33')
69
68
>>> _parse_revision_str('date:2005-04-12,12:24:33')
70
69
[<RevisionSpec_date date:2005-04-12,12:24:33>]
71
70
>>> _parse_revision_str('-5..23')
72
[<RevisionSpec_dwim -5>, <RevisionSpec_dwim 23>]
71
[<RevisionSpec_revno -5>, <RevisionSpec_revno 23>]
73
72
>>> _parse_revision_str('-5')
74
[<RevisionSpec_dwim -5>]
73
[<RevisionSpec_revno -5>]
75
74
>>> _parse_revision_str('123a')
76
[<RevisionSpec_dwim 123a>]
75
Traceback (most recent call last):
77
NoSuchRevisionSpec: No namespace registered for string: '123a'
77
78
>>> _parse_revision_str('abc')
78
[<RevisionSpec_dwim abc>]
79
Traceback (most recent call last):
81
NoSuchRevisionSpec: No namespace registered for string: 'abc'
79
82
>>> _parse_revision_str('branch:../branch2')
80
83
[<RevisionSpec_branch branch:../branch2>]
81
84
>>> _parse_revision_str('branch:../../branch2')
82
85
[<RevisionSpec_branch branch:../../branch2>]
83
86
>>> _parse_revision_str('branch:../../branch2..23')
84
[<RevisionSpec_branch branch:../../branch2>, <RevisionSpec_dwim 23>]
87
[<RevisionSpec_branch branch:../../branch2>, <RevisionSpec_revno 23>]
85
88
>>> _parse_revision_str('branch:..\\\\branch2')
86
89
[<RevisionSpec_branch branch:..\\branch2>]
87
90
>>> _parse_revision_str('branch:..\\\\..\\\\branch2..23')
88
[<RevisionSpec_branch branch:..\\..\\branch2>, <RevisionSpec_dwim 23>]
91
[<RevisionSpec_branch branch:..\\..\\branch2>, <RevisionSpec_revno 23>]
90
93
# TODO: Maybe move this into revisionspec.py
149
152
def __init__(self, name, help='', type=None, argname=None,
150
short_name=None, param_name=None, custom_callback=None,
153
short_name=None, param_name=None, custom_callback=None):
152
154
"""Make a new command option.
154
156
:param name: regular name of the command, used in the double-dash
155
form and also as the parameter to the command's run()
157
form and also as the parameter to the command's run()
156
158
method (unless param_name is specified).
158
160
:param help: help message displayed in command help
160
:param type: function called to parse the option argument, or
162
:param type: function called to parse the option argument, or
161
163
None (default) if this option doesn't take an argument.
163
165
:param argname: name of option argument, if any
521
492
_merge_type_registry = MergeTypeRegistry()
493
_merge_type_registry.register_lazy('merge3', 'bzrlib.merge', 'Merge3Merger',
494
"Native diff3-style merge")
522
495
_merge_type_registry.register_lazy('diff3', 'bzrlib.merge', 'Diff3Merger',
523
496
"Merge using external diff3")
497
_merge_type_registry.register_lazy('weave', 'bzrlib.merge', 'WeaveMerger',
524
499
_merge_type_registry.register_lazy('lca', 'bzrlib.merge', 'LCAMerger',
525
500
"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',
531
502
# Declare the standard options
532
503
_standard_option('help', short_name='h',
533
504
help='Show help message.')
534
_standard_option('usage',
535
help='Show usage message and options.')
536
505
_standard_option('verbose', short_name='v',
537
506
help='Display more information.',
538
507
custom_callback=_verbosity_level_callback)
543
512
# Declare commonly used options
544
513
_global_option('all')
514
_global_option('overwrite', help='Ignore differences between branches and '
515
'overwrite unconditionally.')
545
516
_global_option('basis', type=str)
546
517
_global_option('bound')
547
_global_option('change',
548
type=_parse_change_str,
550
param_name='revision',
551
help='Select changes introduced by the specified revision. See also "help revisionspec".')
552
518
_global_option('diff-options', type=str)
553
_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')
558
519
_global_option('file', type=unicode, short_name='F')
559
520
_global_option('force')
560
521
_global_option('format', type=unicode)
561
522
_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
_global_registry_option('log-format', "Use specified log format.",
566
lazy_registry=('bzrlib.log', 'log_formatter_registry'),
567
value_switches=True, title='Log format',
568
short_value_switches={'short': 'S'})
569
_global_option('long', help='Use detailed log format.'
570
' Same as --log-format long',
572
_global_registry_option('merge-type', 'Select a particular merge algorithm.',
573
_merge_type_registry, value_switches=True,
574
title='Merge algorithm')
575
523
_global_option('message', type=unicode,
577
525
help='Message string.')
578
_global_option('name-from-revision', help='The path name in the old tree.')
579
_global_option('no-backup')
580
526
_global_option('no-recurse')
581
_global_option('null', short_name='0',
582
help='Use an ASCII NUL (\\0) separator rather than '
584
_global_option('overwrite', help='Ignore differences between branches and '
585
'overwrite unconditionally.')
586
_global_option('pattern', type=str)
587
527
_global_option('profile',
588
528
help='Show performance profiling information.')
589
_global_option('reprocess', help='Reprocess to reduce spurious conflicts.')
590
_global_option('remember', help='Remember the specified location as a'
592
529
_global_option('revision',
593
530
type=_parse_revision_str,
595
532
help='See "help revisionspec" for details.')
596
_global_option('short', help='Use moderately short log format.'
597
' Same as --log-format short')
533
_global_option('change',
534
type=_parse_change_str,
536
param_name='revision',
537
help='Select changes introduced by the specified revision. See also "help revisionspec".')
598
538
_global_option('show-ids',
599
539
help='Show internal object ids.')
600
540
_global_option('timezone',
602
542
help='Display timezone as local, original, or utc.')
603
_global_option('root', type=str)
604
543
_global_option('unbound')
544
_global_option('version')
545
_global_option('email')
605
546
_global_option('update')
606
_global_option('version')
547
_global_registry_option('log-format', "Use specified log format.",
548
lazy_registry=('bzrlib.log', 'log_formatter_registry'),
549
value_switches=True, title='Log format')
550
_global_option('long', help='Use detailed log format. Same as --log-format long',
552
_global_option('short', help='Use moderately short log format. Same as --log-format short')
553
_global_option('line', help='Use log format with one line per revision. Same as --log-format line')
554
_global_option('root', type=str)
555
_global_option('no-backup')
556
_global_registry_option('merge-type', 'Select a particular merge algorithm.',
557
_merge_type_registry, value_switches=True,
558
title='Merge algorithm')
559
_global_option('pattern', type=str)
560
_global_option('remember', help='Remember the specified location as a'
562
_global_option('reprocess', help='Reprocess to reduce spurious conflicts.')
563
_global_option('kind', type=str)
564
_global_option('dry-run',
565
help="Show what would be done, but don't actually do anything.")
566
_global_option('name-from-revision', help='The path name in the old tree.')
608
568
diff_writer_registry = _mod_registry.Registry()
609
569
diff_writer_registry.register('plain', lambda x: x, 'Plaintext diff output.')