/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/option.py

  • Committer: Martin Pool
  • Date: 2006-11-02 10:20:19 UTC
  • mfrom: (2114 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2119.
  • Revision ID: mbp@sourcefrog.net-20061102102019-9a5a02f485dff6f6
merge bzr.dev and reconcile several changes, also some test fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2004, 2005, 2006 by Canonical Ltd
 
1
# Copyright (C) 2004, 2005, 2006 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
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
import re
 
21
 
 
22
from bzrlib.lazy_import import lazy_import
 
23
lazy_import(globals(), """
20
24
import optparse
21
 
import re
22
25
 
 
26
from bzrlib import (
 
27
    errors,
 
28
    revisionspec,
 
29
    )
 
30
""")
23
31
from bzrlib.trace import warning
24
 
from bzrlib.revisionspec import RevisionSpec
25
 
from bzrlib.errors import BzrCommandError
26
32
 
27
33
 
28
34
def _parse_revision_str(revstr):
80
86
    """
81
87
    # TODO: Maybe move this into revisionspec.py
82
88
    revs = []
 
89
    # split on the first .. that is not followed by a / ?
83
90
    sep = re.compile("\\.\\.(?!/)")
84
91
    for x in sep.split(revstr):
85
 
        revs.append(RevisionSpec.from_string(x or None))
 
92
        revs.append(revisionspec.RevisionSpec.from_string(x or None))
86
93
    return revs
87
94
 
88
95
 
100
107
        type_list = '\n'.join(lines)
101
108
        msg = "No known merge type %s. Supported types are:\n%s" %\
102
109
            (typestring, type_list)
103
 
        raise BzrCommandError(msg)
 
110
        raise errors.BzrCommandError(msg)
104
111
 
105
112
class Option(object):
106
113
    """Description of a command line option"""
191
198
    DEFAULT_VALUE = object()
192
199
 
193
200
    def error(self, message):
194
 
        raise BzrCommandError(message)
 
201
        raise errors.BzrCommandError(message)
195
202
 
196
203
 
197
204
def get_optparser(options):
257
264
_global_option('kind', type=str)
258
265
_global_option('dry-run',
259
266
               help="show what would be done, but don't actually do anything")
 
267
_global_option('name-from-revision', help='The path name in the old tree.')
260
268
 
261
269
 
262
270
def _global_short(short_name, long_name):