diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2584,7 +2584,7 @@ def cat(ui, repo, ctx, matcher, prefix, # Don't warn about "missing" files that are really in subrepos def badfn(path, msg): for subpath in ctx.substate: - if path.startswith(subpath): + if path.startswith(subpath + '/'): return matcher.bad(path, msg) diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t --- a/tests/test-subrepo.t +++ b/tests/test-subrepo.t @@ -60,6 +60,9 @@ Subrepopath which overlaps with filepath $ hg remove -S snot/file not removing snot/file: file is untracked [1] + $ hg cat snot/filenot + snot/filenot: no such file in rev 7cf8cfea66e4 + [1] $ rm -r snot Revert subrepo and test subrepo fileset keyword: