# HG changeset patch # User Gregory Szorc # Date 2015-10-14 17:36:20 # Node ID 704818fb170de3ff1e1ab1bc7cda4c4fe5b75bab # Parent 2c9f15366982d3db6e2907d3cbe1ca9adc6ab8a8 exchange: advertise if a clone bundle was attempted The client now sends a "cbattempted" boolean flag to the "getbundle" wire protocol command to tell the server whether a clone bundle was attempted. The presence of this flag will enable the server to conditionally emit a bundle2 "output" part advertising the availability of clone bundles to compatible clients that don't have it enabled. diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -1179,6 +1179,16 @@ def _pullbundle2(pullop): # make sure to always includes bookmark data when migrating # `hg incoming --bundle` to using this function. kwargs['listkeys'].append('bookmarks') + + # If this is a full pull / clone and the server supports the clone bundles + # feature, tell the server whether we attempted a clone bundle. The + # presence of this flag indicates the client supports clone bundles. This + # will enable the server to treat clients that support clone bundles + # differently from those that don't. + if (pullop.remote.capable('clonebundles') + and pullop.heads is None and list(pullop.common) == [nullid]): + kwargs['cbattempted'] = pullop.clonebundleattempted + if streaming: pullop.repo.ui.status(_('streaming all changes\n')) elif not pullop.fetch: diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -160,7 +160,8 @@ gboptsmap = {'heads': 'nodes', 'obsmarkers': 'boolean', 'bundlecaps': 'scsv', 'listkeys': 'csv', - 'cg': 'boolean'} + 'cg': 'boolean', + 'cbattempted': 'boolean'} # client side