##// END OF EJS Templates
debugrevspec: show nesting structure of smartsets if verbose...
Yuya Nishihara -
r24458:7d87f672 default
parent child Browse files
Show More
@@ -2929,7 +2929,10 b' def debugrevspec(ui, repo, expr, **opts)'
2929 weight, optimizedtree = revset.optimize(newtree, True)
2929 weight, optimizedtree = revset.optimize(newtree, True)
2930 ui.note("* optimized:\n", revset.prettyformat(optimizedtree), "\n")
2930 ui.note("* optimized:\n", revset.prettyformat(optimizedtree), "\n")
2931 func = revset.match(ui, expr)
2931 func = revset.match(ui, expr)
2932 for c in func(repo):
2932 revs = func(repo)
2933 if ui.verbose:
2934 ui.note("* set:\n", revset.prettyformatset(revs), "\n")
2935 for c in revs:
2933 ui.write("%s\n" % c)
2936 ui.write("%s\n" % c)
2934
2937
2935 @command('debugsetparents', [], _('REV1 [REV2]'))
2938 @command('debugsetparents', [], _('REV1 [REV2]'))
@@ -3419,5 +3419,19 b' class fullreposet(spanset):'
3419 other.sort(reverse=self.isdescending())
3419 other.sort(reverse=self.isdescending())
3420 return other
3420 return other
3421
3421
3422 def prettyformatset(revs):
3423 lines = []
3424 rs = repr(revs)
3425 p = 0
3426 while p < len(rs):
3427 q = rs.find('<', p + 1)
3428 if q < 0:
3429 q = len(rs)
3430 l = rs.count('<', 0, p) - rs.count('>', 0, p)
3431 assert l >= 0
3432 lines.append((l, rs[p:q].rstrip()))
3433 p = q
3434 return '\n'.join(' ' * l + s for l, s in lines)
3435
3422 # tell hggettext to extract docstrings from these functions:
3436 # tell hggettext to extract docstrings from these functions:
3423 i18nfunctions = symbols.values()
3437 i18nfunctions = symbols.values()
@@ -16,14 +16,20 b''
16 (func
16 (func
17 ('symbol', 'p1')
17 ('symbol', 'p1')
18 None)
18 None)
19 * set:
20 <baseset []>
19 $ try 'p2()'
21 $ try 'p2()'
20 (func
22 (func
21 ('symbol', 'p2')
23 ('symbol', 'p2')
22 None)
24 None)
25 * set:
26 <baseset []>
23 $ try 'parents()'
27 $ try 'parents()'
24 (func
28 (func
25 ('symbol', 'parents')
29 ('symbol', 'parents')
26 None)
30 None)
31 * set:
32 <baseset+ []>
27
33
28 null revision
34 null revision
29 $ log 'p1()'
35 $ log 'p1()'
@@ -93,31 +93,83 b''
93 $ echo "[paths]" >> .hg/hgrc
93 $ echo "[paths]" >> .hg/hgrc
94 $ echo "default = ../remote1" >> .hg/hgrc
94 $ echo "default = ../remote1" >> .hg/hgrc
95
95
96 trivial
97
98 $ try 0:1
99 (range
100 ('symbol', '0')
101 ('symbol', '1'))
102 * set:
103 <filteredset
104 <spanset+ 0:1>>
105 0
106 1
107 $ try 3::6
108 (dagrange
109 ('symbol', '3')
110 ('symbol', '6'))
111 * set:
112 <filteredset
113 <baseset [3, 5, 6]>>
114 3
115 5
116 6
117 $ try '0|1|2'
118 (or
119 (or
120 ('symbol', '0')
121 ('symbol', '1'))
122 ('symbol', '2'))
123 * set:
124 <addset
125 <addset
126 <baseset [0]>,
127 <baseset [1]>>,
128 <baseset [2]>>
129 0
130 1
131 2
132
96 names that should work without quoting
133 names that should work without quoting
97
134
98 $ try a
135 $ try a
99 ('symbol', 'a')
136 ('symbol', 'a')
137 * set:
138 <baseset [0]>
100 0
139 0
101 $ try b-a
140 $ try b-a
102 (minus
141 (minus
103 ('symbol', 'b')
142 ('symbol', 'b')
104 ('symbol', 'a'))
143 ('symbol', 'a'))
144 * set:
145 <filteredset
146 <baseset [1]>>
105 1
147 1
106 $ try _a_b_c_
148 $ try _a_b_c_
107 ('symbol', '_a_b_c_')
149 ('symbol', '_a_b_c_')
150 * set:
151 <baseset [6]>
108 6
152 6
109 $ try _a_b_c_-a
153 $ try _a_b_c_-a
110 (minus
154 (minus
111 ('symbol', '_a_b_c_')
155 ('symbol', '_a_b_c_')
112 ('symbol', 'a'))
156 ('symbol', 'a'))
157 * set:
158 <filteredset
159 <baseset [6]>>
113 6
160 6
114 $ try .a.b.c.
161 $ try .a.b.c.
115 ('symbol', '.a.b.c.')
162 ('symbol', '.a.b.c.')
163 * set:
164 <baseset [7]>
116 7
165 7
117 $ try .a.b.c.-a
166 $ try .a.b.c.-a
118 (minus
167 (minus
119 ('symbol', '.a.b.c.')
168 ('symbol', '.a.b.c.')
120 ('symbol', 'a'))
169 ('symbol', 'a'))
170 * set:
171 <filteredset
172 <baseset [7]>>
121 7
173 7
122 $ try -- '-a-b-c-' # complains
174 $ try -- '-a-b-c-' # complains
123 hg: parse error at 7: not a prefix: end
175 hg: parse error at 7: not a prefix: end
@@ -139,6 +191,8 b' names that should work without quoting'
139 [255]
191 [255]
140 $ try Γ©
192 $ try Γ©
141 ('symbol', '\xc3\xa9')
193 ('symbol', '\xc3\xa9')
194 * set:
195 <baseset [9]>
142 9
196 9
143
197
144 no quoting needed
198 no quoting needed
@@ -154,6 +208,9 b' quoting needed'
154 (minus
208 (minus
155 ('string', '-a-b-c-')
209 ('string', '-a-b-c-')
156 ('symbol', 'a'))
210 ('symbol', 'a'))
211 * set:
212 <filteredset
213 <baseset [4]>>
157 4
214 4
158
215
159 $ log '1 or 2'
216 $ log '1 or 2'
@@ -170,6 +227,10 b' quoting needed'
170 ('symbol', '1')
227 ('symbol', '1')
171 ('symbol', '2'))
228 ('symbol', '2'))
172 ('symbol', '3'))
229 ('symbol', '3'))
230 * set:
231 <addset
232 <baseset []>,
233 <baseset [3]>>
173 3
234 3
174 $ try '1|2&3'
235 $ try '1|2&3'
175 (or
236 (or
@@ -177,6 +238,10 b' quoting needed'
177 (and
238 (and
178 ('symbol', '2')
239 ('symbol', '2')
179 ('symbol', '3')))
240 ('symbol', '3')))
241 * set:
242 <addset
243 <baseset [1]>,
244 <baseset []>>
180 1
245 1
181 $ try '1&2&3' # associativity
246 $ try '1&2&3' # associativity
182 (and
247 (and
@@ -184,6 +249,8 b' quoting needed'
184 ('symbol', '1')
249 ('symbol', '1')
185 ('symbol', '2'))
250 ('symbol', '2'))
186 ('symbol', '3'))
251 ('symbol', '3'))
252 * set:
253 <baseset []>
187 $ try '1|(2|3)'
254 $ try '1|(2|3)'
188 (or
255 (or
189 ('symbol', '1')
256 ('symbol', '1')
@@ -191,6 +258,12 b' quoting needed'
191 (or
258 (or
192 ('symbol', '2')
259 ('symbol', '2')
193 ('symbol', '3'))))
260 ('symbol', '3'))))
261 * set:
262 <addset
263 <baseset [1]>,
264 <addset
265 <baseset [2]>,
266 <baseset [3]>>>
194 1
267 1
195 2
268 2
196 3
269 3
@@ -325,10 +398,16 b' ancestor can accept 0 or more arguments'
325 (func
398 (func
326 ('symbol', 'grep')
399 ('symbol', 'grep')
327 ('string', '\x08issue\\d+'))
400 ('string', '\x08issue\\d+'))
401 * set:
402 <filteredset
403 <fullreposet+ 0:9>>
328 $ try 'grep(r"\bissue\d+")'
404 $ try 'grep(r"\bissue\d+")'
329 (func
405 (func
330 ('symbol', 'grep')
406 ('symbol', 'grep')
331 ('string', '\\bissue\\d+'))
407 ('string', '\\bissue\\d+'))
408 * set:
409 <filteredset
410 <fullreposet+ 0:9>>
332 6
411 6
333 $ try 'grep(r"\")'
412 $ try 'grep(r"\")'
334 hg: parse error at 7: unterminated string
413 hg: parse error at 7: unterminated string
@@ -691,6 +770,8 b' check that conversion to only works'
691 (list
770 (list
692 ('symbol', '3')
771 ('symbol', '3')
693 ('symbol', '1')))
772 ('symbol', '1')))
773 * set:
774 <baseset+ [3]>
694 3
775 3
695 $ try --optimize 'ancestors(1) - ancestors(3)'
776 $ try --optimize 'ancestors(1) - ancestors(3)'
696 (minus
777 (minus
@@ -706,6 +787,8 b' check that conversion to only works'
706 (list
787 (list
707 ('symbol', '1')
788 ('symbol', '1')
708 ('symbol', '3')))
789 ('symbol', '3')))
790 * set:
791 <baseset+ []>
709 $ try --optimize 'not ::2 and ::6'
792 $ try --optimize 'not ::2 and ::6'
710 (and
793 (and
711 (not
794 (not
@@ -719,6 +802,8 b' check that conversion to only works'
719 (list
802 (list
720 ('symbol', '6')
803 ('symbol', '6')
721 ('symbol', '2')))
804 ('symbol', '2')))
805 * set:
806 <baseset+ [3, 4, 5, 6]>
722 3
807 3
723 4
808 4
724 5
809 5
@@ -738,6 +823,8 b' check that conversion to only works'
738 (list
823 (list
739 ('symbol', '6')
824 ('symbol', '6')
740 ('symbol', '4')))
825 ('symbol', '4')))
826 * set:
827 <baseset+ [3, 5, 6]>
741 3
828 3
742 5
829 5
743 6
830 6
@@ -974,6 +1061,9 b' aliases:'
974 (func
1061 (func
975 ('symbol', 'merge')
1062 ('symbol', 'merge')
976 None)
1063 None)
1064 * set:
1065 <filteredset
1066 <fullreposet+ 0:9>>
977 6
1067 6
978
1068
979 test alias recursion
1069 test alias recursion
@@ -985,6 +1075,11 b' test alias recursion'
985 (func
1075 (func
986 ('symbol', 'merge')
1076 ('symbol', 'merge')
987 None))
1077 None))
1078 * set:
1079 <addset+
1080 <filteredset
1081 <fullreposet+ 0:9>>,
1082 <generatorset+>>
988 6
1083 6
989 7
1084 7
990
1085
@@ -1014,6 +1109,12 b' test infinite recursion'
1014 (or
1109 (or
1015 ('symbol', '1')
1110 ('symbol', '1')
1016 ('symbol', '2')))
1111 ('symbol', '2')))
1112 * set:
1113 <addset
1114 <baseset [3]>,
1115 <addset
1116 <baseset [1]>,
1117 <baseset [2]>>>
1017 3
1118 3
1018 1
1119 1
1019 2
1120 2
@@ -1034,6 +1135,8 b' test nesting and variable passing'
1034 (range
1135 (range
1035 ('symbol', '2')
1136 ('symbol', '2')
1036 ('symbol', '5')))
1137 ('symbol', '5')))
1138 * set:
1139 <baseset [5]>
1037 5
1140 5
1038
1141
1039 test variable isolation, variable placeholders are rewritten as string
1142 test variable isolation, variable placeholders are rewritten as string
@@ -1070,17 +1173,23 b' far away.'
1070 ('symbol', 'tip')
1173 ('symbol', 'tip')
1071 warning: failed to parse the definition of revset alias "anotherbadone": at 7: not a prefix: end
1174 warning: failed to parse the definition of revset alias "anotherbadone": at 7: not a prefix: end
1072 warning: failed to parse the definition of revset alias "injectparamasstring2": unknown identifier: _aliasarg
1175 warning: failed to parse the definition of revset alias "injectparamasstring2": unknown identifier: _aliasarg
1176 * set:
1177 <baseset [9]>
1073 9
1178 9
1074 >>> data = file('.hg/hgrc', 'rb').read()
1179 >>> data = file('.hg/hgrc', 'rb').read()
1075 >>> file('.hg/hgrc', 'wb').write(data.replace('_aliasarg', ''))
1180 >>> file('.hg/hgrc', 'wb').write(data.replace('_aliasarg', ''))
1076
1181
1077 $ try 'tip'
1182 $ try 'tip'
1078 ('symbol', 'tip')
1183 ('symbol', 'tip')
1184 * set:
1185 <baseset [9]>
1079 9
1186 9
1080
1187
1081 $ hg debugrevspec --debug --config revsetalias.'bad name'='tip' "tip"
1188 $ hg debugrevspec --debug --config revsetalias.'bad name'='tip' "tip"
1082 ('symbol', 'tip')
1189 ('symbol', 'tip')
1083 warning: failed to parse the declaration of revset alias "bad name": at 4: invalid token
1190 warning: failed to parse the declaration of revset alias "bad name": at 4: invalid token
1191 * set:
1192 <baseset [9]>
1084 9
1193 9
1085 $ echo 'strictreplacing($1, $10) = $10 or desc("$1")' >> .hg/hgrc
1194 $ echo 'strictreplacing($1, $10) = $10 or desc("$1")' >> .hg/hgrc
1086 $ try 'strictreplacing("foo", tip)'
1195 $ try 'strictreplacing("foo", tip)'
@@ -1094,6 +1203,12 b' far away.'
1094 (func
1203 (func
1095 ('symbol', 'desc')
1204 ('symbol', 'desc')
1096 ('string', '$1')))
1205 ('string', '$1')))
1206 * set:
1207 <addset
1208 <baseset [9]>,
1209 <filteredset
1210 <filteredset
1211 <fullreposet+ 0:9>>>>
1097 9
1212 9
1098
1213
1099 $ try 'd(2:5)'
1214 $ try 'd(2:5)'
@@ -1111,6 +1226,8 b' far away.'
1111 ('symbol', '2')
1226 ('symbol', '2')
1112 ('symbol', '5'))
1227 ('symbol', '5'))
1113 ('symbol', 'date'))))
1228 ('symbol', 'date'))))
1229 * set:
1230 <baseset [4, 5, 3, 2]>
1114 4
1231 4
1115 5
1232 5
1116 3
1233 3
@@ -1132,6 +1249,8 b' far away.'
1132 ('symbol', '2')
1249 ('symbol', '2')
1133 ('symbol', '3'))
1250 ('symbol', '3'))
1134 ('symbol', 'date'))))
1251 ('symbol', 'date'))))
1252 * set:
1253 <baseset [3, 2]>
1135 3
1254 3
1136 2
1255 2
1137 $ try 'rs()'
1256 $ try 'rs()'
@@ -1177,6 +1296,8 b' far away.'
1177 ('symbol', '2')
1296 ('symbol', '2')
1178 ('symbol', '3'))
1297 ('symbol', '3'))
1179 ('symbol', 'date'))))
1298 ('symbol', 'date'))))
1299 * set:
1300 <baseset [3, 2]>
1180 3
1301 3
1181 2
1302 2
1182
1303
@@ -1317,6 +1438,8 b' tests for concatenation of strings/symbo'
1317 ('symbol', '1ee'))
1438 ('symbol', '1ee'))
1318 ('string', 'ce5'))
1439 ('string', 'ce5'))
1319 ('string', '2785f51eece5')
1440 ('string', '2785f51eece5')
1441 * set:
1442 <baseset [0]>
1320 0
1443 0
1321
1444
1322 $ echo 'cat4($1, $2, $3, $4) = $1 ## $2 ## $3 ## $4' >> .hg/hgrc
1445 $ echo 'cat4($1, $2, $3, $4) = $1 ## $2 ## $3 ## $4' >> .hg/hgrc
@@ -1338,6 +1461,8 b' tests for concatenation of strings/symbo'
1338 ('symbol', '1ee'))
1461 ('symbol', '1ee'))
1339 ('string', 'ce5'))
1462 ('string', 'ce5'))
1340 ('string', '2785f51eece5')
1463 ('string', '2785f51eece5')
1464 * set:
1465 <baseset [0]>
1341 0
1466 0
1342
1467
1343 (check concatenation in alias nesting)
1468 (check concatenation in alias nesting)
General Comments 0
You need to be logged in to leave comments. Login now