changeset 32688:2c1400d43fd2

obsstore: minor optimization for the obsolete revset Use local variables in a loop.
author Jun Wu <quark@fb.com>
date Fri, 02 Jun 2017 19:32:27 -0700
parents 12941a782928
children 9933410bf763
files mercurial/obsolete.py
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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')