minor simplification around rangelength
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Fri, 24 Mar 2017 03:33:36 +0100
changeset 2211 ecb46c7ee281
parent 2210 37bd878d2e58
child 2212 afb35ad42040
minor simplification around rangelength
hgext3rd/evolve/stablerange.py
--- a/hgext3rd/evolve/stablerange.py	Fri Mar 24 03:30:14 2017 +0100
+++ b/hgext3rd/evolve/stablerange.py	Fri Mar 24 03:33:36 2017 +0100
@@ -232,8 +232,9 @@
     def revsfromrange(self, repo, rangeid):
         revs = self._revsinrangecache.get(rangeid)
         headrev, index = rangeid
+        rangelength = self.rangelength(repo, rangeid)
         if revs is None:
-            if self.rangelength(repo, rangeid) == 1:
+            if rangelength == 1:
                 revs = [headrev]
             else:
                 # get all revs under heads in stable order
@@ -249,7 +250,7 @@
                 revs = allrevs[index:]
             self._revsinrangecache[rangeid] = revs
         # sanity checks
-        assert len(revs) == self.rangelength(repo, rangeid)
+        assert len(revs) == rangelength
         return revs
 
     def _parents(self, rev, func):