/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/option.py

  • Committer: Jelmer Vernooij
  • Date: 2017-05-24 01:39:33 UTC
  • mfrom: (3815.3776.6)
  • Revision ID: jelmer@jelmer.uk-20170524013933-ir4y4tqtrsiz2ka2
New upstream snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
import optparse
23
23
import re
24
24
 
25
 
from bzrlib.lazy_import import lazy_import
 
25
from .lazy_import import lazy_import
26
26
lazy_import(globals(), """
27
 
from bzrlib import (
 
27
from breezy import (
28
28
    errors,
29
29
    revisionspec,
30
30
    i18n,
31
31
    )
32
32
""")
33
33
 
34
 
from bzrlib import (
 
34
from . import (
35
35
    registry as _mod_registry,
36
36
    )
 
37
from .sixish import (
 
38
    text_type,
 
39
    )
37
40
 
38
41
 
39
42
def _parse_revision_str(revstr):
126
129
        return merge_types[typestring][0]
127
130
    except KeyError:
128
131
        templ = '%s%%7s: %%s' % (' '*12)
129
 
        lines = [templ % (f[0], f[1][1]) for f in merge_types.iteritems()]
 
132
        lines = [templ % (f[0], f[1][1]) for f in merge_types.items()]
130
133
        type_list = '\n'.join(lines)
131
134
        msg = "No known merge type %s. Supported types are:\n%s" %\
132
135
            (typestring, type_list)
454
457
 
455
458
 
456
459
def get_optparser(options):
457
 
    """Generate an optparse parser for bzrlib-style options"""
 
460
    """Generate an optparse parser for breezy-style options"""
458
461
 
459
462
    parser = OptionParser()
460
463
    parser.remove_option('--help')
461
 
    for option in options.itervalues():
 
464
    for option in options.values():
462
465
        option.add_option(parser, option.short_name())
463
466
    return parser
464
467
 
539
542
               short_name='c',
540
543
               param_name='revision',
541
544
               help='Select changes introduced by the specified revision. See also "help revisionspec".')
542
 
_global_option('directory', short_name='d', type=unicode,
 
545
_global_option('directory', short_name='d', type=text_type,
543
546
               help='Branch to operate on, instead of working directory.')
544
 
_global_option('file', type=unicode, short_name='F')
 
547
_global_option('file', type=text_type, short_name='F')
545
548
_global_registry_option('log-format', "Use specified log format.",
546
 
                        lazy_registry=('bzrlib.log', 'log_formatter_registry'),
 
549
                        lazy_registry=('breezy.log', 'log_formatter_registry'),
547
550
                        value_switches=True, title='Log format',
548
551
                        short_value_switches={'short': 'S'})
549
552
_global_registry_option('merge-type', 'Select a particular merge algorithm.',
550
 
                        lazy_registry=('bzrlib.merge', 'merge_type_registry'),
 
553
                        lazy_registry=('breezy.merge', 'merge_type_registry'),
551
554
                        value_switches=True, title='Merge algorithm')
552
 
_global_option('message', type=unicode,
 
555
_global_option('message', type=text_type,
553
556
               short_name='m',
554
557
               help='Message string.')
555
558
_global_option('null', short_name='0',