mercurial/revset.py
branchstable
changeset 23115 c23c03605c59
parent 23100 ac494b087feb
child 23127 7361d8244efb
--- a/mercurial/revset.py	Sat Nov 01 02:43:08 2014 +0900
+++ b/mercurial/revset.py	Fri Oct 31 10:41:36 2014 -0700
@@ -526,14 +526,15 @@
 def checkstatus(repo, subset, pat, field):
     hasset = matchmod.patkind(pat) == 'set'
 
+    mcache = [None]
     def matches(x):
-        m = None
-        fname = None
         c = repo[x]
-        if not m or hasset:
-            m = matchmod.match(repo.root, repo.getcwd(), [pat], ctx=c)
-            if not m.anypats() and len(m.files()) == 1:
-                fname = m.files()[0]
+        if not mcache[0] or hasset:
+            mcache[0] = matchmod.match(repo.root, repo.getcwd(), [pat], ctx=c)
+        m = mcache[0]
+        fname = None
+        if not m.anypats() and len(m.files()) == 1:
+            fname = m.files()[0]
         if fname is not None:
             if fname not in c.files():
                 return False