mercurial/cmdutil.py
changeset 44805 02bf61bb4a70
parent 44452 9d2b2df2c2ba
child 44807 16596f5e1afa
--- a/mercurial/cmdutil.py	Wed May 06 11:41:01 2020 -0700
+++ b/mercurial/cmdutil.py	Wed May 06 10:33:56 2020 -0700
@@ -1496,8 +1496,11 @@
 
     def walkpat(pat):
         srcs = []
-        m = scmutil.match(ctx, [pat], opts, globbed=True)
-        for abs in ctx.walk(m):
+        # TODO: Inline and simplify the non-working-copy version of this code
+        # since it shares very little with the working-copy version of it.
+        ctx_to_walk = ctx if ctx.rev() is None else pctx
+        m = scmutil.match(ctx_to_walk, [pat], opts, globbed=True)
+        for abs in ctx_to_walk.walk(m):
             rel = uipathfn(abs)
             exact = m.exact(abs)
             if abs not in ctx: