Mercurial > public > mercurial-scm > hg
comparison mercurial/bundle2.py @ 52916: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 | b8da7eed1657 |
children | 2787db338b15 |
comparison
equal
deleted
inserted
replaced
52915:fdae7c26d038 | 52916:f863fc99bef9 |
---|---|
1465 ## part payload | 1465 ## part payload |
1466 self._payloadstream = util.chunkbuffer(self._payloadchunks()) | 1466 self._payloadstream = util.chunkbuffer(self._payloadchunks()) |
1467 # we read the data, tell it | 1467 # we read the data, tell it |
1468 self._initialized = True | 1468 self._initialized = True |
1469 | 1469 |
1470 def __iter__(self): | |
1471 for chunk in self._payloadstream: | |
1472 self._pos += len(chunk) | |
1473 yield chunk | |
1474 | |
1470 def _payloadchunks(self): | 1475 def _payloadchunks(self): |
1471 """Generator of decoded chunks in the payload.""" | 1476 """Generator of decoded chunks in the payload.""" |
1472 return decodepayloadchunks(self.ui, self._fp) | 1477 return decodepayloadchunks(self.ui, self._fp) |
1473 | 1478 |
1474 def consume(self): | 1479 def consume(self): |