stablerange: use rangelength in '_slicesatrange'
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Wed, 22 Mar 2017 18:40:54 +0100
changeset 2169 03baabcd1b9e
parent 2168 3012d4ddfb23
child 2170 f8d3d965552e
stablerange: use rangelength in '_slicesatrange' We stop using the building '__len__' this get use closer to be able to use a tuple.
hgext3rd/evolve/stablerange.py
--- a/hgext3rd/evolve/stablerange.py	Wed Mar 22 18:40:19 2017 +0100
+++ b/hgext3rd/evolve/stablerange.py	Wed Mar 22 18:40:54 2017 +0100
@@ -296,8 +296,7 @@
             slices.append(top)
             return slices
 
-    @staticmethod
-    def _slicesrangeatmerge(repo, rangeid, globalindex):
+    def _slicesrangeatmerge(self, repo, rangeid, globalindex):
         localindex = globalindex - rangeid[1]
         cl = repo.changelog
 
@@ -306,7 +305,7 @@
         top = stablerange(repo, rangeid[0], globalindex, rangeid._revs[localindex:])
         #
         toprootdepth = repo.stablerange.depthrev(repo, top._revs[0])
-        if toprootdepth + len(top) == rangeid.depth + 1:
+        if toprootdepth + self.rangelength(repo, top) == rangeid.depth + 1:
             bheads = [bottom[-1]]
         else:
             bheads = set(bottom)