}
revlogHeader.length(content.length, compressedLen);
// XXX may be wise not to create DataSerializer for each revision, but for a file
DataSerializer sds = new DataSerializer() {
@Override
public void write(byte[] data, int offset, int length) throws HgIOException {
try {
indexFile.write(data, offset, length);
} catch (IOException ex) {
throw new HgIOException("Write failure", ex, currentFile);
}
}
};
revlogHeader.serialize(sds);
if (useUncompressedData) {
sds.writeByte((byte) 'u');
dataSource.serialize(sds);
} else {
int actualCompressedLenWritten = revlogDataZip.writeCompressedData(sds);
if (actualCompressedLenWritten != compressedLen) {
throw new HgInvalidStateException(String.format("Expected %d bytes of compressed data, but actually wrote %d in %s", compressedLen, actualCompressedLenWritten, filename));
}
}
sds.done();
//
revisionSequence.add(node);
prevRevContent.done();
prevRevContent = new ByteArrayDataAccess(content);
} catch (HgIOException ex) {