diff mercurial/debugcommands.py @ 38842:f0a574dbfae9

debugfileset: add option to show matcher representation
author Yuya Nishihara <yuya@tcha.org>
date Sat, 21 Jul 2018 15:05:40 +0900
parents 1d1c1645d7b9
children b9162ea1b815
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Sat Jul 21 14:52:36 2018 +0900
+++ b/mercurial/debugcommands.py	Sat Jul 21 15:05:40 2018 +0900
@@ -889,6 +889,8 @@
     [('r', 'rev', '', _('apply the filespec on this revision'), _('REV')),
      ('', 'all-files', False,
       _('test files from all revisions and working directory')),
+     ('s', 'show-matcher', None,
+      _('print internal representation of matcher')),
      ('p', 'show-stage', [],
       _('print parsed tree at the given stage'), _('NAME'))],
     _('[-r REV] [--all-files] [OPTION]... FILESPEC'))
@@ -939,6 +941,8 @@
         files.update(ctx.substate)
 
     m = ctx.matchfileset(expr)
+    if opts['show_matcher'] or (opts['show_matcher'] is None and ui.verbose):
+        ui.write(('* matcher:\n'), stringutil.prettyrepr(m), '\n')
     for f in sorted(files):
         if not m(f):
             continue