~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/knit.py

  • Committer: Marius Kruger
  • Date: 2007-06-27 18:48:10 UTC
  • mfrom: (2557 +trunk)
  • mto: (2605.1.1 rm-renamed)
  • mto: This revision was merged to the branch mainline in revision 2609.
  • Revision ID: marius.kruger@enerweb.co.za-20070627184810-4jq1y5f20xafow9w
Merge with bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1185
1185
                # or a different failure, and raise. RBC 20060407
1186
1186
                continue
1187
1187
 
1188
 
            parents = []
1189
 
            for value in rec[4:-1]:
1190
 
                if value[0] == '.':
1191
 
                    # uncompressed reference
1192
 
                    parent_id = value[1:]
1193
 
                else:
1194
 
                    parent_id = history[int(value)]
1195
 
                parents.append(parent_id)
 
1188
            try:
 
1189
                parents = []
 
1190
                for value in rec[4:-1]:
 
1191
                    if value[0] == '.':
 
1192
                        # uncompressed reference
 
1193
                        parent_id = value[1:]
 
1194
                    else:
 
1195
                        parent_id = history[int(value)]
 
1196
                    parents.append(parent_id)
 
1197
            except (IndexError, ValueError), e:
 
1198
                # The parent could not be decoded to get its parent row. This
 
1199
                # at a minimum will cause this row to have wrong parents, or
 
1200
                # even to apply a delta to the wrong base and decode
 
1201
                # incorrectly. its therefore not usable, and because we have
 
1202
                # encountered a situation where a new knit index had this
 
1203
                # corrupt we can't asssume that no other rows referring to the
 
1204
                # index of this record actually mean the subsequent uncorrupt
 
1205
                # one, so we error.
 
1206
                raise errors.KnitCorrupt(self._filename,
 
1207
                    "line %r: %s" % (rec, e))
1196
1208
 
1197
1209
            version_id, options, pos, size = rec[:4]
1198
1210
            version_id = version_id