changeset 4136:be3a94d3105f

pullbundle: attempt to save stablerange cache after each computation Since we do not serve the full repository, we use more stablerange starting from a random point. These are probably not loaded yet and should be cached. This is best effort caching, if we can't save them we won't.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 24 Sep 2018 01:16:00 +0200
parents 47f1d7b4305d
children 21a3c051ca6c
files hgext3rd/pullbundle.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/pullbundle.py	Mon Sep 24 00:51:39 2018 +0200
+++ b/hgext3rd/pullbundle.py	Mon Sep 24 01:16:00 2018 +0200
@@ -190,6 +190,8 @@
                 head = max(localmissing)
 
         allslices.extend(localslices)
+    # unknown subrange might had to be computed
+    repo.stablerange.save(repo)
     return [(rangeid, outgoingfromnodes(repo, nodes))
             for rangeid, nodes in allslices]
 
@@ -250,6 +252,9 @@
         prerange = (headrev, precut)
         size = stablerange.rangelength(repo, prerange)
         sub = stablerange.subranges(repo, prerange)[:-1]
+        # This power of two check is too simplistic and misbehave when too many
+        # merge are involved. because de merge, there can be "canonical" range
+        # with various size.
         while not poweroftwo(tailsize):
             for prerange in reversed(sub):
                 if tailsize <= 0: