~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_dirstate_helpers_py.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-10-22 18:35:47 UTC
  • mfrom: (2898.2.4 bzr.smtp)
  • Revision ID: pqm@pqm.ubuntu.com-20071022183547-ylcflvri4vahgtmg
(James Henstridge) Update SMTPConnection to better follow the SMTP spec.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007, 2008 Canonical Ltd
 
1
# Copyright (C) 2007 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
20
20
 
21
21
# We cannot import the dirstate module, because it loads this module
22
22
# All we really need is the IN_MEMORY_MODIFIED constant
23
 
from bzrlib import errors
24
23
from bzrlib.dirstate import DirState
25
24
 
26
25
 
201
200
    fields = text.split('\0')
202
201
    # Remove the last blank entry
203
202
    trailing = fields.pop()
204
 
    if trailing != '':
205
 
        raise errors.DirstateCorrupt(state,
206
 
            'trailing garbage: %r' % (trailing,))
 
203
    assert trailing == ''
207
204
    # consider turning fields into a tuple.
208
205
 
209
206
    # skip the first field which is the trailing null from the header.
220
217
    expected_field_count = entry_size * state._num_entries
221
218
    field_count = len(fields)
222
219
    # this checks our adjustment, and also catches file too short.
223
 
    if field_count - cur != expected_field_count:
224
 
        raise errors.DirstateCorrupt(state,
225
 
            'field count incorrect %s != %s, entry_size=%s, '\
226
 
            'num_entries=%s fields=%r' % (
 
220
    assert field_count - cur == expected_field_count, \
 
221
        'field count incorrect %s != %s, entry_size=%s, '\
 
222
        'num_entries=%s fields=%r' % (
227
223
            field_count - cur, expected_field_count, entry_size,
228
 
            state._num_entries, fields))
 
224
            state._num_entries, fields)
229
225
 
230
226
    if num_present_parents == 1:
231
227
        # Bind external functions to local names
273
269
                     ),
274
270
                     ])
275
271
            trailing = next()
276
 
            if trailing != '\n':
277
 
                raise ValueError("trailing garbage in dirstate: %r" % trailing)
 
272
            assert trailing == '\n'
278
273
            # append the entry to the current block
279
274
            append_entry(entry)
280
275
        state._split_root_dirblock_into_contents()