# HG changeset patch # User Pierre-Yves David # Date 1737997714 -3600 # Node ID f863fc99bef9fa375b57f2812ee47e5dfaf32d6d # Parent fdae7c26d0388db62573c99737587ddb5bf32f42 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. diff -r fdae7c26d038 -r f863fc99bef9 mercurial/bundle2.py --- 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)