From patchwork Fri Sep 16 11:10:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [7,of,8,V5] exchange: use `bookmarks` bundle2 part From: Stanislau Hlebik X-Patchwork-Id: 16646 Message-Id: <837f2f1650ebf323b469.1474024235@dev1918.lla1.facebook.com> To: Date: Fri, 16 Sep 2016 04:10:35 -0700 # HG changeset patch # User Stanislau Hlebik # 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