Patchwork [08,of,15] push: move bundle2-pushkey based bookmarks exchange in its own function

login
register
mail settings
Submitter Boris Feld
Date Oct. 18, 2017, 4:10 p.m.
Message ID <c4a092af57116c682182.1508343000@FB>
Download mbox | patch
Permalink /patch/25191/
State Accepted
Headers show

Comments

Boris Feld - Oct. 18, 2017, 4:10 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1508088176 -7200
#      Sun Oct 15 19:22:56 2017 +0200
# Node ID c4a092af57116c6821824a0e4e3a628d8d6c3f9c
# Parent  e0b75fd275e6d4e709e5fc35e09fd88942be9629
# EXP-Topic b2.bookmarks
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r c4a092af5711
push: move bundle2-pushkey based bookmarks exchange in its own function

We are about to introduce an alternative way to push bookmark over bundle2.
Gregory Szorc - Oct. 18, 2017, 5:08 p.m.
On Wed, Oct 18, 2017 at 6:10 PM, Boris Feld <boris.feld@octobus.net> wrote:

> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1508088176 -7200
> #      Sun Oct 15 19:22:56 2017 +0200
> # Node ID c4a092af57116c6821824a0e4e3a628d8d6c3f9c
> # Parent  e0b75fd275e6d4e709e5fc35e09fd88942be9629
> # EXP-Topic b2.bookmarks
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r
> c4a092af5711
> push: move bundle2-pushkey based bookmarks exchange in its own function
>
> We are about to introduce an alternative way to push bookmark over bundle2.
>
> diff --git a/mercurial/exchange.py b/mercurial/exchange.py
> --- a/mercurial/exchange.py
> +++ b/mercurial/exchange.py
> @@ -895,8 +895,10 @@
>

Please enable diff.showfunc so the function name appears in the diff
header. Or use Phabricator so local diff settings don't come into play :)


>      if 'bookmarks' in pushop.stepsdone:
>          return
>      b2caps = bundle2.bundle2caps(pushop.remote)
> -    if 'pushkey' not in b2caps:
> -        return
> +    if 'pushkey' in b2caps:
> +        return _pushb2bookmarkspushkey(pushop, bundler)
> +
> +def _pushb2bookmarkspushkey(pushop, bundler):
>      pushop.stepsdone.add('bookmarks')
>      part2book = []
>      enc = pushkey.encode
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -895,8 +895,10 @@ 
     if 'bookmarks' in pushop.stepsdone:
         return
     b2caps = bundle2.bundle2caps(pushop.remote)
-    if 'pushkey' not in b2caps:
-        return
+    if 'pushkey' in b2caps:
+        return _pushb2bookmarkspushkey(pushop, bundler)
+
+def _pushb2bookmarkspushkey(pushop, bundler):
     pushop.stepsdone.add('bookmarks')
     part2book = []
     enc = pushkey.encode