~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to read_changeset.py

  • Committer: John Arbash Meinel
  • Date: 2005-07-02 07:07:05 UTC
  • mto: (0.5.85) (1185.82.1 bzr-w-changeset)
  • mto: This revision was merged to the branch mainline in revision 1738.
  • Revision ID: john@arbash-meinel.com-20050702070705-71d894e83e7ba22a
Simplified the header, only output base if it is not the expected one.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
import pprint
8
8
import common
9
9
 
 
10
from bzrlib.trace import mutter
 
11
 
10
12
class BadChangeset(Exception): pass
11
13
class MalformedHeader(BadChangeset): pass
12
14
class MalformedPatches(BadChangeset): pass
170
172
        """yield the next line, but secretly
171
173
        keep 1 extra line for peeking.
172
174
        """
173
 
        from bzrlib.trace import mutter
174
175
        for line in self.from_file:
175
176
            last = self._next_line
176
177
            self._next_line = line
177
178
            if last is not None:
178
 
                mutter('yielding line: %r' % last)
 
179
                #mutter('yielding line: %r' % last)
179
180
                yield last
180
181
        last = self._next_line
181
182
        self._next_line = None
182
 
        mutter('yielding line: %r' % last)
 
183
        #mutter('yielding line: %r' % last)
183
184
        yield last
184
185
 
185
186
    def _read_header(self):
217
218
    def _read_next_entry(self, line, indent=1):
218
219
        """Read in a key-value pair
219
220
        """
220
 
        from bzrlib.trace import mutter
221
221
        if line[:1] != '#':
222
222
            raise MalformedHeader('Bzr header did not start with #')
223
223
        line = line[1:-1] # Remove the '#' and '\n'
240
240
                    ' did not find the colon %r' % (line))
241
241
 
242
242
        key = key.replace(' ', '_')
243
 
        mutter('found %s: %s' % (key, value))
 
243
        #mutter('found %s: %s' % (key, value))
244
244
        return key, value
245
245
 
246
246
    def _handle_next(self, line):
266
266
        This detects the end of the list, because it will be a line that
267
267
        does not start properly indented.
268
268
        """
269
 
        from bzrlib.trace import mutter
270
269
        values = []
271
270
        start = '#' + (' '*indent)
272
271
 
285
284
 
286
285
        :return: action, lines, do_continue
287
286
        """
 
287
        #mutter('_read_one_patch: %r' % self._next_line)
288
288
        # Peek and see if there are no patches
289
289
        if self._next_line is None or self._next_line[:1] == '#':
290
290
            return None, [], False
342
342
        :param first_line:  The previous step iterates past what it
343
343
                            can handle. That extra line is given here.
344
344
        """
345
 
        line = self._next().next()
346
345
        for line in self._next():
347
346
            self._handle_next(line)
348
347
            if self._next_line is None or self._next_line[:1] != '#':