mercurial/revset.py
changeset 27028 f92053df8f0b
parent 26778 a95c975f42e3
child 27293 9e06e7fb037d
--- 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