mercurial/debugcommands.py
changeset 38610 3d8ef60569d8
parent 38599 f9805627af1f
child 38612 760cc5dc01e8
equal deleted inserted replaced
38609:d474b3b44d4f 38610:3d8ef60569d8
   873                  _('  bug reporting: %s\n'), extbuglink or "")
   873                  _('  bug reporting: %s\n'), extbuglink or "")
   874 
   874 
   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',
   891          [] + cmdutil.formatteropts,
   913          [] + cmdutil.formatteropts,
   892         _(''))
   914         _(''))