--- a/mercurial/revset.py Wed Nov 18 15:46:45 2015 -0800
+++ b/mercurial/revset.py Wed Nov 18 23:23:03 2015 -0800
@@ -1164,8 +1164,16 @@
m = matchmod.match(repo.root, repo.getcwd(), pats, include=inc,
exclude=exc, ctx=repo[rev], default=default)
+ # This directly read the changelog data as creating changectx for all
+ # revisions is quite expensive.
+ getchangeset = repo.changelog.read
+ wdirrev = node.wdirrev
def matches(x):
- for f in repo[x].files():
+ if x == wdirrev:
+ files = repo[x].files()
+ else:
+ files = getchangeset(x)[3]
+ for f in files:
if m(f):
return True
return False