Patchwork [7,of,8,V2] phase: isolate logic to update remote phrase through bundle2 pushkey

login
register
mail settings
Submitter Boris Feld
Date Oct. 16, 2017, 6:23 p.m.
Message ID <9c084f14df72a2d511d4.1508178228@FB>
Download mbox | patch
Permalink /patch/25022/
State Accepted
Headers show

Comments

Boris Feld - Oct. 16, 2017, 6:23 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1505927857 -7200
#      Wed Sep 20 19:17:37 2017 +0200
# Node ID 9c084f14df72a2d511d414e0ecf50a086c0a2341
# Parent  e688d8b13100c464897c7f872c498202f8e82272
# EXP-Topic b2.phases.push
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 9c084f14df72
phase: isolate logic to update remote phrase through bundle2 pushkey

Move the logic to build bundle2 pushkey part into its dedicated function. It
will help to keep the logic clear when adding support for sending phases change
using 'phase-heads' part.
Yuya Nishihara - Oct. 19, 2017, 1:30 p.m.
On Mon, 16 Oct 2017 20:23:48 +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1505927857 -7200
> #      Wed Sep 20 19:17:37 2017 +0200
> # Node ID 9c084f14df72a2d511d414e0ecf50a086c0a2341
> # Parent  e688d8b13100c464897c7f872c498202f8e82272
> # EXP-Topic b2.phases.push
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 9c084f14df72
> phase: isolate logic to update remote phrase through bundle2 pushkey
> 
> Move the logic to build bundle2 pushkey part into its dedicated function. It
> will help to keep the logic clear when adding support for sending phases change
> using 'phase-heads' part.
> 
> diff --git a/mercurial/exchange.py b/mercurial/exchange.py
> --- a/mercurial/exchange.py
> +++ b/mercurial/exchange.py
> @@ -806,8 +806,11 @@
>      if 'phases' in pushop.stepsdone:
>          return
>      b2caps = bundle2.bundle2caps(pushop.remote)
> -    if not 'pushkey' in b2caps:
> -        return
> +    if 'pushkey' in b2caps:
> +        _pushb2phasespushkey(pushop, bundler)

Don't we need to return the handlereply function?
Boris Feld - Oct. 19, 2017, 3:54 p.m.
On Thu, 2017-10-19 at 22:30 +0900, Yuya Nishihara wrote:
> On Mon, 16 Oct 2017 20:23:48 +0200, Boris Feld wrote:
> > # HG changeset patch
> > # User Boris Feld <boris.feld@octobus.net>
> > # Date 1505927857 -7200
> > #      Wed Sep 20 19:17:37 2017 +0200
> > # Node ID 9c084f14df72a2d511d414e0ecf50a086c0a2341
> > # Parent  e688d8b13100c464897c7f872c498202f8e82272
> > # EXP-Topic b2.phases.push
> > # Available At https://bitbucket.org/octobus/mercurial-devel/
> > #              hg pull https://bitbucket.org/octobus/mercurial-deve
> > l/ -r 9c084f14df72
> > phase: isolate logic to update remote phrase through bundle2
> > pushkey
> > 
> > Move the logic to build bundle2 pushkey part into its dedicated
> > function. It
> > will help to keep the logic clear when adding support for sending
> > phases change
> > using 'phase-heads' part.
> > 
> > diff --git a/mercurial/exchange.py b/mercurial/exchange.py
> > --- a/mercurial/exchange.py
> > +++ b/mercurial/exchange.py
> > @@ -806,8 +806,11 @@
> >      if 'phases' in pushop.stepsdone:
> >          return
> >      b2caps = bundle2.bundle2caps(pushop.remote)
> > -    if not 'pushkey' in b2caps:
> > -        return
> > +    if 'pushkey' in b2caps:
> > +        _pushb2phasespushkey(pushop, bundler)
> 
> Don't we need to return the handlereply function?

Yes good catch, we will send a follow-up.

Patch

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -806,8 +806,11 @@ 
     if 'phases' in pushop.stepsdone:
         return
     b2caps = bundle2.bundle2caps(pushop.remote)
-    if not 'pushkey' in b2caps:
-        return
+    if 'pushkey' in b2caps:
+        _pushb2phasespushkey(pushop, bundler)
+
+def _pushb2phasespushkey(pushop, bundler):
+    """push phase information through a bundle2 - pushkey part"""
     pushop.stepsdone.add('phases')
     part2node = []