debugfileset: compare fileset output with ctx.matches output

Summary: This will be used to verify the next change.

Differential Revision: D35490966

fbshipit-source-id: 22896e421b515d436e15f69c3aa4e26ad8411f1e
This commit is contained in:
Jun Wu 2022-04-08 18:07:36 -07:00 committed by Facebook GitHub Bot
parent 820aa79acf
commit a00403bd6e

View File

@ -1343,9 +1343,19 @@ def debugfileset(ui, repo, expr, **opts):
tree = fileset.parse(expr)
ui.note(fileset.prettyformat(tree), "\n")
for f in ctx.getfileset(expr):
files = list(ctx.getfileset(expr))
for f in files:
ui.write("%s\n" % f)
# compare against 'set:...' which might use a different path.
pats = [f"set:{expr}"]
m = scmutil.match(ctx, pats, opts)
files = set(f for f in files if f in ctx)
files2 = set(f for f in ctx.matches(m) if f in ctx)
if files != files2:
msg = f"fileset output {sorted(files)} does not match matcher output {sorted(files2)}\n"
ui.write_err(msg)
@command("debugfsinfo|debugfs", [], _("[PATH]"), norepo=True)
def debugfsinfo(ui, path="."):