##// END OF EJS Templates
debugfileset: add option to show matcher representation
Yuya Nishihara -
r38838:f0a574db default
parent child Browse files
Show More
@@ -889,6 +889,8 b' def debugextensions(ui, repo, **opts):'
889 889 [('r', 'rev', '', _('apply the filespec on this revision'), _('REV')),
890 890 ('', 'all-files', False,
891 891 _('test files from all revisions and working directory')),
892 ('s', 'show-matcher', None,
893 _('print internal representation of matcher')),
892 894 ('p', 'show-stage', [],
893 895 _('print parsed tree at the given stage'), _('NAME'))],
894 896 _('[-r REV] [--all-files] [OPTION]... FILESPEC'))
@@ -939,6 +941,8 b' def debugfileset(ui, repo, expr, **opts)'
939 941 files.update(ctx.substate)
940 942
941 943 m = ctx.matchfileset(expr)
944 if opts['show_matcher'] or (opts['show_matcher'] is None and ui.verbose):
945 ui.write(('* matcher:\n'), stringutil.prettyrepr(m), '\n')
942 946 for f in sorted(files):
943 947 if not m(f):
944 948 continue
@@ -274,7 +274,7 b' Show all commands + options'
274 274 debugdiscovery: old, nonheads, rev, ssh, remotecmd, insecure
275 275 debugdownload: output
276 276 debugextensions: template
277 debugfileset: rev, all-files, show-stage
277 debugfileset: rev, all-files, show-matcher, show-stage
278 278 debugformat: template
279 279 debugfsinfo:
280 280 debuggetbundle: head, common, type
@@ -18,13 +18,19 b' Test operators and basic patterns'
18 18
19 19 $ fileset -v a1
20 20 (symbol 'a1')
21 * matcher:
22 <patternmatcher patterns='(?:a1$)'>
21 23 a1
22 24 $ fileset -v 'a*'
23 25 (symbol 'a*')
26 * matcher:
27 <patternmatcher patterns='(?:a[^/]*$)'>
24 28 a1
25 29 a2
26 30 $ fileset -v '"re:a\d"'
27 31 (string 're:a\\d')
32 * matcher:
33 <patternmatcher patterns='(?:a\\d)'>
28 34 a1
29 35 a2
30 36 $ fileset -v '!re:"a\d"'
@@ -32,6 +38,10 b' Test operators and basic patterns'
32 38 (kindpat
33 39 (symbol 're')
34 40 (string 'a\\d')))
41 * matcher:
42 <predicatenmatcher
43 pred=<not
44 <patternmatcher patterns='(?:a\\d)'>>>
35 45 b1
36 46 b2
37 47 $ fileset -v 'path:a1 or glob:b?'
@@ -42,10 +52,14 b' Test operators and basic patterns'
42 52 (kindpat
43 53 (symbol 'glob')
44 54 (symbol 'b?')))
55 * matcher:
56 <unionmatcher matchers=[
57 <patternmatcher patterns='(?:a1(?:/|$))'>,
58 <patternmatcher patterns='(?:b.$)'>]>
45 59 a1
46 60 b1
47 61 b2
48 $ fileset -v 'a1 or a2'
62 $ fileset -v --no-show-matcher 'a1 or a2'
49 63 (or
50 64 (symbol 'a1')
51 65 (symbol 'a2'))
@@ -133,7 +147,7 b' Show parsed tree at stages:'
133 147 b1
134 148 b2
135 149
136 $ fileset -p all 'a1 or a2 or (grep("b") & clean())'
150 $ fileset -p all -s 'a1 or a2 or (grep("b") & clean())'
137 151 * parsed:
138 152 (or
139 153 (or
@@ -147,6 +161,14 b' Show parsed tree at stages:'
147 161 (func
148 162 (symbol 'clean')
149 163 None))))
164 * matcher:
165 <unionmatcher matchers=[
166 <unionmatcher matchers=[
167 <patternmatcher patterns='(?:a1$)'>,
168 <patternmatcher patterns='(?:a2$)'>]>,
169 <intersectionmatcher
170 m1=<predicatenmatcher pred=grep('b')>,
171 m2=<predicatenmatcher pred=clean>>]>
150 172 a1
151 173 a2
152 174 b1
General Comments 0
You need to be logged in to leave comments. Login now