Queued, thanks.

> +        self.entries = set()
> +        chunk = b''
> +        for c in iter(functools.partial(fp.read, fncache_chunksize), b''):
> +            chunk += c
> +            try:
> +                p = chunk.rindex(b'\n')
> +                self.entries.update(decodedir(chunk[:p + 1]).splitlines())
> +                chunk = chunk[p + 1:]
> +            except ValueError:
> +                # substring '\n' not found, maybe the entry is bigger than 
> the
> +                # chunksize, so let's keep iterating
> +                pass

We might want to check if the `chunk` is fully consumed. If the file doesn't
end with '\n', which I think is invalid though, the last line would be silently
ignored.
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to