topic: provide cache to successorssets() in _singlesuccessor()
authorAnton Shestakov <av6@dwimlabs.net>
Wed, 29 Apr 2020 00:44:14 +0800
changeset 5312 9035901412e6
parent 5311 77a77d0f5441
child 5313 fbe07b1cf5d4
child 5314 f12d2172a133
topic: provide cache to successorssets() in _singlesuccessor() Since we're using obsutil.successorssets() in a loop, it may help performance to have cache.
hgext3rd/topic/evolvebits.py
--- a/hgext3rd/topic/evolvebits.py	Wed Apr 29 00:43:13 2020 +0800
+++ b/hgext3rd/topic/evolvebits.py	Wed Apr 29 00:44:14 2020 +0800
@@ -75,14 +75,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 1 < len(newer):
         # divergence case
         # we should pick as arbitrary one