# HG changeset patch
# User Stanislau Hlebik <st...@fb.com>
# Date 1473954485 25200
#      Thu Sep 15 08:48:05 2016 -0700
# Node ID 837f2f1650ebf323b46924040f180fc966e80fbf
# Parent  4ace3cd7d2d2e1d63f0811034467e7b7e9719861
exchange: use `bookmarks` bundle2 part

Apply changes from `bookmarks` part.
Initial idea was to add a special mode to the bookmarks part handler that will
apply bookmark changes differently (create divergent bookmarks etc).
But it would've required significant code changes, so I decided to stick
with old approach.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1370,9 +1370,13 @@
     kwargs['cg'] = pullop.fetch
     if 'listkeys' in pullop.remotebundle2caps:
         kwargs['listkeys'] = ['phases']
-        if pullop.remotebookmarks is None:
-            # make sure to always includes bookmark data when migrating
-            # `hg incoming --bundle` to using this function.
+
+    if pullop.remotebookmarks is None:
+        # make sure to always includes bookmark data when migrating
+        # `hg incoming --bundle` to using this function.
+        if 'bookmarks' in pullop.remotebundle2caps:
+            kwargs['bookmarks'] = True
+        elif 'listkeys' in pullop.remotebundle2caps:
             kwargs['listkeys'].append('bookmarks')
 
     # If this is a full pull / clone and the server supports the clone bundles
@@ -1414,6 +1418,10 @@
             _pullapplyphases(pullop, value)
 
     # processing bookmark update
+    for remotebookmarks in op.records['bookmarks']:
+        pullop.remotebookmarks = remotebookmarks
+
+    # processing bookmark update
     for namespace, value in op.records['listkeys']:
         if namespace == 'bookmarks':
             pullop.remotebookmarks = value
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to