obsstore: minor optimization for the obsolete revset
authorJun Wu <quark@fb.com>
Fri, 02 Jun 2017 19:32:27 -0700
changeset 32688 2c1400d43fd2
parent 32687 12941a782928
child 32689 9933410bf763
obsstore: minor optimization for the obsolete revset Use local variables in a loop.
mercurial/obsolete.py
--- a/mercurial/obsolete.py	Sun Apr 23 00:31:29 2017 +0900
+++ b/mercurial/obsolete.py	Fri Jun 02 19:32:27 2017 -0700
@@ -1277,12 +1277,10 @@
 @cachefor('obsolete')
 def _computeobsoleteset(repo):
     """the set of obsolete revisions"""
-    obs = set()
     getnode = repo.changelog.node
     notpublic = repo._phasecache.getrevset(repo, (phases.draft, phases.secret))
-    for r in notpublic:
-        if getnode(r) in repo.obsstore.successors:
-            obs.add(r)
+    isobs = repo.obsstore.successors.__contains__
+    obs = set(r for r in notpublic if isobs(getnode(r)))
     return obs
 
 @cachefor('unstable')