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