diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1961,7 +1961,10 @@ def walkchangerevs(repo, match, opts, pr else: self.revs.discard(value) ctx = change(value) - matches = [f for f in ctx.files() if match(f)] + if allfiles: + matches = list(ctx.manifest().walk(match)) + else: + matches = [f for f in ctx.files() if match(f)] if matches: fncache[value] = matches self.set.add(value) diff --git a/tests/test-grep.t b/tests/test-grep.t --- a/tests/test-grep.t +++ b/tests/test-grep.t @@ -517,5 +517,8 @@ test -rMULTIREV with --all-files $ hg grep -r "0:2" "unmod" --all-files um um:0:unmod um:1:unmod + $ hg grep -r "0:2" "unmod" --all-files "glob:**/um" # Check that patterns also work + um:0:unmod + um:1:unmod $ cd ..