Patchwork cg1packer: fix `compressed` method

login
register
mail settings
Submitter Stanislau Hlebik
Date Dec. 14, 2016, 5:58 p.m.
Message ID <f511d71c272bf87ea263.1481738312@devvm957.lla2.facebook.com>
Download mbox | patch
Permalink /patch/17911/
State Accepted
Headers show

Comments

Stanislau Hlebik - Dec. 14, 2016, 5:58 p.m.
# HG changeset patch
# User Stanislau Hlebik <stash@fb.com>
# Date 1481738036 28800
#      Wed Dec 14 09:53:56 2016 -0800
# Node ID f511d71c272bf87ea263cdcda3045e26fd5f8dfe
# Parent  4cdc738f8246c748dc1639754d0e7ced97d15e23
cg1packer: fix `compressed` method

`cg1packer.compressed()` returns True even if `self._type` is 'UN'. This patch
fixes it.
Augie Fackler - Dec. 15, 2016, 4:48 p.m.
On Wed, Dec 14, 2016 at 09:58:32AM -0800, Stanislau Hlebik wrote:
> # HG changeset patch
> # User Stanislau Hlebik <stash@fb.com>
> # Date 1481738036 28800
> #      Wed Dec 14 09:53:56 2016 -0800
> # Node ID f511d71c272bf87ea263cdcda3045e26fd5f8dfe
> # Parent  4cdc738f8246c748dc1639754d0e7ced97d15e23
> cg1packer: fix `compressed` method

Oops. Queued, thanks.

>
> `cg1packer.compressed()` returns True even if `self._type` is 'UN'. This patch
> fixes it.
>
> diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
> --- a/mercurial/changegroup.py
> +++ b/mercurial/changegroup.py
> @@ -154,7 +154,7 @@
>      # These methods (compressed, read, seek, tell) all appear to only
>      # be used by bundlerepo, but it's a little hard to tell.
>      def compressed(self):
> -        return self._type is not None
> +        return self._type is not None and self._type != 'UN'
>      def read(self, l):
>          return self._stream.read(l)
>      def seek(self, pos):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -154,7 +154,7 @@ 
     # These methods (compressed, read, seek, tell) all appear to only
     # be used by bundlerepo, but it's a little hard to tell.
     def compressed(self):
-        return self._type is not None
+        return self._type is not None and self._type != 'UN'
     def read(self, l):
         return self._stream.read(l)
     def seek(self, pos):