# HG changeset patch # User Yuya Nishihara # Date 1532153140 -32400 # Node ID f0a574dbfae9cac433fe1c7d7d130ba3aadf081d # Parent 1d1c1645d7b9d15a109851d6927880922a9bc947 debugfileset: add option to show matcher representation diff -r 1d1c1645d7b9 -r f0a574dbfae9 mercurial/debugcommands.py --- 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 diff -r 1d1c1645d7b9 -r f0a574dbfae9 tests/test-completion.t --- a/tests/test-completion.t Sat Jul 21 14:52:36 2018 +0900 +++ b/tests/test-completion.t Sat Jul 21 15:05:40 2018 +0900 @@ -274,7 +274,7 @@ debugdiscovery: old, nonheads, rev, ssh, remotecmd, insecure debugdownload: output debugextensions: template - debugfileset: rev, all-files, show-stage + debugfileset: rev, all-files, show-matcher, show-stage debugformat: template debugfsinfo: debuggetbundle: head, common, type diff -r 1d1c1645d7b9 -r f0a574dbfae9 tests/test-fileset.t --- a/tests/test-fileset.t Sat Jul 21 14:52:36 2018 +0900 +++ b/tests/test-fileset.t Sat Jul 21 15:05:40 2018 +0900 @@ -18,13 +18,19 @@ $ fileset -v a1 (symbol 'a1') + * matcher: + a1 $ fileset -v 'a*' (symbol 'a*') + * matcher: + a1 a2 $ fileset -v '"re:a\d"' (string 're:a\\d') + * matcher: + a1 a2 $ fileset -v '!re:"a\d"' @@ -32,6 +38,10 @@ (kindpat (symbol 're') (string 'a\\d'))) + * matcher: + >> b1 b2 $ fileset -v 'path:a1 or glob:b?' @@ -42,10 +52,14 @@ (kindpat (symbol 'glob') (symbol 'b?'))) + * matcher: + , + ]> a1 b1 b2 - $ fileset -v 'a1 or a2' + $ fileset -v --no-show-matcher 'a1 or a2' (or (symbol 'a1') (symbol 'a2')) @@ -133,7 +147,7 @@ b1 b2 - $ fileset -p all 'a1 or a2 or (grep("b") & clean())' + $ fileset -p all -s 'a1 or a2 or (grep("b") & clean())' * parsed: (or (or @@ -147,6 +161,14 @@ (func (symbol 'clean') None)))) + * matcher: + , + ]>, + , + m2=>]> a1 a2 b1