changeset 5266:9035901412e6

topic: provide cache to successorssets() in _singlesuccessor() Since we're using obsutil.successorssets() in a loop, it may help performance to have cache.
author Anton Shestakov <av6@dwimlabs.net>
date Wed, 29 Apr 2020 00:44:14 +0800
parents 77a77d0f5441
children fbe07b1cf5d4
files hgext3rd/topic/evolvebits.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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