// Make a copy
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ByteStreams.copy(stream, bos);
stream.consumeAll();
stream = new HgInputStream(new ByteArrayInputStream(bos.toByteArray()), repo.newDecoder());
if (stream.find(BEGIN)) {
result = Lists.newArrayList();
while (!stream.isEof() && !stream.match(BEGIN_FALLBACK)) {
result.add(repo.changeset(stream.textUpTo('\n')));