~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/option.py

  • Committer: Robey Pointer
  • Date: 2005-11-22 01:41:46 UTC
  • mfrom: (1185.40.1)
  • mto: (1185.33.37 bzr.dev)
  • mto: This revision was merged to the branch mainline in revision 1512.
  • Revision ID: robey@lag.net-20051122014146-5186f5e310a15202
make sftp put faster when using paramiko 1.5.1

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 by 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
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
# TODO: For things like --diff-prefix, we want a way to customize the display
18
 
# of the option argument.
19
17
 
20
18
import re
21
19
 
22
 
from bzrlib.trace import warning
 
20
import bzrlib.commands
 
21
from bzrlib.trace import warning, mutter
23
22
from bzrlib.revisionspec import RevisionSpec
24
23
from bzrlib.errors import BzrCommandError
25
24
 
72
71
    BzrError: No namespace registered for string: 'abc'
73
72
    >>> _parse_revision_str('branch:../branch2')
74
73
    [<RevisionSpec_branch branch:../branch2>]
75
 
    >>> _parse_revision_str('branch:../../branch2')
76
 
    [<RevisionSpec_branch branch:../../branch2>]
77
 
    >>> _parse_revision_str('branch:../../branch2..23')
78
 
    [<RevisionSpec_branch branch:../../branch2>, <RevisionSpec_int 23>]
79
74
    """
80
75
    # TODO: Maybe move this into revisionspec.py
81
76
    old_format_re = re.compile('\d*:\d*')
90
85
            else:
91
86
                revs.append(RevisionSpec(None))
92
87
    else:
93
 
        sep = re.compile("\\.\\.(?!/)")
94
 
        for x in sep.split(revstr):
95
 
            revs.append(RevisionSpec(x or None))
 
88
        next_prefix = None
 
89
        for x in revstr.split('..'):
 
90
            if not x:
 
91
                revs.append(RevisionSpec(None))
 
92
            elif x[-1] == ':':
 
93
                # looks like a namespace:.. has happened
 
94
                next_prefix = x + '..'
 
95
            else:
 
96
                if next_prefix is not None:
 
97
                    x = next_prefix + x
 
98
                revs.append(RevisionSpec(x))
 
99
                next_prefix = None
 
100
        if next_prefix is not None:
 
101
            revs.append(RevisionSpec(next_prefix))
96
102
    return revs
97
103
 
98
104
 
134
140
        argname -- name of option argument, if any
135
141
        """
136
142
        # TODO: perhaps a subclass that automatically does 
137
 
        # --option, --no-option for reversible booleans
 
143
        # --option, --no-option for reversable booleans
138
144
        self.name = name
139
145
        self.help = help
140
146
        self.type = type
162
168
_global_option('overwrite', help='Ignore differences between branches and '
163
169
               'overwrite unconditionally')
164
170
_global_option('basis', type=str)
165
 
_global_option('bound')
166
171
_global_option('diff-options', type=str)
167
172
_global_option('help',
168
173
               help='show help message')
172
177
_global_option('forward')
173
178
_global_option('message', type=unicode)
174
179
_global_option('no-recurse')
175
 
_global_option('prefix', type=str, 
176
 
               help='Set prefixes to added to old and new filenames, as '
177
 
                    'two values separated by a colon.')
178
180
_global_option('profile',
179
181
               help='show performance profiling information')
180
182
_global_option('revision', type=_parse_revision_str)
 
183
_global_option('short')
181
184
_global_option('show-ids', 
182
185
               help='show internal object ids')
183
186
_global_option('timezone', 
184
187
               type=str,
185
188
               help='display timezone as local, original, or utc')
186
 
_global_option('unbound')
187
189
_global_option('verbose',
188
190
               help='display more information')
189
191
_global_option('version')
190
192
_global_option('email')
191
193
_global_option('update')
192
 
_global_option('log-format', type=str, help="Use this log format")
193
 
_global_option('long', help='Use detailed log format. Same as --log-format long')
194
 
_global_option('short', help='Use moderately short log format. Same as --log-format short')
195
 
_global_option('line', help='Use log format with one line per revision. Same as --log-format line')
 
194
_global_option('long')
196
195
_global_option('root', type=str)
197
196
_global_option('no-backup')
198
 
_global_option('merge-type', type=_parse_merge_type, 
199
 
               help='Select a particular merge algorithm')
 
197
_global_option('merge-type', type=_parse_merge_type)
200
198
_global_option('pattern', type=str)
201
199
_global_option('quiet')
202
200
_global_option('remember', help='Remember the specified location as a'
203
201
               ' default.')
204
202
_global_option('reprocess', help='Reprocess to reduce spurious conflicts')
205
 
_global_option('kind', type=str)
206
 
_global_option('dry-run',
207
 
               help="show what would be done, but don't actually do anything")
208
203
 
209
204
 
210
205
def _global_short(short_name, long_name):
219
214
Option.SHORT_OPTIONS['v'] = Option.OPTIONS['verbose']
220
215
Option.SHORT_OPTIONS['l'] = Option.OPTIONS['long']
221
216
Option.SHORT_OPTIONS['q'] = Option.OPTIONS['quiet']
222
 
Option.SHORT_OPTIONS['p'] = Option.OPTIONS['prefix']