##// END OF EJS Templates
bundle2: add a way to just forward the bundle2 stream to another user...
Pierre-Yves David -
r26542:b87e4638 default
parent child Browse files
Show More
@@ -641,6 +641,8 class unbundle20(unpackermixin):
641 641 This class is fed with a binary stream and yields parts through its
642 642 `iterparts` methods."""
643 643
644 _magicstring = 'HG20'
645
644 646 def __init__(self, ui, fp):
645 647 """If header is specified, we do not read it out of the stream."""
646 648 self.ui = ui
@@ -698,6 +700,46 class unbundle20(unpackermixin):
698 700 else:
699 701 handler(self, name, value)
700 702
703 def _forwardchunks(self):
704 """utility to transfer a bundle2 as binary
705
706 This is made necessary by the fact the 'getbundle' command over 'ssh'
707 have no way to know then the reply end, relying on the bundle to be
708 interpreted to know its end. This is terrible and we are sorry, but we
709 needed to move forward to get general delta enabled.
710 """
711 yield self._magicstring
712 assert 'params' not in vars(self)
713 paramssize = self._unpack(_fstreamparamsize)[0]
714 if paramssize < 0:
715 raise error.BundleValueError('negative bundle param size: %i'
716 % paramssize)
717 yield _pack(_fstreamparamsize, paramssize)
718 if paramssize:
719 params = self._readexact(paramssize)
720 self._processallparams(params)
721 yield params
722 assert self._decompressor is util.decompressors[None]
723 # From there, payload might need to be decompressed
724 self._fp = self._decompressor(self._fp)
725 emptycount = 0
726 while emptycount < 2:
727 # so we can brainlessly loop
728 assert _fpartheadersize == _fpayloadsize
729 size = self._unpack(_fpartheadersize)[0]
730 yield _pack(_fpartheadersize, size)
731 if size:
732 emptycount = 0
733 else:
734 emptycount += 1
735 continue
736 if size == flaginterrupt:
737 continue
738 elif size < 0:
739 raise error.BundleValueError('negative chunk size: %i')
740 yield self._readexact(size)
741
742
701 743 def iterparts(self):
702 744 """yield all parts contained in the stream"""
703 745 # make sure param have been loaded
General Comments 0
You need to be logged in to leave comments. Login now