# HG changeset patch # User Yuya Nishihara # Date 1430054804 -32400 # Node ID ad1d2c952889599dbdd928239fb7609bc92dd0ec # Parent 060bdfef2517bfa06609293c66e51a2babd2df5e fileset: pretty print syntax tree in debug output diff -r 060bdfef2517 -r ad1d2c952889 mercurial/commands.py --- a/mercurial/commands.py Wed May 06 10:17:41 2015 +0900 +++ b/mercurial/commands.py Sun Apr 26 22:26:44 2015 +0900 @@ -2165,7 +2165,7 @@ ctx = scmutil.revsingle(repo, opts.get('rev'), None) if ui.verbose: tree = fileset.parse(expr) - ui.note(tree, "\n") + ui.note(fileset.prettyformat(tree), "\n") for f in ctx.getfileset(expr): ui.write("%s\n" % f) diff -r 060bdfef2517 -r ad1d2c952889 mercurial/fileset.py --- a/mercurial/fileset.py Wed May 06 10:17:41 2015 +0900 +++ b/mercurial/fileset.py Sun Apr 26 22:26:44 2015 +0900 @@ -517,5 +517,8 @@ return getset(matchctx(ctx, subset, status), tree) +def prettyformat(tree): + return parser.prettyformat(tree, ('string', 'symbol')) + # tell hggettext to extract docstrings from these functions: i18nfunctions = symbols.values() diff -r 060bdfef2517 -r ad1d2c952889 tests/test-fileset.t --- a/tests/test-fileset.t Wed May 06 10:17:41 2015 +0900 +++ b/tests/test-fileset.t Sun Apr 26 22:26:44 2015 +0900 @@ -16,15 +16,21 @@ Test operators and basic patterns - $ fileset a1 + $ fileset -v a1 + ('symbol', 'a1') a1 - $ fileset 'a*' + $ fileset -v 'a*' + ('symbol', 'a*') a1 a2 - $ fileset '"re:a\d"' + $ fileset -v '"re:a\d"' + ('string', 're:a\\d') a1 a2 - $ fileset 'a1 or a2' + $ fileset -v 'a1 or a2' + (or + ('symbol', 'a1') + ('symbol', 'a2')) a1 a2 $ fileset 'a1 | a2'