From patchwork Tue Oct 11 16:25:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [8,of,9,V6] pull: use `bookmarks` bundle2 part From: Stanislau Hlebik X-Patchwork-Id: 17031 Message-Id: <445790ea847e83d17836.1476203150@dev1918.lla1.facebook.com> To: Cc: pierre-yves.david@ens-lyon.org Date: Tue, 11 Oct 2016 09:25:50 -0700 # HG changeset patch # User Stanislau Hlebik # Date 1476195835 25200 # Tue Oct 11 07:23:55 2016 -0700 # Node ID 445790ea847e83d178368f148c302df8fca66e03 # Parent 48e5db9c751c1eca19019bbc24de43f7cb3368e7 pull: use `bookmarks` bundle2 part Apply changes from `bookmarks` part. diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -1322,9 +1322,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 @@ -1352,10 +1356,20 @@ _pullbundle2extraprepare(pullop, kwargs) bundle = pullop.remote.getbundle('pull', **kwargs) try: - op = bundle2.processbundle(pullop.repo, bundle, pullop.gettransaction) + op = bundle2.bundleoperation(pullop.repo, pullop.gettransaction, + processbookmarksmode='diverge', + explicitbookmarks=pullop.explicitbookmarks, + remotepath=pullop.remote.url()) + op = bundle2.processbundle(pullop.repo, bundle, + pullop.gettransaction, op=op) except error.BundleValueError as exc: raise error.Abort(_('missing support for %s') % exc) + # `bookmarks` part was in bundle and it was applied to the repo. No need to + # apply bookmarks one more time + if 'bookmarks' in kwargs and kwargs['bookmarks']: + pullop.stepsdone.add('bookmarks') + if pullop.fetch: results = [cg['return'] for cg in op.records['changegroup']] pullop.cgresult = changegroup.combineresults(results) @@ -1752,7 +1766,8 @@ gettransaction() op = bundle2.bundleoperation(repo, gettransaction, - captureoutput=captureoutput) + captureoutput=captureoutput, + processbookmarksmode='apply') try: op = bundle2.processbundle(repo, cg, op=op) finally: