/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/cmdline.py

  • Committer: Andrew Bennetts
  • Date: 2011-06-09 07:38:32 UTC
  • mto: This revision was merged to the branch mainline in revision 5964.
  • Revision ID: andrew.bennetts@canonical.com-20110609073832-dt6oww033iexli4l
Fix thinko in wording regarding stacking invariants and revisions with multiple parents.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
import re
24
24
 
25
25
 
26
 
_whitespace_match = re.compile(u'\\s', re.UNICODE).match
 
26
_whitespace_match = re.compile(u'\s', re.UNICODE).match
27
27
 
28
28
 
29
29
class _PushbackSequence(object):
31
31
        self._iter = iter(orig)
32
32
        self._pushback_buffer = []
33
33
 
34
 
    def __next__(self):
 
34
    def next(self):
35
35
        if len(self._pushback_buffer) > 0:
36
36
            return self._pushback_buffer.pop()
37
37
        else:
38
 
            return next(self._iter)
39
 
 
40
 
    next = __next__
 
38
            return self._iter.next()
41
39
 
42
40
    def pushback(self, char):
43
41
        self._pushback_buffer.append(char)
72
70
        if next_char == u'\\':
73
71
            return _Backslash(self)
74
72
        elif next_char == self.quote_char:
75
 
            context.token.append(u'')
76
73
            return self.exit_state
77
74
        else:
78
75
            context.token.append(next_char)
91
88
            return self
92
89
        elif next_char in context.allowed_quote_chars:
93
90
            # 2N backslashes followed by a quote are N backslashes
94
 
            context.token.append(u'\\' * (self.count // 2))
 
91
            context.token.append(u'\\' * (self.count/2))
95
92
            # 2N+1 backslashes follwed by a quote are N backslashes followed by
96
93
            # the quote which should not be processed as the start or end of
97
94
            # the quoted arg
140
137
    def __iter__(self):
141
138
        return self
142
139
 
143
 
    def __next__(self):
 
140
    def next(self):
144
141
        quoted, token = self._get_token()
145
142
        if token is None:
146
143
            raise StopIteration
147
144
        return quoted, token
148
145
 
149
 
    next = __next__
150
 
 
151
146
    def _get_token(self):
152
147
        self.quoted = False
153
148
        self.token = []
156
151
            state = state.process(next_char, self)
157
152
            if state is None:
158
153
                break
159
 
        if state is not None and not getattr(state, 'finish', None) is None:
 
154
        if not state is None and not getattr(state, 'finish', None) is None:
160
155
            state.finish(self)
161
156
        result = u''.join(self.token)
162
157
        if not self.quoted and result == '':