diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1847,14 +1847,17 @@ def debugdiscovery(ui, repo, remoteurl=" localrevs = opts.get('local_head') doit(localrevs, remoterevs) -@command('debugfileset', [], ('REVSPEC')) -def debugfileset(ui, repo, expr): +@command('debugfileset', + [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))], + _('[-r REV] FILESPEC')) +def debugfileset(ui, repo, expr, **opts): '''parse and apply a fileset specification''' + ctx = scmutil.revsingle(repo, opts.get('rev'), None) if ui.verbose: tree = fileset.parse(expr)[0] ui.note(tree, "\n") - for f in fileset.getfileset(repo[None], expr): + for f in fileset.getfileset(ctx, expr): ui.write("%s\n" % f) @command('debugfsinfo', [], _('[PATH]')) diff --git a/tests/test-debugcomplete.t b/tests/test-debugcomplete.t --- a/tests/test-debugcomplete.t +++ b/tests/test-debugcomplete.t @@ -229,7 +229,7 @@ Show all commands + options debugdata: changelog, manifest debugdate: extended debugdiscovery: old, nonheads, ssh, remotecmd, insecure - debugfileset: + debugfileset: rev debugfsinfo: debuggetbundle: head, common, type debugignore: diff --git a/tests/test-fileset.t b/tests/test-fileset.t --- a/tests/test-fileset.t +++ b/tests/test-fileset.t @@ -173,4 +173,53 @@ Test subrepo predicate sub $ fileset 'subrepo("glob:*")' sub + $ hg ci -m subrepo +Test with a revision + + $ hg log -G --template '{rev} {desc}\n' + @ 4 subrepo + | + o 3 merge + |\ + | o 2 diverging + | | + o | 1 manychanges + |/ + o 0 addfiles + + $ echo unknown > unknown + $ fileset -r1 'modified()' + b2 + $ fileset -r1 'added() and c1' + c1 + $ fileset -r1 'removed()' + a2 + $ fileset -r1 'deleted()' + $ fileset -r1 'unknown()' + $ fileset -r1 'ignored()' + $ fileset -r1 'hgignore()' + b2 + bin + $ fileset -r1 'binary()' + bin + $ fileset -r1 'size(1k)' + 1k + $ fileset -r3 'resolved()' + $ fileset -r3 'unresolved()' + +#if execbit + $ fileset -r1 'exec()' + b2 +#endif + +#if symlink + $ fileset -r1 'symlink()' + b2link +#endif + + $ fileset -r4 'subrepo("re:su.*")' + sub + $ fileset -r4 'subrepo("sub")' + sub +