~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/option.py

  • Committer: Robert Collins
  • Date: 2005-10-19 06:01:01 UTC
  • Revision ID: robertc@robertcollins.net-20051019060101-1f62d4fb1a5f59dc
WorkingTree.__del__ has been removed.

It was non deterministic and not doing what it was intended 
to. See WorkingTree.__init__ for a comment about future directions.
(Robert Collins/Martin Pool)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import bzrlib.commands
21
21
from bzrlib.trace import warning, mutter
22
22
from bzrlib.revisionspec import RevisionSpec
23
 
from bzrlib.errors import BzrCommandError
24
23
 
25
24
 
26
25
def _parse_revision_str(revstr):
103
102
 
104
103
 
105
104
def _parse_merge_type(typestring):
106
 
    return get_merge_type(typestring)
 
105
    return bzrlib.commands.get_merge_type(typestring)
107
106
 
108
 
def get_merge_type(typestring):
109
 
    """Attempt to find the merge class/factory associated with a string."""
110
 
    from merge import merge_types
111
 
    try:
112
 
        return merge_types[typestring][0]
113
 
    except KeyError:
114
 
        templ = '%s%%7s: %%s' % (' '*12)
115
 
        lines = [templ % (f[0], f[1][1]) for f in merge_types.iteritems()]
116
 
        type_list = '\n'.join(lines)
117
 
        msg = "No known merge type %s. Supported types are:\n%s" %\
118
 
            (typestring, type_list)
119
 
        raise BzrCommandError(msg)
120
107
 
121
108
class Option(object):
122
109
    """Description of a command line option"""
155
142
 
156
143
        Short options are globally registered.
157
144
        """
158
 
        for short, option in Option.SHORT_OPTIONS.iteritems():
159
 
            if option is self:
160
 
                return short
 
145
        return Option.SHORT_OPTIONS.get(self.name)
161
146
 
162
147
 
163
148
def _global_option(name, **kwargs):
165
150
    Option.OPTIONS[name] = Option(name, **kwargs)
166
151
 
167
152
_global_option('all')
168
 
_global_option('overwrite', help='Ignore differences between branches and '
169
 
               'overwrite unconditionally')
 
153
_global_option('clobber')
170
154
_global_option('basis', type=str)
171
155
_global_option('diff-options', type=str)
172
156
_global_option('help',
197
181
_global_option('merge-type', type=_parse_merge_type)
198
182
_global_option('pattern', type=str)
199
183
_global_option('quiet')
200
 
_global_option('remember', help='Remember the specified location as a'
201
 
               ' default.')
202
 
_global_option('reprocess', help='Reprocess to reduce spurious conflicts')
 
184
_global_option('remember')
203
185
 
204
186
 
205
187
def _global_short(short_name, long_name):