##// 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 fm.end()
875 fm.end()
876
876
877 @command('debugfileset',
877 @command('debugfileset',
878 [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))],
878 [('r', 'rev', '', _('apply the filespec on this revision'), _('REV')),
879 _('[-r REV] FILESPEC'))
879 ('', 'all-files', False,
880 _('test files from all revisions and working directory'))],
881 _('[-r REV] [--all-files] FILESPEC'))
880 def debugfileset(ui, repo, expr, **opts):
882 def debugfileset(ui, repo, expr, **opts):
881 '''parse and apply a fileset specification'''
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 if ui.verbose:
886 if ui.verbose:
884 tree = fileset.parse(expr)
887 tree = fileset.parse(expr)
885 ui.note(fileset.prettyformat(tree), "\n")
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 ui.write("%s\n" % f)
910 ui.write("%s\n" % f)
889
911
890 @command('debugformat',
912 @command('debugformat',
@@ -273,7 +273,7 b' Show all commands + options'
273 debugdiscovery: old, nonheads, rev, ssh, remotecmd, insecure
273 debugdiscovery: old, nonheads, rev, ssh, remotecmd, insecure
274 debugdownload: output
274 debugdownload: output
275 debugextensions: template
275 debugextensions: template
276 debugfileset: rev
276 debugfileset: rev, all-files
277 debugformat: template
277 debugformat: template
278 debugfsinfo:
278 debugfsinfo:
279 debuggetbundle: head, common, type
279 debuggetbundle: head, common, type
@@ -1,5 +1,5 b''
1 $ fileset() {
1 $ fileset() {
2 > hg debugfileset "$@"
2 > hg debugfileset --all-files "$@"
3 > }
3 > }
4
4
5 $ hg init repo
5 $ hg init repo
General Comments 0
You need to be logged in to leave comments. Login now