Mercurial > public > mercurial-scm > hg-stable
changeset 52928:f863fc99bef9
bundle2-part: provide a "__iter__" pass through
Since the bundle2 already come in fixed size chunk, there is few need to go
have the chunkbuffer slice and recompose them, we can just yield the chunk that
the format provides.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 27 Jan 2025 18:08:34 +0100 |
parents | fdae7c26d038 |
children | 9abf173a958b |
files | mercurial/bundle2.py |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/bundle2.py Mon Jan 27 18:08:19 2025 +0100 +++ b/mercurial/bundle2.py Mon Jan 27 18:08:34 2025 +0100 @@ -1467,6 +1467,11 @@ # we read the data, tell it self._initialized = True + def __iter__(self): + for chunk in self._payloadstream: + self._pos += len(chunk) + yield chunk + def _payloadchunks(self): """Generator of decoded chunks in the payload.""" return decodepayloadchunks(self.ui, self._fp)