# HG changeset patch # User Pierre-Yves David # Date 1537744560 -7200 # Node ID be3a94d3105f00aa87313ee19aef36a33b25d186 # Parent 47f1d7b4305d1fbce27562e332783a319381100a 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. diff -r 47f1d7b4305d -r be3a94d3105f 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: