# HG changeset patch # User Pierre-Yves David # Date 1496135532 -7200 # Node ID cdf6a0e028c02a0bc42f2c617c1ebfa479c0e9d3 # Parent d5db7464676d3a82e8b632704edbdcb1e2a84ea2 stablerange: report progress more often in slow case For small repositories the time spent in progress was problematic. However on large repository it quickly becomes negligible, so we add a way to detect this case and report more often in this case. diff -r d5db7464676d -r cdf6a0e028c0 hgext3rd/evolve/stablerange.py --- a/hgext3rd/evolve/stablerange.py Mon May 29 14:03:31 2017 +0200 +++ b/hgext3rd/evolve/stablerange.py Tue May 30 11:12:12 2017 +0200 @@ -304,12 +304,21 @@ original = set(rangeheap) seen = 0 + # progress report is showing up in the profile for small and fast + # repository so we build that complicated work around. + progress_each = 100 + progress_last = time.time() heapify(rangeheap) while rangeheap: value = heappop(rangeheap) if value in original: - if not seen % 1000: + if not seen % progress_each: + # if a lot of time passed, report more often + progress_new = time.time() + if (1 < progress_each) and (0.1 < progress_new - progress_last): + progress_each /= 10 ui.progress(_("filling stablerange cache"), seen, total=nbrevs) + progress_last = progress_new seen += 1 original.remove(value) # might have been added from other source __, rangeid = value