Mercurial > evolve
changeset 2164:cc8ae2a66b0f
stablerange: use rangelength in findmissingrange
We stop using the building '__len__' this get use closer to be able to use a
tuple.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Wed, 22 Mar 2017 18:35:05 +0100 |
parents | e2dc8c4897be |
children | e97e9b0c9711 |
files | hgext3rd/evolve/obsdiscovery.py |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/obsdiscovery.py Wed Mar 22 17:59:21 2017 +0100 +++ b/hgext3rd/evolve/obsdiscovery.py Wed Mar 22 18:35:05 2017 +0100 @@ -241,6 +241,7 @@ heads = local.revs('heads(%ld)', probeset) + rangelength = local.stablerange.rangelength # size of slice ? heappop = heapq.heappop heappush = heapq.heappush @@ -280,8 +281,8 @@ sliceme = [] heapify(sliceme) for entry in sample: - if 1 < len(entry): - heappush(sliceme, (-len(entry), entry)) + if 1 < rangelength(local, entry): + heappush(sliceme, (-rangelength(local, entry), entry)) while sliceme and 0 < needed: _key, target = heappop(sliceme) @@ -289,7 +290,7 @@ # XXX we could record hierarchy to optimise drop if addentry(entry): if 1 < len(entry): - heappush(sliceme, (-len(entry), entry)) + heappush(sliceme, (-rangelength(local, entry), entry)) needed -= 1 if needed <= 0: break @@ -298,7 +299,7 @@ samplesize = fullsamplesize nbsample = len(sample) - maxsize = max([len(r) for r in sample]) + maxsize = max([rangelength(local, r) for r in sample]) ui.debug("query %i; sample size is %i, largest range %i\n" % (querycount, maxsize, nbsample)) nbreplies = 0 @@ -309,7 +310,7 @@ nbreplies += 1 if remotehash == _obshashrange(local, entry): continue - elif 1 == len(entry): + elif 1 == rangelength(local, entry): missing.add(n(entry[0])) else: for new in entry.subranges():