##// END OF EJS Templates
fileset: make debugfileset filter repository files...
Yuya Nishihara -
r38629:3d8ef605 default
parent child Browse files
Show More
@@ -875,16 +875,38 b' def debugextensions(ui, repo, **opts):'
875 875 fm.end()
876 876
877 877 @command('debugfileset',
878 [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))],
879 _('[-r REV] FILESPEC'))
878 [('r', 'rev', '', _('apply the filespec on this revision'), _('REV')),
879 ('', 'all-files', False,
880 _('test files from all revisions and working directory'))],
881 _('[-r REV] [--all-files] FILESPEC'))
880 882 def debugfileset(ui, repo, expr, **opts):
881 883 '''parse and apply a fileset specification'''
882 ctx = scmutil.revsingle(repo, opts.get(r'rev'), None)
884 opts = pycompat.byteskwargs(opts)
885 ctx = scmutil.revsingle(repo, opts.get('rev'), None)
883 886 if ui.verbose:
884 887 tree = fileset.parse(expr)
885 888 ui.note(fileset.prettyformat(tree), "\n")
886 889
887 for f in sorted(ctx.getfileset(expr)):
890 files = set()
891 if opts['all_files']:
892 for r in repo:
893 c = repo[r]
894 files.update(c.files())
895 files.update(c.substate)
896 if opts['all_files'] or ctx.rev() is None:
897 wctx = repo[None]
898 files.update(repo.dirstate.walk(scmutil.matchall(repo),
899 subrepos=list(wctx.substate),
900 unknown=True, ignored=True))
901 files.update(wctx.substate)
902 else:
903 files.update(ctx.files())
904 files.update(ctx.substate)
905
906 m = scmutil.matchfiles(repo, ctx.getfileset(expr))
907 for f in sorted(files):
908 if not m(f):
909 continue
888 910 ui.write("%s\n" % f)
889 911
890 912 @command('debugformat',
@@ -273,7 +273,7 b' Show all commands + options'
273 273 debugdiscovery: old, nonheads, rev, ssh, remotecmd, insecure
274 274 debugdownload: output
275 275 debugextensions: template
276 debugfileset: rev
276 debugfileset: rev, all-files
277 277 debugformat: template
278 278 debugfsinfo:
279 279 debuggetbundle: head, common, type
@@ -1,5 +1,5 b''
1 1 $ fileset() {
2 > hg debugfileset "$@"
2 > hg debugfileset --all-files "$@"
3 3 > }
4 4
5 5 $ hg init repo
General Comments 0
You need to be logged in to leave comments. Login now