comparison mercurial/bundle2.py @ 21000:4cae06ae1562

bundle2: extract a _payloadchunks method for part We are preparing streaming capability for part. So the generation of payload chunk will becomes more complex. We extract this part in its own function before any changes.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 10 Apr 2014 12:33:20 -0700
parents 93a3c5b58635
children c93bb6a08fa1
comparison
equal deleted inserted replaced
20999:1e28ec9744bf 21000:4cae06ae1562
547 ## finalize header 547 ## finalize header
548 headerchunk = ''.join(header) 548 headerchunk = ''.join(header)
549 yield _pack(_fpartheadersize, len(headerchunk)) 549 yield _pack(_fpartheadersize, len(headerchunk))
550 yield headerchunk 550 yield headerchunk
551 ## payload 551 ## payload
552 for chunk in self._payloadchunks():
553 yield _pack(_fpayloadsize, len(chunk))
554 yield chunk
555 # end of payload
556 yield _pack(_fpayloadsize, 0)
557
558 def _payloadchunks(self):
559 """yield chunks of a the part payload
560
561 Exists to handle the different methods to provide data to a part."""
552 # we only support fixed size data now. 562 # we only support fixed size data now.
553 # This will be improved in the future. 563 # This will be improved in the future.
554 if len(self.data): 564 if len(self.data):
555 yield _pack(_fpayloadsize, len(self.data))
556 yield self.data 565 yield self.data
557 # end of payload
558 yield _pack(_fpayloadsize, 0)
559 566
560 @parthandler('changegroup') 567 @parthandler('changegroup')
561 def handlechangegroup(op, inpart): 568 def handlechangegroup(op, inpart):
562 """apply a changegroup part on the repo 569 """apply a changegroup part on the repo
563 570