diff --git a/mercurial/revset.py b/mercurial/revset.py
index 4bce649a2b0f49653b2caad0c9294a4303392609_bWVyY3VyaWFsL3JldnNldC5weQ==..592701c8eac6bab07ceefb22122562c8bb8d900f_bWVyY3VyaWFsL3JldnNldC5weQ== 100644
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -341,6 +341,7 @@
 def checkstatus(repo, subset, pat, field):
     m = None
     s = []
-    fast = not matchmod.patkind(pat)
+    hasset = matchmod.patkind(pat) == 'set'
+    fname = None
     for r in subset:
         c = repo[r]
@@ -345,6 +346,10 @@
     for r in subset:
         c = repo[r]
-        if fast:
-            if pat not in c.files():
+        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 fname is not None:
+            if fname not in c.files():
                 continue
         else:
@@ -349,10 +354,8 @@
                 continue
         else:
-            if not m or matchmod.patkind(pat) == 'set':
-                m = matchmod.match(repo.root, repo.getcwd(), [pat], ctx=c)
             for f in c.files():
                 if m(f):
                     break
             else:
                 continue
         files = repo.status(c.p1().node(), c.node())[field]
@@ -353,11 +356,11 @@
             for f in c.files():
                 if m(f):
                     break
             else:
                 continue
         files = repo.status(c.p1().node(), c.node())[field]
-        if fast:
-            if pat in files:
+        if fname is not None:
+            if fname in files:
                 s.append(r)
         else:
             for f in files:
diff --git a/tests/test-revset.t b/tests/test-revset.t
index 4bce649a2b0f49653b2caad0c9294a4303392609_dGVzdHMvdGVzdC1yZXZzZXQudA==..592701c8eac6bab07ceefb22122562c8bb8d900f_dGVzdHMvdGVzdC1yZXZzZXQudA== 100644
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -305,6 +305,13 @@
   6
   $ log 'modifies(b)'
   4
+  $ log 'modifies("path:b")'
+  4
+  $ log 'modifies("*")'
+  4
+  6
+  $ log 'modifies("set:modified()")'
+  4
   $ log 'id(5)'
   2
   $ log 'outgoing()'