exchange: advertise if a clone bundle was attempted
authorGregory Szorc <gregory.szorc@gmail.com>
Wed, 14 Oct 2015 10:36:20 -0700
changeset 26690 704818fb170d
parent 26689 2c9f15366982
child 26691 23c0da28c034
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.
mercurial/exchange.py
mercurial/wireproto.py
--- a/mercurial/exchange.py	Tue Oct 13 14:55:02 2015 -0700
+++ b/mercurial/exchange.py	Wed Oct 14 10:36:20 2015 -0700
@@ -1179,6 +1179,16 @@
             # 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:
--- a/mercurial/wireproto.py	Tue Oct 13 14:55:02 2015 -0700
+++ b/mercurial/wireproto.py	Wed Oct 14 10:36:20 2015 -0700
@@ -160,7 +160,8 @@
              'obsmarkers': 'boolean',
              'bundlecaps': 'scsv',
              'listkeys': 'csv',
-             'cg': 'boolean'}
+             'cg': 'boolean',
+             'cbattempted': 'boolean'}
 
 # client side