pullbundle: attempt to save stablerange cache after each computation
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 24 Sep 2018 01:16:00 +0200
changeset 4136 be3a94d3105f
parent 4135 47f1d7b4305d
child 4137 21a3c051ca6c
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.
hgext3rd/pullbundle.py
--- 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: