bundle2: make unbundle.compressed return True when compressed
authorPierre-Yves David <pierre-yves.david@fb.com>
Fri, 02 Oct 2015 23:21:39 -0700
changeset 26802 42f705f2c02d
parent 26801 73bf76bf6f14
child 26803 ed41ce89822d
bundle2: make unbundle.compressed return True when compressed We were returning 'False' in all cases, even when the bundle2 was actually compressed.
mercurial/bundle2.py
--- a/mercurial/bundle2.py	Mon Oct 19 18:04:08 2015 +0200
+++ b/mercurial/bundle2.py	Fri Oct 02 23:21:39 2015 -0700
@@ -656,6 +656,7 @@
         """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
@@ -778,7 +779,8 @@
         return None
 
     def compressed(self):
-        return False
+        self.params # load params
+        return self._compressed
 
 formatmap = {'20': unbundle20}
 
@@ -799,6 +801,8 @@
         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