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.
--- 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: