evolve: provide cache to successorssets() in _singlesuccessor()
authorAnton Shestakov <av6@dwimlabs.net>
Wed, 29 Apr 2020 00:43:13 +0800
changeset 5311 77a77d0f5441
parent 5310 6d0d9ba04a1d
child 5312 9035901412e6
evolve: provide cache to successorssets() in _singlesuccessor() Since we're using obsutil.successorssets() in a loop, it may help performance to have cache.
hgext3rd/evolve/utility.py
--- a/hgext3rd/evolve/utility.py	Wed Apr 29 00:28:15 2020 +0800
+++ b/hgext3rd/evolve/utility.py	Wed Apr 29 00:43:13 2020 +0800
@@ -112,14 +112,15 @@
         return p.rev()
     obs = repo[p]
     ui = repo.ui
-    newer = obsutil.successorssets(repo, obs.node())
+    cache = {}
+    newer = obsutil.successorssets(repo, obs.node(), cache=cache)
     # search of a parent which is not killed
     while not newer:
         ui.debug(b"stabilize target %s is plain dead,"
                  b" trying to stabilize on its parent\n" %
                  obs)
         obs = obs.p1()
-        newer = obsutil.successorssets(repo, obs.node())
+        newer = obsutil.successorssets(repo, obs.node(), cache=cache)
     if len(newer) > 1 or len(newer[0]) > 1:
         raise MultipleSuccessorsError(newer)