Show More
@@ -352,6 +352,9 b' def _analyze(x):' | |||||
352 | elif op == 'keyvalue': |
|
352 | elif op == 'keyvalue': | |
353 | return (op, x[1], _analyze(x[2])) |
|
353 | return (op, x[1], _analyze(x[2])) | |
354 | elif op == 'func': |
|
354 | elif op == 'func': | |
|
355 | f = getsymbol(x[1]) | |||
|
356 | if f == 'revset': | |||
|
357 | return _analyze(x[2]) | |||
355 | return (op, x[1], _analyze(x[2])) |
|
358 | return (op, x[1], _analyze(x[2])) | |
356 | raise ValueError('invalid operator %r' % op) |
|
359 | raise ValueError('invalid operator %r' % op) | |
357 |
|
360 | |||
@@ -482,6 +485,8 b' def _parsewith(spec, lookup=None, symini' | |||||
482 | ... |
|
485 | ... | |
483 | ParseError: ('invalid token', 4) |
|
486 | ParseError: ('invalid token', 4) | |
484 | """ |
|
487 | """ | |
|
488 | if lookup and spec.startswith('revset(') and spec.endswith(')'): | |||
|
489 | lookup = None | |||
485 | p = parser.parser(elements) |
|
490 | p = parser.parser(elements) | |
486 | tree, pos = p.parse(tokenize(spec, lookup=lookup, |
|
491 | tree, pos = p.parse(tokenize(spec, lookup=lookup, | |
487 | syminitletters=syminitletters)) |
|
492 | syminitletters=syminitletters)) |
@@ -62,6 +62,12 b' within a more advances revset' | |||||
62 | $ hg log -r 'rev(0) and branch(default)' |
|
62 | $ hg log -r 'rev(0) and branch(default)' | |
63 | 0:a87874c6ec31 first [] |
|
63 | 0:a87874c6ec31 first [] | |
64 |
|
64 | |||
|
65 | with explicit revset resolution | |||
|
66 | (still resolved as the label) | |||
|
67 | ||||
|
68 | $ hg log -r 'revset(rev(0))' | |||
|
69 | 0:a87874c6ec31 first [] | |||
|
70 | ||||
65 | some of the above with quote to force its resolution as a label |
|
71 | some of the above with quote to force its resolution as a label | |
66 |
|
72 | |||
67 | $ hg log -r ':"rev(0)"' |
|
73 | $ hg log -r ':"rev(0)"' | |
@@ -91,8 +97,13 b' Test label with quote in them.' | |||||
91 | $ hg log -r '("foo")' |
|
97 | $ hg log -r '("foo")' | |
92 | abort: unknown revision 'foo'! |
|
98 | abort: unknown revision 'foo'! | |
93 | [255] |
|
99 | [255] | |
|
100 | $ hg log -r 'revset("foo")' | |||
|
101 | abort: unknown revision 'foo'! | |||
|
102 | [255] | |||
94 | $ hg log -r '("\"foo\"")' |
|
103 | $ hg log -r '("\"foo\"")' | |
95 | 2:fb616635b18f Added tag rev(0) for changeset 43114e71eddd ["foo"] |
|
104 | 2:fb616635b18f Added tag rev(0) for changeset 43114e71eddd ["foo"] | |
|
105 | $ hg log -r 'revset("\"foo\"")' | |||
|
106 | 2:fb616635b18f Added tag rev(0) for changeset 43114e71eddd ["foo"] | |||
96 |
|
107 | |||
97 | Test label with dash in them. |
|
108 | Test label with dash in them. | |
98 |
|
109 | |||
@@ -116,6 +127,9 b' Test label with + in them.' | |||||
116 | $ hg log -r '(foo+bar)' |
|
127 | $ hg log -r '(foo+bar)' | |
117 | abort: unknown revision 'foo'! |
|
128 | abort: unknown revision 'foo'! | |
118 | [255] |
|
129 | [255] | |
|
130 | $ hg log -r 'revset(foo+bar)' | |||
|
131 | abort: unknown revision 'foo'! | |||
|
132 | [255] | |||
119 | $ hg log -r '"foo+bar"' |
|
133 | $ hg log -r '"foo+bar"' | |
120 | 4:bbf52b87b370 Added tag foo-bar for changeset a50aae922707 [foo+bar] |
|
134 | 4:bbf52b87b370 Added tag foo-bar for changeset a50aae922707 [foo+bar] | |
121 | $ hg log -r '("foo+bar")' |
|
135 | $ hg log -r '("foo+bar")' | |
@@ -129,6 +143,8 b' Test tag with numeric version number.' | |||||
129 | 5:ff42fde8edbb Added tag foo+bar for changeset bbf52b87b370 [1.2] |
|
143 | 5:ff42fde8edbb Added tag foo+bar for changeset bbf52b87b370 [1.2] | |
130 | $ hg log -r '(1.2)' |
|
144 | $ hg log -r '(1.2)' | |
131 | 5:ff42fde8edbb Added tag foo+bar for changeset bbf52b87b370 [1.2] |
|
145 | 5:ff42fde8edbb Added tag foo+bar for changeset bbf52b87b370 [1.2] | |
|
146 | $ hg log -r 'revset(1.2)' | |||
|
147 | 5:ff42fde8edbb Added tag foo+bar for changeset bbf52b87b370 [1.2] | |||
132 | $ hg log -r '"1.2"' |
|
148 | $ hg log -r '"1.2"' | |
133 | 5:ff42fde8edbb Added tag foo+bar for changeset bbf52b87b370 [1.2] |
|
149 | 5:ff42fde8edbb Added tag foo+bar for changeset bbf52b87b370 [1.2] | |
134 | $ hg log -r '("1.2")' |
|
150 | $ hg log -r '("1.2")' | |
@@ -157,6 +173,9 b' Test tag with parenthesis (but not a val' | |||||
157 | $ hg log -r '(release_4.1(candidate1))' |
|
173 | $ hg log -r '(release_4.1(candidate1))' | |
158 | hg: parse error: unknown identifier: release_4.1 |
|
174 | hg: parse error: unknown identifier: release_4.1 | |
159 | [255] |
|
175 | [255] | |
|
176 | $ hg log -r 'revset(release_4.1(candidate1))' | |||
|
177 | hg: parse error: unknown identifier: release_4.1 | |||
|
178 | [255] | |||
160 | $ hg log -r '"release_4.1(candidate1)"' |
|
179 | $ hg log -r '"release_4.1(candidate1)"' | |
161 | 6:db72e24fe069 Added tag 1.2 for changeset ff42fde8edbb [release_4.1(candidate1)] |
|
180 | 6:db72e24fe069 Added tag 1.2 for changeset ff42fde8edbb [release_4.1(candidate1)] | |
162 | $ hg log -r '("release_4.1(candidate1)")' |
|
181 | $ hg log -r '("release_4.1(candidate1)")' | |
@@ -182,6 +201,9 b' Test tag with parenthesis and other func' | |||||
182 | $ hg log -r '(release_4.1(arch=x86,arm))' |
|
201 | $ hg log -r '(release_4.1(arch=x86,arm))' | |
183 | hg: parse error: unknown identifier: release_4.1 |
|
202 | hg: parse error: unknown identifier: release_4.1 | |
184 | [255] |
|
203 | [255] | |
|
204 | $ hg log -r 'revset(release_4.1(arch=x86,arm))' | |||
|
205 | hg: parse error: unknown identifier: release_4.1 | |||
|
206 | [255] | |||
185 | $ hg log -r '"release_4.1(arch=x86,arm)"' |
|
207 | $ hg log -r '"release_4.1(arch=x86,arm)"' | |
186 | 7:b29b25d7d687 Added tag release_4.1(candidate1) for changeset db72e24fe069 [release_4.1(arch=x86,arm)] |
|
208 | 7:b29b25d7d687 Added tag release_4.1(candidate1) for changeset db72e24fe069 [release_4.1(arch=x86,arm)] | |
187 | $ hg log -r '("release_4.1(arch=x86,arm)")' |
|
209 | $ hg log -r '("release_4.1(arch=x86,arm)")' | |
@@ -208,6 +230,9 b' Test tag conflicting with revset functio' | |||||
208 | $ hg log -r '(secret(team=foo,project=bar))' |
|
230 | $ hg log -r '(secret(team=foo,project=bar))' | |
209 | hg: parse error: secret takes no arguments |
|
231 | hg: parse error: secret takes no arguments | |
210 | [255] |
|
232 | [255] | |
|
233 | $ hg log -r 'revset(secret(team=foo,project=bar))' | |||
|
234 | hg: parse error: secret takes no arguments | |||
|
235 | [255] | |||
211 | $ hg log -r '"secret(team=foo,project=bar)"' |
|
236 | $ hg log -r '"secret(team=foo,project=bar)"' | |
212 | 8:6b2e2d4ea455 Added tag release_4.1(arch=x86,arm) for changeset b29b25d7d687 [secret(team=foo,project=bar)] |
|
237 | 8:6b2e2d4ea455 Added tag release_4.1(arch=x86,arm) for changeset b29b25d7d687 [secret(team=foo,project=bar)] | |
213 | $ hg log -r '("secret(team=foo,project=bar)")' |
|
238 | $ hg log -r '("secret(team=foo,project=bar)")' | |
@@ -237,6 +262,11 b' Test tag with space' | |||||
237 | ((my little version) |
|
262 | ((my little version) | |
238 | ^ here) |
|
263 | ^ here) | |
239 | [255] |
|
264 | [255] | |
|
265 | $ hg log -r 'revset(my little version)' | |||
|
266 | hg: parse error at 10: unexpected token: symbol | |||
|
267 | (revset(my little version) | |||
|
268 | ^ here) | |||
|
269 | [255] | |||
240 | $ hg log -r '"my little version"' |
|
270 | $ hg log -r '"my little version"' | |
241 | 9:269192bf8fc3 Added tag secret(team=foo,project=bar) for changeset 6b2e2d4ea455 [my little version] |
|
271 | 9:269192bf8fc3 Added tag secret(team=foo,project=bar) for changeset 6b2e2d4ea455 [my little version] | |
242 | $ hg log -r '("my little version")' |
|
272 | $ hg log -r '("my little version")' |
@@ -2801,3 +2801,43 b' test multiline revset with errors' | |||||
2801 | ( . + .^ + |
|
2801 | ( . + .^ + | |
2802 | ^ here) |
|
2802 | ^ here) | |
2803 | [255] |
|
2803 | [255] | |
|
2804 | $ hg debugrevspec -v 'revset(first(rev(0)))' -p all | |||
|
2805 | * parsed: | |||
|
2806 | (func | |||
|
2807 | (symbol 'revset') | |||
|
2808 | (func | |||
|
2809 | (symbol 'first') | |||
|
2810 | (func | |||
|
2811 | (symbol 'rev') | |||
|
2812 | (symbol '0')))) | |||
|
2813 | * expanded: | |||
|
2814 | (func | |||
|
2815 | (symbol 'revset') | |||
|
2816 | (func | |||
|
2817 | (symbol 'first') | |||
|
2818 | (func | |||
|
2819 | (symbol 'rev') | |||
|
2820 | (symbol '0')))) | |||
|
2821 | * concatenated: | |||
|
2822 | (func | |||
|
2823 | (symbol 'revset') | |||
|
2824 | (func | |||
|
2825 | (symbol 'first') | |||
|
2826 | (func | |||
|
2827 | (symbol 'rev') | |||
|
2828 | (symbol '0')))) | |||
|
2829 | * analyzed: | |||
|
2830 | (func | |||
|
2831 | (symbol 'first') | |||
|
2832 | (func | |||
|
2833 | (symbol 'rev') | |||
|
2834 | (symbol '0'))) | |||
|
2835 | * optimized: | |||
|
2836 | (func | |||
|
2837 | (symbol 'first') | |||
|
2838 | (func | |||
|
2839 | (symbol 'rev') | |||
|
2840 | (symbol '0'))) | |||
|
2841 | * set: | |||
|
2842 | <baseset+ [0]> | |||
|
2843 | 0 |
General Comments 0
You need to be logged in to leave comments.
Login now