obsstore: minor optimization for the obsolete revset
Use local variables in a loop.
--- 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')