~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: 2008-05-08 07:05:00 UTC
  • mfrom: (3376.2.15 no-asserts)
  • Revision ID: pqm@pqm.ubuntu.com-20080508070500-9zyyvsk0eev20t4w
(mbp) remove and disallow assert statements

Show diffs side-by-side

added added

removed removed

Lines of Context:
200
200
    fields = text.split('\0')
201
201
    # Remove the last blank entry
202
202
    trailing = fields.pop()
203
 
    assert trailing == ''
 
203
    if trailing != '':
 
204
        raise AssertionError("dirstate line %r has trailing garbage: %r" 
 
205
            % (trailing,))
204
206
    # consider turning fields into a tuple.
205
207
 
206
208
    # skip the first field which is the trailing null from the header.
217
219
    expected_field_count = entry_size * state._num_entries
218
220
    field_count = len(fields)
219
221
    # this checks our adjustment, and also catches file too short.
220
 
    assert field_count - cur == expected_field_count, \
221
 
        'field count incorrect %s != %s, entry_size=%s, '\
222
 
        'num_entries=%s fields=%r' % (
 
222
    if field_count - cur != expected_field_count:
 
223
        raise AssertionError(
 
224
            'field count incorrect %s != %s, entry_size=%s, '\
 
225
            'num_entries=%s fields=%r' % (
223
226
            field_count - cur, expected_field_count, entry_size,
224
 
            state._num_entries, fields)
 
227
            state._num_entries, fields))
225
228
 
226
229
    if num_present_parents == 1:
227
230
        # Bind external functions to local names
269
272
                     ),
270
273
                     ])
271
274
            trailing = next()
272
 
            assert trailing == '\n'
 
275
            if trailing != '\n':
 
276
                raise ValueError("trailing garbage in dirstate: %r" % trailing)
273
277
            # append the entry to the current block
274
278
            append_entry(entry)
275
279
        state._split_root_dirblock_into_contents()