Show More
@@ -485,11 +485,11 b' def encodecaps(caps):' | |||||
485 | return '\n'.join(chunks) |
|
485 | return '\n'.join(chunks) | |
486 |
|
486 | |||
487 | bundletypes = { |
|
487 | bundletypes = { | |
488 |
"": ("", |
|
488 | "": ("", 'UN'), # only when using unbundle on ssh and old http servers | |
489 | # since the unification ssh accepts a header but there |
|
489 | # since the unification ssh accepts a header but there | |
490 | # is no capability signaling it. |
|
490 | # is no capability signaling it. | |
491 | "HG20": (), # special-cased below |
|
491 | "HG20": (), # special-cased below | |
492 |
"HG10UN": ("HG10UN", |
|
492 | "HG10UN": ("HG10UN", 'UN'), | |
493 | "HG10BZ": ("HG10", 'BZ'), |
|
493 | "HG10BZ": ("HG10", 'BZ'), | |
494 | "HG10GZ": ("HG10GZ", 'GZ'), |
|
494 | "HG10GZ": ("HG10GZ", 'GZ'), | |
495 | } |
|
495 | } | |
@@ -511,7 +511,7 b' class bundle20(object):' | |||||
511 | self._params = [] |
|
511 | self._params = [] | |
512 | self._parts = [] |
|
512 | self._parts = [] | |
513 | self.capabilities = dict(capabilities) |
|
513 | self.capabilities = dict(capabilities) | |
514 |
self._comp |
|
514 | self._compengine = util.compengines.forbundletype('UN') | |
515 |
|
515 | |||
516 | def setcompression(self, alg): |
|
516 | def setcompression(self, alg): | |
517 | """setup core part compression to <alg>""" |
|
517 | """setup core part compression to <alg>""" | |
@@ -519,7 +519,7 b' class bundle20(object):' | |||||
519 | return |
|
519 | return | |
520 | assert not any(n.lower() == 'Compression' for n, v in self._params) |
|
520 | assert not any(n.lower() == 'Compression' for n, v in self._params) | |
521 | self.addparam('Compression', alg) |
|
521 | self.addparam('Compression', alg) | |
522 |
self._comp |
|
522 | self._compengine = util.compengines.forbundletype(alg) | |
523 |
|
523 | |||
524 | @property |
|
524 | @property | |
525 | def nbparts(self): |
|
525 | def nbparts(self): | |
@@ -572,11 +572,12 b' class bundle20(object):' | |||||
572 | if param: |
|
572 | if param: | |
573 | yield param |
|
573 | yield param | |
574 | # starting compression |
|
574 | # starting compression | |
|
575 | compressor = self._compengine.compressorobj() | |||
575 | for chunk in self._getcorechunk(): |
|
576 | for chunk in self._getcorechunk(): | |
576 |
data = |
|
577 | data = compressor.compress(chunk) | |
577 | if data: |
|
578 | if data: | |
578 | yield data |
|
579 | yield data | |
579 |
yield |
|
580 | yield compressor.flush() | |
580 |
|
581 | |||
581 | def _paramchunk(self): |
|
582 | def _paramchunk(self): | |
582 | """return a encoded version of all stream parameters""" |
|
583 | """return a encoded version of all stream parameters""" | |
@@ -1318,18 +1319,19 b' def writebundle(ui, cg, filename, bundle' | |||||
1318 | raise error.Abort(_('old bundle types only supports v1 ' |
|
1319 | raise error.Abort(_('old bundle types only supports v1 ' | |
1319 | 'changegroups')) |
|
1320 | 'changegroups')) | |
1320 | header, comp = bundletypes[bundletype] |
|
1321 | header, comp = bundletypes[bundletype] | |
1321 |
if comp not in util.comp |
|
1322 | if comp not in util.compengines.supportedbundletypes: | |
1322 | raise error.Abort(_('unknown stream compression type: %s') |
|
1323 | raise error.Abort(_('unknown stream compression type: %s') | |
1323 | % comp) |
|
1324 | % comp) | |
1324 |
|
|
1325 | compengine = util.compengines.forbundletype(comp) | |
|
1326 | compressor = compengine.compressorobj() | |||
1325 | subchunkiter = cg.getchunks() |
|
1327 | subchunkiter = cg.getchunks() | |
1326 | def chunkiter(): |
|
1328 | def chunkiter(): | |
1327 | yield header |
|
1329 | yield header | |
1328 | for chunk in subchunkiter: |
|
1330 | for chunk in subchunkiter: | |
1329 |
data = |
|
1331 | data = compressor.compress(chunk) | |
1330 | if data: |
|
1332 | if data: | |
1331 | yield data |
|
1333 | yield data | |
1332 |
yield |
|
1334 | yield compressor.flush() | |
1333 | chunkiter = chunkiter() |
|
1335 | chunkiter = chunkiter() | |
1334 |
|
1336 | |||
1335 | # parse the changegroup data, otherwise we will block |
|
1337 | # parse the changegroup data, otherwise we will block |
General Comments 0
You need to be logged in to leave comments.
Login now