381
381
"""Index by sequence id returns the index field"""
382
382
## TODO: Can avoid seek if we just moved there...
387
391
def _seek_index(self, idx):
389
393
raise RevfileError("invalid index %r" % idx)
390
394
self.idxfile.seek((idx + 1) * _RECORDSIZE)
393
411
def _read_next_index(self):
394
412
rec = self.idxfile.read(_RECORDSIZE)
397
415
elif len(rec) != _RECORDSIZE:
398
416
raise RevfileError("short read of %d bytes getting index %d from %r"
399
417
% (len(rec), idx, self.basename))