43
40
each revision specifier supplied.
45
42
>>> _parse_revision_str('234')
46
[<RevisionSpec_dwim 234>]
43
[<RevisionSpec_revno 234>]
47
44
>>> _parse_revision_str('234..567')
48
[<RevisionSpec_dwim 234>, <RevisionSpec_dwim 567>]
45
[<RevisionSpec_revno 234>, <RevisionSpec_revno 567>]
49
46
>>> _parse_revision_str('..')
50
47
[<RevisionSpec None>, <RevisionSpec None>]
51
48
>>> _parse_revision_str('..234')
52
[<RevisionSpec None>, <RevisionSpec_dwim 234>]
49
[<RevisionSpec None>, <RevisionSpec_revno 234>]
53
50
>>> _parse_revision_str('234..')
54
[<RevisionSpec_dwim 234>, <RevisionSpec None>]
51
[<RevisionSpec_revno 234>, <RevisionSpec None>]
55
52
>>> _parse_revision_str('234..456..789') # Maybe this should be an error
56
[<RevisionSpec_dwim 234>, <RevisionSpec_dwim 456>, <RevisionSpec_dwim 789>]
53
[<RevisionSpec_revno 234>, <RevisionSpec_revno 456>, <RevisionSpec_revno 789>]
57
54
>>> _parse_revision_str('234....789') #Error ?
58
[<RevisionSpec_dwim 234>, <RevisionSpec None>, <RevisionSpec_dwim 789>]
55
[<RevisionSpec_revno 234>, <RevisionSpec None>, <RevisionSpec_revno 789>]
59
56
>>> _parse_revision_str('revid:test@other.com-234234')
60
57
[<RevisionSpec_revid revid:test@other.com-234234>]
61
58
>>> _parse_revision_str('revid:test@other.com-234234..revid:test@other.com-234235')
62
59
[<RevisionSpec_revid revid:test@other.com-234234>, <RevisionSpec_revid revid:test@other.com-234235>]
63
60
>>> _parse_revision_str('revid:test@other.com-234234..23')
64
[<RevisionSpec_revid revid:test@other.com-234234>, <RevisionSpec_dwim 23>]
61
[<RevisionSpec_revid revid:test@other.com-234234>, <RevisionSpec_revno 23>]
65
62
>>> _parse_revision_str('date:2005-04-12')
66
63
[<RevisionSpec_date date:2005-04-12>]
67
64
>>> _parse_revision_str('date:2005-04-12 12:24:33')
71
68
>>> _parse_revision_str('date:2005-04-12,12:24:33')
72
69
[<RevisionSpec_date date:2005-04-12,12:24:33>]
73
70
>>> _parse_revision_str('-5..23')
74
[<RevisionSpec_dwim -5>, <RevisionSpec_dwim 23>]
71
[<RevisionSpec_revno -5>, <RevisionSpec_revno 23>]
75
72
>>> _parse_revision_str('-5')
76
[<RevisionSpec_dwim -5>]
73
[<RevisionSpec_revno -5>]
77
74
>>> _parse_revision_str('123a')
78
[<RevisionSpec_dwim 123a>]
75
Traceback (most recent call last):
77
NoSuchRevisionSpec: No namespace registered for string: '123a'
79
78
>>> _parse_revision_str('abc')
80
[<RevisionSpec_dwim abc>]
79
Traceback (most recent call last):
81
NoSuchRevisionSpec: No namespace registered for string: 'abc'
81
82
>>> _parse_revision_str('branch:../branch2')
82
83
[<RevisionSpec_branch branch:../branch2>]
83
84
>>> _parse_revision_str('branch:../../branch2')
84
85
[<RevisionSpec_branch branch:../../branch2>]
85
86
>>> _parse_revision_str('branch:../../branch2..23')
86
[<RevisionSpec_branch branch:../../branch2>, <RevisionSpec_dwim 23>]
87
[<RevisionSpec_branch branch:../../branch2>, <RevisionSpec_revno 23>]
87
88
>>> _parse_revision_str('branch:..\\\\branch2')
88
89
[<RevisionSpec_branch branch:..\\branch2>]
89
90
>>> _parse_revision_str('branch:..\\\\..\\\\branch2..23')
90
[<RevisionSpec_branch branch:..\\..\\branch2>, <RevisionSpec_dwim 23>]
91
[<RevisionSpec_branch branch:..\\..\\branch2>, <RevisionSpec_revno 23>]
92
93
# TODO: Maybe move this into revisionspec.py
521
492
_verbosity_level = -1
495
class MergeTypeRegistry(_mod_registry.Registry):
500
_merge_type_registry = MergeTypeRegistry()
501
_merge_type_registry.register_lazy('merge3', 'bzrlib.merge', 'Merge3Merger',
502
"Native diff3-style merge")
503
_merge_type_registry.register_lazy('diff3', 'bzrlib.merge', 'Diff3Merger',
504
"Merge using external diff3")
505
_merge_type_registry.register_lazy('weave', 'bzrlib.merge', 'WeaveMerger',
507
_merge_type_registry.register_lazy('lca', 'bzrlib.merge', 'LCAMerger',
524
510
# Declare the standard options
525
511
_standard_option('help', short_name='h',
526
512
help='Show help message.')
527
_standard_option('quiet', short_name='q',
528
help="Only display errors and warnings.",
529
custom_callback=_verbosity_level_callback)
530
513
_standard_option('usage',
531
514
help='Show usage message and options.')
532
515
_standard_option('verbose', short_name='v',
533
516
help='Display more information.',
534
517
custom_callback=_verbosity_level_callback)
518
_standard_option('quiet', short_name='q',
519
help="Only display errors and warnings.",
520
custom_callback=_verbosity_level_callback)
536
522
# Declare commonly used options
537
_global_option('change',
538
type=_parse_change_str,
540
param_name='revision',
541
help='Select changes introduced by the specified revision. See also "help revisionspec".')
542
_global_option('directory', short_name='d', type=unicode,
543
help='Branch to operate on, instead of working directory.')
523
_global_option('all')
524
_global_option('overwrite', help='Ignore differences between branches and '
525
'overwrite unconditionally.')
526
_global_option('basis', type=str)
527
_global_option('bound')
528
_global_option('diff-options', type=str)
544
529
_global_option('file', type=unicode, short_name='F')
545
_global_registry_option('log-format', "Use specified log format.",
546
lazy_registry=('bzrlib.log', 'log_formatter_registry'),
547
value_switches=True, title='Log format',
548
short_value_switches={'short': 'S'})
549
_global_registry_option('merge-type', 'Select a particular merge algorithm.',
550
lazy_registry=('bzrlib.merge', 'merge_type_registry'),
551
value_switches=True, title='Merge algorithm')
530
_global_option('force')
531
_global_option('format', type=unicode)
532
_global_option('forward')
552
533
_global_option('message', type=unicode,
554
535
help='Message string.')
555
_global_option('null', short_name='0',
556
help='Use an ASCII NUL (\\0) separator rather than '
558
_global_option('overwrite', help='Ignore differences between branches and '
559
'overwrite unconditionally.')
560
_global_option('remember', help='Remember the specified location as a'
562
_global_option('reprocess', help='Reprocess to reduce spurious conflicts.')
536
_global_option('no-recurse')
537
_global_option('profile',
538
help='Show performance profiling information.')
563
539
_global_option('revision',
564
540
type=_parse_revision_str,
566
542
help='See "help revisionspec" for details.')
543
_global_option('change',
544
type=_parse_change_str,
546
param_name='revision',
547
help='Select changes introduced by the specified revision. See also "help revisionspec".')
567
548
_global_option('show-ids',
568
549
help='Show internal object ids.')
569
550
_global_option('timezone',
571
552
help='Display timezone as local, original, or utc.')
553
_global_option('unbound')
554
_global_option('version')
555
_global_option('email')
556
_global_option('update')
557
_global_registry_option('log-format', "Use specified log format.",
558
lazy_registry=('bzrlib.log', 'log_formatter_registry'),
559
value_switches=True, title='Log format')
560
_global_option('long', help='Use detailed log format. Same as --log-format long',
562
_global_option('short', help='Use moderately short log format. Same as --log-format short')
563
_global_option('line', help='Use log format with one line per revision. Same as --log-format line')
564
_global_option('root', type=str)
565
_global_option('no-backup')
566
_global_registry_option('merge-type', 'Select a particular merge algorithm.',
567
_merge_type_registry, value_switches=True,
568
title='Merge algorithm')
569
_global_option('pattern', type=str)
570
_global_option('remember', help='Remember the specified location as a'
572
_global_option('reprocess', help='Reprocess to reduce spurious conflicts.')
573
_global_option('kind', type=str)
574
_global_option('dry-run',
575
help="Show what would be done, but don't actually do anything.")
576
_global_option('name-from-revision', help='The path name in the old tree.')
573
578
diff_writer_registry = _mod_registry.Registry()
574
579
diff_writer_registry.register('plain', lambda x: x, 'Plaintext diff output.')