Patchwork [13,of,14,FIX-bundle2] bundle2: make unbundle.compressed return True when compressed

login
register
mail settings
Submitter Pierre-Yves David
Date Oct. 20, 2015, 2:36 p.m.
Message ID <7ab1d8aeeba134c81523.1445351789@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/11195/
State Accepted
Commit 42f705f2c02dc6ae4f01b5c1d3f773dda4149ed9
Headers show

Comments

Pierre-Yves David - Oct. 20, 2015, 2:36 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1443853299 25200
#      Fri Oct 02 23:21:39 2015 -0700
# Node ID 7ab1d8aeeba134c8152379b32ae466f0a38c5660
# Parent  d313c8307c6b25c4df47125d6e1617ff968830ff
# EXP-Topic generaldelta
# Available At http://hg.netv6.net/marmoute-wip/mercurial/
#              hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r 7ab1d8aeeba1
bundle2: make unbundle.compressed return True when compressed

We were returning 'False' in all case, even when the bundle2 was actually
compressed.

Patch

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -654,10 +654,11 @@  class unbundle20(unpackermixin):
 
     def __init__(self, ui, fp):
         """If header is specified, we do not read it out of the stream."""
         self.ui = ui
         self._decompressor = util.decompressors[None]
+        self._compressed = None
         super(unbundle20, self).__init__(fp)
 
     @util.propertycache
     def params(self):
         """dictionary of stream level parameters"""
@@ -776,11 +777,12 @@  class unbundle20(unpackermixin):
         if headersize:
             return self._readexact(headersize)
         return None
 
     def compressed(self):
-        return False
+        self.params # load params
+        return self._compressed
 
 formatmap = {'20': unbundle20}
 
 b2streamparamsmap = {}
 
@@ -797,10 +799,12 @@  def processcompression(unbundler, param,
     """read compression parameter and install payload decompression"""
     if value not in util.decompressors:
         raise error.BundleUnknownFeatureError(params=(param,),
                                               values=(value,))
     unbundler._decompressor = util.decompressors[value]
+    if value is not None:
+        unbundler._compressed = True
 
 class bundlepart(object):
     """A bundle2 part contains application level payload
 
     The part `type` is used to route the part to the application level