compat: drop 'lru.get' work-around for 3.9
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 24 Oct 2017 14:17:14 +0200
changeset 3145 ca6650879726
parent 3144 6f10c94a2114
child 3146 87e87881059d
compat: drop 'lru.get' work-around for 3.9 We no longer support this version.
hgext3rd/evolve/stablerange.py
--- 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)