# HG changeset patch # User Pierre-Yves David # Date 1537870781 -7200 # Node ID 21a3c051ca6c96b3ad50bbf69f0ff1f38672b604 # Parent be3a94d3105f00aa87313ee19aef36a33b25d186 stablerange: fix slicing of arbitrary ranges Pull bundle trigger slicing from range with arbitrary initial skip. We have to adjust the current slicing to take this into account. diff -r be3a94d3105f -r 21a3c051ca6c hgext3rd/evolve/stablerange.py --- a/hgext3rd/evolve/stablerange.py Mon Sep 24 01:16:00 2018 +0200 +++ b/hgext3rd/evolve/stablerange.py Tue Sep 25 12:19:41 2018 +0200 @@ -390,6 +390,12 @@ # find were we need to slice slicepoint = self._slicepoint(repo, rangeid) + ret = self._slicesrangeat(repo, rangeid, slicepoint) + + return ret + + def _slicesrangeat(self, repo, rangeid, slicepoint): + headrev, initial_index = rangeid self._warmcachefor(repo, rangeid, slicepoint) stable_parent_data = self._parentrange(repo, rangeid) @@ -411,7 +417,13 @@ # The parent is above the slice point, # it's lower subrange will be the same so we just get them, # (and the top range is always the same) - subranges = self.subranges(repo, stable_parent_range)[:-1] + subranges = self.subranges(repo, stable_parent_range)[:] + parenttop = subranges.pop() + if (stable_parent_depth - slicepoint) < self.rangelength(repo, parenttop): + # possible case when we reduce an arbitrary range to its + # canonical parts + midranges = self._slicesrangeat(repo, parenttop, slicepoint) + subranges.extend(midranges[:-1]) subranges.append(top_range) elif initial_index < stable_parent_depth < slicepoint: # the parent is below the range we are considering, we need to @@ -428,6 +440,13 @@ slicepoint)) subranges.append(top_range) + ### slow code block to validated the slicing works as expected + # toprevs = self.revsfromrange(repo, rangeid) + # subrevs = [] + # for s in subranges: + # subrevs.extend(self.revsfromrange(repo, s)) + # assert toprevs == subrevs, (rangeid, slicepoint, stable_parent_range, stable_parent_depth, toprevs, subrevs) + return subranges def _unique_subranges(self, repo, headrev, initial_index, slicepoint): diff -r be3a94d3105f -r 21a3c051ca6c hgext3rd/evolve/stablerangecache.py --- a/hgext3rd/evolve/stablerangecache.py Mon Sep 24 01:16:00 2018 +0200 +++ b/hgext3rd/evolve/stablerangecache.py Tue Sep 25 12:19:41 2018 +0200 @@ -388,7 +388,7 @@ class mergepointsql(stablerangesql, stablerange.stablerange_mergepoint): - _schemaversion = 2 + _schemaversion = 3 _cachefile = 'cache/evoext_stablerange_v2.sqlite' _cachename = 'evo-ext-stablerange-mergepoint'