changeset 3145:ca6650879726

compat: drop 'lru.get' work-around for 3.9 We no longer support this version.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 24 Oct 2017 14:17:14 +0200
parents 6f10c94a2114
children 87e87881059d
files hgext3rd/evolve/stablerange.py
diffstat 1 files changed, 3 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/stablerange.py	Tue Oct 24 14:13:57 2017 +0200
+++ b/hgext3rd/evolve/stablerange.py	Tue Oct 24 14:17:14 2017 +0200
@@ -395,13 +395,7 @@
             # data about the merge. But I'm not sure this function will be even
             # call for the general case.
 
-            # Lrudict.get in hg-3.9 returns the lrunode instead of the
-            # value, use __getitem__ instead and catch the exception directly
-            try:
-                allrevs = self._stablesortcache[headrev]
-            except KeyError:
-                allrevs = None
-
+            allrevs = self._stablesortcache.get(headrev)
             if allrevs is None:
                 allrevs = self._getrevsfrommerge(repo, headrev)
                 if allrevs is None:
@@ -450,11 +444,8 @@
             self._stablesortprepared[merge] = (sortedrevs, len(sortedrevs))
 
     def _getrevsfrommerge(self, repo, merge):
-        # Lrudict.get in hg-3.9 returns the lrunode instead of the
-        # value, use __getitem__ instead and catch the exception directly
-        try:
-            prepared = self._stablesortprepared[merge]
-        except KeyError:
+        prepared = self._stablesortprepared.get(merge)
+        if prepared is None:
             return None
 
         mergedepth = self.depthrev(repo, merge)