Patchwork [phase] exchange: fix test for remote support of binary phases

login
register
mail settings
Submitter Boris Feld
Date Sept. 30, 2017, 9:35 a.m.
Message ID <4d26dbcdfdb38fd3fc4e.1506764109@FB>
Download mbox | patch
Permalink /patch/24232/
State Accepted
Headers show

Comments

Boris Feld - Sept. 30, 2017, 9:35 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1506762569 -3600
#      Sat Sep 30 10:09:29 2017 +0100
# Node ID 4d26dbcdfdb38fd3fc4efa157b64819f5281c8e0
# Parent  ec769bba34d377503f42308dea5ddcb8ce4c0ade
# EXP-Topic fix-phases
exchange: fix test for remote support of binary phases

If the remote do not support phases, the "get" call will return None. We
change that default return to empty tuple to fix the membership testing.

This was a bug in the initial series. Thanks to yuja for catching this.
Pulkit Goyal - Sept. 30, 2017, 10:31 a.m.
I don't see the traceback after applying this patch. If possible, this
patch should be folded with the previous series.

On Sat, Sep 30, 2017 at 3:05 PM, Boris Feld <boris.feld@octobus.net> wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1506762569 -3600
> #      Sat Sep 30 10:09:29 2017 +0100
> # Node ID 4d26dbcdfdb38fd3fc4efa157b64819f5281c8e0
> # Parent  ec769bba34d377503f42308dea5ddcb8ce4c0ade
> # EXP-Topic fix-phases
> exchange: fix test for remote support of binary phases
>
> If the remote do not support phases, the "get" call will return None. We
> change that default return to empty tuple to fix the membership testing.
>
> This was a bug in the initial series. Thanks to yuja for catching this.
>
> diff -r ec769bba34d3 -r 4d26dbcdfdb3 mercurial/exchange.py
> --- a/mercurial/exchange.py     Tue Sep 26 03:56:20 2017 -0700
> +++ b/mercurial/exchange.py     Sat Sep 30 10:09:29 2017 +0100
> @@ -1353,7 +1353,8 @@
>
>      ui = pullop.repo.ui
>      legacyphase = 'phases' in ui.configlist('devel', 'legacy.exchange')
> -    if (not legacyphase and 'heads' in pullop.remotebundle2caps.get('phases')):
> +    hasbinaryphase  = 'heads' in pullop.remotebundle2caps.get('phases', ())
> +    if (not legacyphase and hasbinaryphase):
>          kwargs['phases'] = True
>          pullop.stepsdone.add('phases')
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Yuya Nishihara - Sept. 30, 2017, 1:26 p.m.
On Sat, 30 Sep 2017 16:01:36 +0530, Pulkit Goyal wrote:
> I don't see the traceback after applying this patch. If possible, this
> patch should be folded with the previous series.
> 
> On Sat, Sep 30, 2017 at 3:05 PM, Boris Feld <boris.feld@octobus.net> wrote:
> > # HG changeset patch
> > # User Boris Feld <boris.feld@octobus.net>
> > # Date 1506762569 -3600
> > #      Sat Sep 30 10:09:29 2017 +0100
> > # Node ID 4d26dbcdfdb38fd3fc4efa157b64819f5281c8e0
> > # Parent  ec769bba34d377503f42308dea5ddcb8ce4c0ade
> > # EXP-Topic fix-phases
> > exchange: fix test for remote support of binary phases

Queued, thanks.
Durham Goode - Oct. 5, 2017, 1:25 a.m.
On 9/30/17 6:26 AM, Yuya Nishihara wrote:
> On Sat, 30 Sep 2017 16:01:36 +0530, Pulkit Goyal wrote:
>> I don't see the traceback after applying this patch. If possible, this
>> patch should be folded with the previous series.
>>
>> On Sat, Sep 30, 2017 at 3:05 PM, Boris Feld <boris.feld@octobus.net> wrote:
>>> # HG changeset patch
>>> # User Boris Feld <boris.feld@octobus.net>
>>> # Date 1506762569 -3600
>>> #      Sat Sep 30 10:09:29 2017 +0100
>>> # Node ID 4d26dbcdfdb38fd3fc4efa157b64819f5281c8e0
>>> # Parent  ec769bba34d377503f42308dea5ddcb8ce4c0ade
>>> # EXP-Topic fix-phases
>>> exchange: fix test for remote support of binary phases
>
> Queued, thanks.

Should there be a test to cover this case?

Patch

diff -r ec769bba34d3 -r 4d26dbcdfdb3 mercurial/exchange.py
--- a/mercurial/exchange.py	Tue Sep 26 03:56:20 2017 -0700
+++ b/mercurial/exchange.py	Sat Sep 30 10:09:29 2017 +0100
@@ -1353,7 +1353,8 @@ 
 
     ui = pullop.repo.ui
     legacyphase = 'phases' in ui.configlist('devel', 'legacy.exchange')
-    if (not legacyphase and 'heads' in pullop.remotebundle2caps.get('phases')):
+    hasbinaryphase  = 'heads' in pullop.remotebundle2caps.get('phases', ())
+    if (not legacyphase and hasbinaryphase):
         kwargs['phases'] = True
         pullop.stepsdone.add('phases')