stablerange: use rangelength in subrangesclosure
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Wed, 22 Mar 2017 18:39:47 +0100
changeset 2167 d37f0423c072
parent 2166 d4ff8708eb66
child 2168 3012d4ddfb23
stablerange: use rangelength in subrangesclosure 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:37:11 2017 +0100
+++ b/hgext3rd/evolve/stablerange.py	Wed Mar 22 18:39:47 2017 +0100
@@ -145,7 +145,8 @@
                 toproceed.append(r)
     ranges = list(ranges)
     n = repo.changelog.node
-    ranges.sort(key=lambda r: (-len(r), n(r[0])))
+    rangelength = repo.stablerange.rangelength
+    ranges.sort(key=lambda r: (-rangelength(repo, r), n(r[0])))
     return ranges
 
 class stablerangecache(dict):