Patchwork [4,of,6,clone,bundles] exchange: record that we attempted to fetch a clone bundle

login
register
mail settings
Submitter Gregory Szorc
Date Oct. 14, 2015, 6:07 p.m.
Message ID <2a2363bc09f454c43232.1444846076@gps-mbp.local>
Download mbox | patch
Permalink /patch/11071/
State Accepted
Headers show

Comments

Gregory Szorc - Oct. 14, 2015, 6:07 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1444773302 25200
#      Tue Oct 13 14:55:02 2015 -0700
# Node ID 2a2363bc09f454c432327add39d8dac8acfcb37a
# Parent  9d89eee4a9ce6a4a0a235bdebdbe1683ba8eb321
exchange: record that we attempted to fetch a clone bundle

This is needed so a subsequent patch can conditionally add a bundle2
part to the "getbundle" wire protocol command depending on whether a
clone bundle was attempted.

Patch

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -957,8 +957,10 @@  class pulloperation(object):
         # result of changegroup pulling (used as return code by pull)
         self.cgresult = None
         # list of step already done
         self.stepsdone = set()
+        # Whether we attempted a clone from pre-generated bundles.
+        self.clonebundleattempted = False
 
     @util.propertycache
     def pulledsubset(self):
         """heads of the set of changeset target by the pull"""
@@ -1602,8 +1604,13 @@  def _maybeapplyclonebundle(pullop):
     if not remote.capable('clonebundles'):
         return
 
     res = remote._call('clonebundles')
+
+    # If we call the wire protocol command, that's good enough to record the
+    # attempt.
+    pullop.clonebundleattempted = True
+
     entries = parseclonebundlesmanifest(repo, res)
     if not entries:
         repo.ui.note(_('no clone bundles available on remote; '
                        'falling back to regular clone\n'))