files: make files respect sparse profile

Summary:
A previous diff broke this. hg files should only print files that
respect the current sparse profile. Let's fix that.

Reviewed By: quark-zju

Differential Revision: D18255444

fbshipit-source-id: 2c63fa5921ddaa00a8349a57ea610c53a3b35ded
This commit is contained in:
Durham Goode 2019-11-01 13:29:32 -07:00 committed by Facebook Github Bot
parent e760386f49
commit 9cbb9a90b4
2 changed files with 7 additions and 0 deletions

View File

@ -30,6 +30,7 @@ from .. import (
bundle2,
changegroup,
cmdutil,
context,
copies,
destutil,
dirstateguard,
@ -45,6 +46,7 @@ from .. import (
hg,
hintutil,
lock as lockmod,
match as matchmod,
merge as mergemod,
mutation,
obsolete,
@ -2242,6 +2244,9 @@ def files(ui, repo, *pats, **opts):
fmt = "%s" + end
m = scmutil.match(ctx, pats, opts)
if isinstance(ctx, context.workingctx) and util.safehasattr(repo, "sparsematch"):
m = matchmod.intersectmatchers(m, repo.sparsematch())
ui.pager("files")
with ui.formatter("files", opts) as fm:
return cmdutil.files(ui, ctx, m, fm, fmt)

View File

@ -87,6 +87,8 @@ Verify commiting while sparse includes other files
$ hg manifest
hide
show
$ hg files
hide
Verify --reset brings files back