Show More
@@ -1,718 +1,723 | |||||
1 | # revsetlang.py - parser, tokenizer and utility for revision set language |
|
1 | # revsetlang.py - parser, tokenizer and utility for revision set language | |
2 | # |
|
2 | # | |
3 | # Copyright 2010 Matt Mackall <mpm@selenic.com> |
|
3 | # Copyright 2010 Matt Mackall <mpm@selenic.com> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | from __future__ import absolute_import |
|
8 | from __future__ import absolute_import | |
9 |
|
9 | |||
10 | import string |
|
10 | import string | |
11 |
|
11 | |||
12 | from .i18n import _ |
|
12 | from .i18n import _ | |
13 | from . import ( |
|
13 | from . import ( | |
14 | error, |
|
14 | error, | |
15 | node, |
|
15 | node, | |
16 | parser, |
|
16 | parser, | |
17 | pycompat, |
|
17 | pycompat, | |
18 | util, |
|
18 | util, | |
19 | ) |
|
19 | ) | |
20 |
|
20 | |||
21 | elements = { |
|
21 | elements = { | |
22 | # token-type: binding-strength, primary, prefix, infix, suffix |
|
22 | # token-type: binding-strength, primary, prefix, infix, suffix | |
23 | "(": (21, None, ("group", 1, ")"), ("func", 1, ")"), None), |
|
23 | "(": (21, None, ("group", 1, ")"), ("func", 1, ")"), None), | |
24 | "##": (20, None, None, ("_concat", 20), None), |
|
24 | "##": (20, None, None, ("_concat", 20), None), | |
25 | "~": (18, None, None, ("ancestor", 18), None), |
|
25 | "~": (18, None, None, ("ancestor", 18), None), | |
26 | "^": (18, None, None, ("parent", 18), "parentpost"), |
|
26 | "^": (18, None, None, ("parent", 18), "parentpost"), | |
27 | "-": (5, None, ("negate", 19), ("minus", 5), None), |
|
27 | "-": (5, None, ("negate", 19), ("minus", 5), None), | |
28 | "::": (17, None, ("dagrangepre", 17), ("dagrange", 17), "dagrangepost"), |
|
28 | "::": (17, None, ("dagrangepre", 17), ("dagrange", 17), "dagrangepost"), | |
29 | "..": (17, None, ("dagrangepre", 17), ("dagrange", 17), "dagrangepost"), |
|
29 | "..": (17, None, ("dagrangepre", 17), ("dagrange", 17), "dagrangepost"), | |
30 | ":": (15, "rangeall", ("rangepre", 15), ("range", 15), "rangepost"), |
|
30 | ":": (15, "rangeall", ("rangepre", 15), ("range", 15), "rangepost"), | |
31 | "not": (10, None, ("not", 10), None, None), |
|
31 | "not": (10, None, ("not", 10), None, None), | |
32 | "!": (10, None, ("not", 10), None, None), |
|
32 | "!": (10, None, ("not", 10), None, None), | |
33 | "and": (5, None, None, ("and", 5), None), |
|
33 | "and": (5, None, None, ("and", 5), None), | |
34 | "&": (5, None, None, ("and", 5), None), |
|
34 | "&": (5, None, None, ("and", 5), None), | |
35 | "%": (5, None, None, ("only", 5), "onlypost"), |
|
35 | "%": (5, None, None, ("only", 5), "onlypost"), | |
36 | "or": (4, None, None, ("or", 4), None), |
|
36 | "or": (4, None, None, ("or", 4), None), | |
37 | "|": (4, None, None, ("or", 4), None), |
|
37 | "|": (4, None, None, ("or", 4), None), | |
38 | "+": (4, None, None, ("or", 4), None), |
|
38 | "+": (4, None, None, ("or", 4), None), | |
39 | "=": (3, None, None, ("keyvalue", 3), None), |
|
39 | "=": (3, None, None, ("keyvalue", 3), None), | |
40 | ",": (2, None, None, ("list", 2), None), |
|
40 | ",": (2, None, None, ("list", 2), None), | |
41 | ")": (0, None, None, None, None), |
|
41 | ")": (0, None, None, None, None), | |
42 | "symbol": (0, "symbol", None, None, None), |
|
42 | "symbol": (0, "symbol", None, None, None), | |
43 | "string": (0, "string", None, None, None), |
|
43 | "string": (0, "string", None, None, None), | |
44 | "end": (0, None, None, None, None), |
|
44 | "end": (0, None, None, None, None), | |
45 | } |
|
45 | } | |
46 |
|
46 | |||
47 | keywords = {'and', 'or', 'not'} |
|
47 | keywords = {'and', 'or', 'not'} | |
48 |
|
48 | |||
49 | _quoteletters = {'"', "'"} |
|
49 | _quoteletters = {'"', "'"} | |
50 | _simpleopletters = set(pycompat.iterbytestr("():=,-|&+!~^%")) |
|
50 | _simpleopletters = set(pycompat.iterbytestr("():=,-|&+!~^%")) | |
51 |
|
51 | |||
52 | # default set of valid characters for the initial letter of symbols |
|
52 | # default set of valid characters for the initial letter of symbols | |
53 | _syminitletters = set(pycompat.iterbytestr( |
|
53 | _syminitletters = set(pycompat.iterbytestr( | |
54 | string.ascii_letters.encode('ascii') + |
|
54 | string.ascii_letters.encode('ascii') + | |
55 | string.digits.encode('ascii') + |
|
55 | string.digits.encode('ascii') + | |
56 | '._@')) | set(map(pycompat.bytechr, xrange(128, 256))) |
|
56 | '._@')) | set(map(pycompat.bytechr, xrange(128, 256))) | |
57 |
|
57 | |||
58 | # default set of valid characters for non-initial letters of symbols |
|
58 | # default set of valid characters for non-initial letters of symbols | |
59 | _symletters = _syminitletters | set(pycompat.iterbytestr('-/')) |
|
59 | _symletters = _syminitletters | set(pycompat.iterbytestr('-/')) | |
60 |
|
60 | |||
61 | def tokenize(program, lookup=None, syminitletters=None, symletters=None): |
|
61 | def tokenize(program, lookup=None, syminitletters=None, symletters=None): | |
62 | ''' |
|
62 | ''' | |
63 | Parse a revset statement into a stream of tokens |
|
63 | Parse a revset statement into a stream of tokens | |
64 |
|
64 | |||
65 | ``syminitletters`` is the set of valid characters for the initial |
|
65 | ``syminitletters`` is the set of valid characters for the initial | |
66 | letter of symbols. |
|
66 | letter of symbols. | |
67 |
|
67 | |||
68 | By default, character ``c`` is recognized as valid for initial |
|
68 | By default, character ``c`` is recognized as valid for initial | |
69 | letter of symbols, if ``c.isalnum() or c in '._@' or ord(c) > 127``. |
|
69 | letter of symbols, if ``c.isalnum() or c in '._@' or ord(c) > 127``. | |
70 |
|
70 | |||
71 | ``symletters`` is the set of valid characters for non-initial |
|
71 | ``symletters`` is the set of valid characters for non-initial | |
72 | letters of symbols. |
|
72 | letters of symbols. | |
73 |
|
73 | |||
74 | By default, character ``c`` is recognized as valid for non-initial |
|
74 | By default, character ``c`` is recognized as valid for non-initial | |
75 | letters of symbols, if ``c.isalnum() or c in '-._/@' or ord(c) > 127``. |
|
75 | letters of symbols, if ``c.isalnum() or c in '-._/@' or ord(c) > 127``. | |
76 |
|
76 | |||
77 | Check that @ is a valid unquoted token character (issue3686): |
|
77 | Check that @ is a valid unquoted token character (issue3686): | |
78 | >>> list(tokenize("@::")) |
|
78 | >>> list(tokenize("@::")) | |
79 | [('symbol', '@', 0), ('::', None, 1), ('end', None, 3)] |
|
79 | [('symbol', '@', 0), ('::', None, 1), ('end', None, 3)] | |
80 |
|
80 | |||
81 | ''' |
|
81 | ''' | |
82 | program = pycompat.bytestr(program) |
|
82 | program = pycompat.bytestr(program) | |
83 | if syminitletters is None: |
|
83 | if syminitletters is None: | |
84 | syminitletters = _syminitletters |
|
84 | syminitletters = _syminitletters | |
85 | if symletters is None: |
|
85 | if symletters is None: | |
86 | symletters = _symletters |
|
86 | symletters = _symletters | |
87 |
|
87 | |||
88 | if program and lookup: |
|
88 | if program and lookup: | |
89 | # attempt to parse old-style ranges first to deal with |
|
89 | # attempt to parse old-style ranges first to deal with | |
90 | # things like old-tag which contain query metacharacters |
|
90 | # things like old-tag which contain query metacharacters | |
91 | parts = program.split(':', 1) |
|
91 | parts = program.split(':', 1) | |
92 | if all(lookup(sym) for sym in parts if sym): |
|
92 | if all(lookup(sym) for sym in parts if sym): | |
93 | if parts[0]: |
|
93 | if parts[0]: | |
94 | yield ('symbol', parts[0], 0) |
|
94 | yield ('symbol', parts[0], 0) | |
95 | if len(parts) > 1: |
|
95 | if len(parts) > 1: | |
96 | s = len(parts[0]) |
|
96 | s = len(parts[0]) | |
97 | yield (':', None, s) |
|
97 | yield (':', None, s) | |
98 | if parts[1]: |
|
98 | if parts[1]: | |
99 | yield ('symbol', parts[1], s + 1) |
|
99 | yield ('symbol', parts[1], s + 1) | |
100 | yield ('end', None, len(program)) |
|
100 | yield ('end', None, len(program)) | |
101 | return |
|
101 | return | |
102 |
|
102 | |||
103 | pos, l = 0, len(program) |
|
103 | pos, l = 0, len(program) | |
104 | while pos < l: |
|
104 | while pos < l: | |
105 | c = program[pos] |
|
105 | c = program[pos] | |
106 | if c.isspace(): # skip inter-token whitespace |
|
106 | if c.isspace(): # skip inter-token whitespace | |
107 | pass |
|
107 | pass | |
108 | elif c == ':' and program[pos:pos + 2] == '::': # look ahead carefully |
|
108 | elif c == ':' and program[pos:pos + 2] == '::': # look ahead carefully | |
109 | yield ('::', None, pos) |
|
109 | yield ('::', None, pos) | |
110 | pos += 1 # skip ahead |
|
110 | pos += 1 # skip ahead | |
111 | elif c == '.' and program[pos:pos + 2] == '..': # look ahead carefully |
|
111 | elif c == '.' and program[pos:pos + 2] == '..': # look ahead carefully | |
112 | yield ('..', None, pos) |
|
112 | yield ('..', None, pos) | |
113 | pos += 1 # skip ahead |
|
113 | pos += 1 # skip ahead | |
114 | elif c == '#' and program[pos:pos + 2] == '##': # look ahead carefully |
|
114 | elif c == '#' and program[pos:pos + 2] == '##': # look ahead carefully | |
115 | yield ('##', None, pos) |
|
115 | yield ('##', None, pos) | |
116 | pos += 1 # skip ahead |
|
116 | pos += 1 # skip ahead | |
117 | elif c in _simpleopletters: # handle simple operators |
|
117 | elif c in _simpleopletters: # handle simple operators | |
118 | yield (c, None, pos) |
|
118 | yield (c, None, pos) | |
119 | elif (c in _quoteletters or c == 'r' and |
|
119 | elif (c in _quoteletters or c == 'r' and | |
120 | program[pos:pos + 2] in ("r'", 'r"')): # handle quoted strings |
|
120 | program[pos:pos + 2] in ("r'", 'r"')): # handle quoted strings | |
121 | if c == 'r': |
|
121 | if c == 'r': | |
122 | pos += 1 |
|
122 | pos += 1 | |
123 | c = program[pos] |
|
123 | c = program[pos] | |
124 | decode = lambda x: x |
|
124 | decode = lambda x: x | |
125 | else: |
|
125 | else: | |
126 | decode = parser.unescapestr |
|
126 | decode = parser.unescapestr | |
127 | pos += 1 |
|
127 | pos += 1 | |
128 | s = pos |
|
128 | s = pos | |
129 | while pos < l: # find closing quote |
|
129 | while pos < l: # find closing quote | |
130 | d = program[pos] |
|
130 | d = program[pos] | |
131 | if d == '\\': # skip over escaped characters |
|
131 | if d == '\\': # skip over escaped characters | |
132 | pos += 2 |
|
132 | pos += 2 | |
133 | continue |
|
133 | continue | |
134 | if d == c: |
|
134 | if d == c: | |
135 | yield ('string', decode(program[s:pos]), s) |
|
135 | yield ('string', decode(program[s:pos]), s) | |
136 | break |
|
136 | break | |
137 | pos += 1 |
|
137 | pos += 1 | |
138 | else: |
|
138 | else: | |
139 | raise error.ParseError(_("unterminated string"), s) |
|
139 | raise error.ParseError(_("unterminated string"), s) | |
140 | # gather up a symbol/keyword |
|
140 | # gather up a symbol/keyword | |
141 | elif c in syminitletters: |
|
141 | elif c in syminitletters: | |
142 | s = pos |
|
142 | s = pos | |
143 | pos += 1 |
|
143 | pos += 1 | |
144 | while pos < l: # find end of symbol |
|
144 | while pos < l: # find end of symbol | |
145 | d = program[pos] |
|
145 | d = program[pos] | |
146 | if d not in symletters: |
|
146 | if d not in symletters: | |
147 | break |
|
147 | break | |
148 | if d == '.' and program[pos - 1] == '.': # special case for .. |
|
148 | if d == '.' and program[pos - 1] == '.': # special case for .. | |
149 | pos -= 1 |
|
149 | pos -= 1 | |
150 | break |
|
150 | break | |
151 | pos += 1 |
|
151 | pos += 1 | |
152 | sym = program[s:pos] |
|
152 | sym = program[s:pos] | |
153 | if sym in keywords: # operator keywords |
|
153 | if sym in keywords: # operator keywords | |
154 | yield (sym, None, s) |
|
154 | yield (sym, None, s) | |
155 | elif '-' in sym: |
|
155 | elif '-' in sym: | |
156 | # some jerk gave us foo-bar-baz, try to check if it's a symbol |
|
156 | # some jerk gave us foo-bar-baz, try to check if it's a symbol | |
157 | if lookup and lookup(sym): |
|
157 | if lookup and lookup(sym): | |
158 | # looks like a real symbol |
|
158 | # looks like a real symbol | |
159 | yield ('symbol', sym, s) |
|
159 | yield ('symbol', sym, s) | |
160 | else: |
|
160 | else: | |
161 | # looks like an expression |
|
161 | # looks like an expression | |
162 | parts = sym.split('-') |
|
162 | parts = sym.split('-') | |
163 | for p in parts[:-1]: |
|
163 | for p in parts[:-1]: | |
164 | if p: # possible consecutive - |
|
164 | if p: # possible consecutive - | |
165 | yield ('symbol', p, s) |
|
165 | yield ('symbol', p, s) | |
166 | s += len(p) |
|
166 | s += len(p) | |
167 | yield ('-', None, pos) |
|
167 | yield ('-', None, pos) | |
168 | s += 1 |
|
168 | s += 1 | |
169 | if parts[-1]: # possible trailing - |
|
169 | if parts[-1]: # possible trailing - | |
170 | yield ('symbol', parts[-1], s) |
|
170 | yield ('symbol', parts[-1], s) | |
171 | else: |
|
171 | else: | |
172 | yield ('symbol', sym, s) |
|
172 | yield ('symbol', sym, s) | |
173 | pos -= 1 |
|
173 | pos -= 1 | |
174 | else: |
|
174 | else: | |
175 | raise error.ParseError(_("syntax error in revset '%s'") % |
|
175 | raise error.ParseError(_("syntax error in revset '%s'") % | |
176 | program, pos) |
|
176 | program, pos) | |
177 | pos += 1 |
|
177 | pos += 1 | |
178 | yield ('end', None, pos) |
|
178 | yield ('end', None, pos) | |
179 |
|
179 | |||
180 | # helpers |
|
180 | # helpers | |
181 |
|
181 | |||
182 | _notset = object() |
|
182 | _notset = object() | |
183 |
|
183 | |||
184 | def getsymbol(x): |
|
184 | def getsymbol(x): | |
185 | if x and x[0] == 'symbol': |
|
185 | if x and x[0] == 'symbol': | |
186 | return x[1] |
|
186 | return x[1] | |
187 | raise error.ParseError(_('not a symbol')) |
|
187 | raise error.ParseError(_('not a symbol')) | |
188 |
|
188 | |||
189 | def getstring(x, err): |
|
189 | def getstring(x, err): | |
190 | if x and (x[0] == 'string' or x[0] == 'symbol'): |
|
190 | if x and (x[0] == 'string' or x[0] == 'symbol'): | |
191 | return x[1] |
|
191 | return x[1] | |
192 | raise error.ParseError(err) |
|
192 | raise error.ParseError(err) | |
193 |
|
193 | |||
194 | def getinteger(x, err, default=_notset): |
|
194 | def getinteger(x, err, default=_notset): | |
195 | if not x and default is not _notset: |
|
195 | if not x and default is not _notset: | |
196 | return default |
|
196 | return default | |
197 | try: |
|
197 | try: | |
198 | return int(getstring(x, err)) |
|
198 | return int(getstring(x, err)) | |
199 | except ValueError: |
|
199 | except ValueError: | |
200 | raise error.ParseError(err) |
|
200 | raise error.ParseError(err) | |
201 |
|
201 | |||
202 | def getboolean(x, err): |
|
202 | def getboolean(x, err): | |
203 | value = util.parsebool(getsymbol(x)) |
|
203 | value = util.parsebool(getsymbol(x)) | |
204 | if value is not None: |
|
204 | if value is not None: | |
205 | return value |
|
205 | return value | |
206 | raise error.ParseError(err) |
|
206 | raise error.ParseError(err) | |
207 |
|
207 | |||
208 | def getlist(x): |
|
208 | def getlist(x): | |
209 | if not x: |
|
209 | if not x: | |
210 | return [] |
|
210 | return [] | |
211 | if x[0] == 'list': |
|
211 | if x[0] == 'list': | |
212 | return list(x[1:]) |
|
212 | return list(x[1:]) | |
213 | return [x] |
|
213 | return [x] | |
214 |
|
214 | |||
215 | def getrange(x, err): |
|
215 | def getrange(x, err): | |
216 | if not x: |
|
216 | if not x: | |
217 | raise error.ParseError(err) |
|
217 | raise error.ParseError(err) | |
218 | op = x[0] |
|
218 | op = x[0] | |
219 | if op == 'range': |
|
219 | if op == 'range': | |
220 | return x[1], x[2] |
|
220 | return x[1], x[2] | |
221 | elif op == 'rangepre': |
|
221 | elif op == 'rangepre': | |
222 | return None, x[1] |
|
222 | return None, x[1] | |
223 | elif op == 'rangepost': |
|
223 | elif op == 'rangepost': | |
224 | return x[1], None |
|
224 | return x[1], None | |
225 | elif op == 'rangeall': |
|
225 | elif op == 'rangeall': | |
226 | return None, None |
|
226 | return None, None | |
227 | raise error.ParseError(err) |
|
227 | raise error.ParseError(err) | |
228 |
|
228 | |||
229 | def getargs(x, min, max, err): |
|
229 | def getargs(x, min, max, err): | |
230 | l = getlist(x) |
|
230 | l = getlist(x) | |
231 | if len(l) < min or (max >= 0 and len(l) > max): |
|
231 | if len(l) < min or (max >= 0 and len(l) > max): | |
232 | raise error.ParseError(err) |
|
232 | raise error.ParseError(err) | |
233 | return l |
|
233 | return l | |
234 |
|
234 | |||
235 | def getargsdict(x, funcname, keys): |
|
235 | def getargsdict(x, funcname, keys): | |
236 | return parser.buildargsdict(getlist(x), funcname, parser.splitargspec(keys), |
|
236 | return parser.buildargsdict(getlist(x), funcname, parser.splitargspec(keys), | |
237 | keyvaluenode='keyvalue', keynode='symbol') |
|
237 | keyvaluenode='keyvalue', keynode='symbol') | |
238 |
|
238 | |||
239 | def _isnamedfunc(x, funcname): |
|
239 | def _isnamedfunc(x, funcname): | |
240 | """Check if given tree matches named function""" |
|
240 | """Check if given tree matches named function""" | |
241 | return x and x[0] == 'func' and getsymbol(x[1]) == funcname |
|
241 | return x and x[0] == 'func' and getsymbol(x[1]) == funcname | |
242 |
|
242 | |||
|
243 | def _isposargs(x, n): | |||
|
244 | """Check if given tree is n-length list of positional arguments""" | |||
|
245 | l = getlist(x) | |||
|
246 | return len(l) == n and all(y and y[0] != 'keyvalue' for y in l) | |||
|
247 | ||||
243 | def _matchnamedfunc(x, funcname): |
|
248 | def _matchnamedfunc(x, funcname): | |
244 | """Return args tree if given tree matches named function; otherwise None |
|
249 | """Return args tree if given tree matches named function; otherwise None | |
245 |
|
250 | |||
246 | This can't be used for testing a nullary function since its args tree |
|
251 | This can't be used for testing a nullary function since its args tree | |
247 | is also None. Use _isnamedfunc() instead. |
|
252 | is also None. Use _isnamedfunc() instead. | |
248 | """ |
|
253 | """ | |
249 | if not _isnamedfunc(x, funcname): |
|
254 | if not _isnamedfunc(x, funcname): | |
250 | return |
|
255 | return | |
251 | return x[2] |
|
256 | return x[2] | |
252 |
|
257 | |||
253 | # Constants for ordering requirement, used in _analyze(): |
|
258 | # Constants for ordering requirement, used in _analyze(): | |
254 | # |
|
259 | # | |
255 | # If 'define', any nested functions and operations can change the ordering of |
|
260 | # If 'define', any nested functions and operations can change the ordering of | |
256 | # the entries in the set. If 'follow', any nested functions and operations |
|
261 | # the entries in the set. If 'follow', any nested functions and operations | |
257 | # should take the ordering specified by the first operand to the '&' operator. |
|
262 | # should take the ordering specified by the first operand to the '&' operator. | |
258 | # |
|
263 | # | |
259 | # For instance, |
|
264 | # For instance, | |
260 | # |
|
265 | # | |
261 | # X & (Y | Z) |
|
266 | # X & (Y | Z) | |
262 | # ^ ^^^^^^^ |
|
267 | # ^ ^^^^^^^ | |
263 | # | follow |
|
268 | # | follow | |
264 | # define |
|
269 | # define | |
265 | # |
|
270 | # | |
266 | # will be evaluated as 'or(y(x()), z(x()))', where 'x()' can change the order |
|
271 | # will be evaluated as 'or(y(x()), z(x()))', where 'x()' can change the order | |
267 | # of the entries in the set, but 'y()', 'z()' and 'or()' shouldn't. |
|
272 | # of the entries in the set, but 'y()', 'z()' and 'or()' shouldn't. | |
268 | # |
|
273 | # | |
269 | # 'any' means the order doesn't matter. For instance, |
|
274 | # 'any' means the order doesn't matter. For instance, | |
270 | # |
|
275 | # | |
271 | # X & !Y |
|
276 | # X & !Y | |
272 | # ^ |
|
277 | # ^ | |
273 | # any |
|
278 | # any | |
274 | # |
|
279 | # | |
275 | # 'y()' can either enforce its ordering requirement or take the ordering |
|
280 | # 'y()' can either enforce its ordering requirement or take the ordering | |
276 | # specified by 'x()' because 'not()' doesn't care the order. |
|
281 | # specified by 'x()' because 'not()' doesn't care the order. | |
277 | # |
|
282 | # | |
278 | # Transition of ordering requirement: |
|
283 | # Transition of ordering requirement: | |
279 | # |
|
284 | # | |
280 | # 1. starts with 'define' |
|
285 | # 1. starts with 'define' | |
281 | # 2. shifts to 'follow' by 'x & y' |
|
286 | # 2. shifts to 'follow' by 'x & y' | |
282 | # 3. changes back to 'define' on function call 'f(x)' or function-like |
|
287 | # 3. changes back to 'define' on function call 'f(x)' or function-like | |
283 | # operation 'x (f) y' because 'f' may have its own ordering requirement |
|
288 | # operation 'x (f) y' because 'f' may have its own ordering requirement | |
284 | # for 'x' and 'y' (e.g. 'first(x)') |
|
289 | # for 'x' and 'y' (e.g. 'first(x)') | |
285 | # |
|
290 | # | |
286 | anyorder = 'any' # don't care the order |
|
291 | anyorder = 'any' # don't care the order | |
287 | defineorder = 'define' # should define the order |
|
292 | defineorder = 'define' # should define the order | |
288 | followorder = 'follow' # must follow the current order |
|
293 | followorder = 'follow' # must follow the current order | |
289 |
|
294 | |||
290 | # transition table for 'x & y', from the current expression 'x' to 'y' |
|
295 | # transition table for 'x & y', from the current expression 'x' to 'y' | |
291 | _tofolloworder = { |
|
296 | _tofolloworder = { | |
292 | anyorder: anyorder, |
|
297 | anyorder: anyorder, | |
293 | defineorder: followorder, |
|
298 | defineorder: followorder, | |
294 | followorder: followorder, |
|
299 | followorder: followorder, | |
295 | } |
|
300 | } | |
296 |
|
301 | |||
297 | def _matchonly(revs, bases): |
|
302 | def _matchonly(revs, bases): | |
298 | """ |
|
303 | """ | |
299 | >>> f = lambda *args: _matchonly(*map(parse, args)) |
|
304 | >>> f = lambda *args: _matchonly(*map(parse, args)) | |
300 | >>> f('ancestors(A)', 'not ancestors(B)') |
|
305 | >>> f('ancestors(A)', 'not ancestors(B)') | |
301 | ('list', ('symbol', 'A'), ('symbol', 'B')) |
|
306 | ('list', ('symbol', 'A'), ('symbol', 'B')) | |
302 | """ |
|
307 | """ | |
303 | ta = _matchnamedfunc(revs, 'ancestors') |
|
308 | ta = _matchnamedfunc(revs, 'ancestors') | |
304 | tb = bases and bases[0] == 'not' and _matchnamedfunc(bases[1], 'ancestors') |
|
309 | tb = bases and bases[0] == 'not' and _matchnamedfunc(bases[1], 'ancestors') | |
305 | if ta and tb: |
|
310 | if _isposargs(ta, 1) and _isposargs(tb, 1): | |
306 | return ('list', ta, tb) |
|
311 | return ('list', ta, tb) | |
307 |
|
312 | |||
308 | def _fixops(x): |
|
313 | def _fixops(x): | |
309 | """Rewrite raw parsed tree to resolve ambiguous syntax which cannot be |
|
314 | """Rewrite raw parsed tree to resolve ambiguous syntax which cannot be | |
310 | handled well by our simple top-down parser""" |
|
315 | handled well by our simple top-down parser""" | |
311 | if not isinstance(x, tuple): |
|
316 | if not isinstance(x, tuple): | |
312 | return x |
|
317 | return x | |
313 |
|
318 | |||
314 | op = x[0] |
|
319 | op = x[0] | |
315 | if op == 'parent': |
|
320 | if op == 'parent': | |
316 | # x^:y means (x^) : y, not x ^ (:y) |
|
321 | # x^:y means (x^) : y, not x ^ (:y) | |
317 | # x^: means (x^) :, not x ^ (:) |
|
322 | # x^: means (x^) :, not x ^ (:) | |
318 | post = ('parentpost', x[1]) |
|
323 | post = ('parentpost', x[1]) | |
319 | if x[2][0] == 'dagrangepre': |
|
324 | if x[2][0] == 'dagrangepre': | |
320 | return _fixops(('dagrange', post, x[2][1])) |
|
325 | return _fixops(('dagrange', post, x[2][1])) | |
321 | elif x[2][0] == 'rangepre': |
|
326 | elif x[2][0] == 'rangepre': | |
322 | return _fixops(('range', post, x[2][1])) |
|
327 | return _fixops(('range', post, x[2][1])) | |
323 | elif x[2][0] == 'rangeall': |
|
328 | elif x[2][0] == 'rangeall': | |
324 | return _fixops(('rangepost', post)) |
|
329 | return _fixops(('rangepost', post)) | |
325 | elif op == 'or': |
|
330 | elif op == 'or': | |
326 | # make number of arguments deterministic: |
|
331 | # make number of arguments deterministic: | |
327 | # x + y + z -> (or x y z) -> (or (list x y z)) |
|
332 | # x + y + z -> (or x y z) -> (or (list x y z)) | |
328 | return (op, _fixops(('list',) + x[1:])) |
|
333 | return (op, _fixops(('list',) + x[1:])) | |
329 |
|
334 | |||
330 | return (op,) + tuple(_fixops(y) for y in x[1:]) |
|
335 | return (op,) + tuple(_fixops(y) for y in x[1:]) | |
331 |
|
336 | |||
332 | def _analyze(x, order): |
|
337 | def _analyze(x, order): | |
333 | if x is None: |
|
338 | if x is None: | |
334 | return x |
|
339 | return x | |
335 |
|
340 | |||
336 | op = x[0] |
|
341 | op = x[0] | |
337 | if op == 'minus': |
|
342 | if op == 'minus': | |
338 | return _analyze(('and', x[1], ('not', x[2])), order) |
|
343 | return _analyze(('and', x[1], ('not', x[2])), order) | |
339 | elif op == 'only': |
|
344 | elif op == 'only': | |
340 | t = ('func', ('symbol', 'only'), ('list', x[1], x[2])) |
|
345 | t = ('func', ('symbol', 'only'), ('list', x[1], x[2])) | |
341 | return _analyze(t, order) |
|
346 | return _analyze(t, order) | |
342 | elif op == 'onlypost': |
|
347 | elif op == 'onlypost': | |
343 | return _analyze(('func', ('symbol', 'only'), x[1]), order) |
|
348 | return _analyze(('func', ('symbol', 'only'), x[1]), order) | |
344 | elif op == 'dagrangepre': |
|
349 | elif op == 'dagrangepre': | |
345 | return _analyze(('func', ('symbol', 'ancestors'), x[1]), order) |
|
350 | return _analyze(('func', ('symbol', 'ancestors'), x[1]), order) | |
346 | elif op == 'dagrangepost': |
|
351 | elif op == 'dagrangepost': | |
347 | return _analyze(('func', ('symbol', 'descendants'), x[1]), order) |
|
352 | return _analyze(('func', ('symbol', 'descendants'), x[1]), order) | |
348 | elif op == 'negate': |
|
353 | elif op == 'negate': | |
349 | s = getstring(x[1], _("can't negate that")) |
|
354 | s = getstring(x[1], _("can't negate that")) | |
350 | return _analyze(('string', '-' + s), order) |
|
355 | return _analyze(('string', '-' + s), order) | |
351 | elif op in ('string', 'symbol'): |
|
356 | elif op in ('string', 'symbol'): | |
352 | return x |
|
357 | return x | |
353 | elif op == 'and': |
|
358 | elif op == 'and': | |
354 | ta = _analyze(x[1], order) |
|
359 | ta = _analyze(x[1], order) | |
355 | tb = _analyze(x[2], _tofolloworder[order]) |
|
360 | tb = _analyze(x[2], _tofolloworder[order]) | |
356 | return (op, ta, tb, order) |
|
361 | return (op, ta, tb, order) | |
357 | elif op == 'or': |
|
362 | elif op == 'or': | |
358 | return (op, _analyze(x[1], order), order) |
|
363 | return (op, _analyze(x[1], order), order) | |
359 | elif op == 'not': |
|
364 | elif op == 'not': | |
360 | return (op, _analyze(x[1], anyorder), order) |
|
365 | return (op, _analyze(x[1], anyorder), order) | |
361 | elif op == 'rangeall': |
|
366 | elif op == 'rangeall': | |
362 | return (op, None, order) |
|
367 | return (op, None, order) | |
363 | elif op in ('rangepre', 'rangepost', 'parentpost'): |
|
368 | elif op in ('rangepre', 'rangepost', 'parentpost'): | |
364 | return (op, _analyze(x[1], defineorder), order) |
|
369 | return (op, _analyze(x[1], defineorder), order) | |
365 | elif op == 'group': |
|
370 | elif op == 'group': | |
366 | return _analyze(x[1], order) |
|
371 | return _analyze(x[1], order) | |
367 | elif op in ('dagrange', 'range', 'parent', 'ancestor'): |
|
372 | elif op in ('dagrange', 'range', 'parent', 'ancestor'): | |
368 | ta = _analyze(x[1], defineorder) |
|
373 | ta = _analyze(x[1], defineorder) | |
369 | tb = _analyze(x[2], defineorder) |
|
374 | tb = _analyze(x[2], defineorder) | |
370 | return (op, ta, tb, order) |
|
375 | return (op, ta, tb, order) | |
371 | elif op == 'list': |
|
376 | elif op == 'list': | |
372 | return (op,) + tuple(_analyze(y, order) for y in x[1:]) |
|
377 | return (op,) + tuple(_analyze(y, order) for y in x[1:]) | |
373 | elif op == 'keyvalue': |
|
378 | elif op == 'keyvalue': | |
374 | return (op, x[1], _analyze(x[2], order)) |
|
379 | return (op, x[1], _analyze(x[2], order)) | |
375 | elif op == 'func': |
|
380 | elif op == 'func': | |
376 | f = getsymbol(x[1]) |
|
381 | f = getsymbol(x[1]) | |
377 | d = defineorder |
|
382 | d = defineorder | |
378 | if f == 'present': |
|
383 | if f == 'present': | |
379 | # 'present(set)' is known to return the argument set with no |
|
384 | # 'present(set)' is known to return the argument set with no | |
380 | # modification, so forward the current order to its argument |
|
385 | # modification, so forward the current order to its argument | |
381 | d = order |
|
386 | d = order | |
382 | return (op, x[1], _analyze(x[2], d), order) |
|
387 | return (op, x[1], _analyze(x[2], d), order) | |
383 | raise ValueError('invalid operator %r' % op) |
|
388 | raise ValueError('invalid operator %r' % op) | |
384 |
|
389 | |||
385 | def analyze(x, order=defineorder): |
|
390 | def analyze(x, order=defineorder): | |
386 | """Transform raw parsed tree to evaluatable tree which can be fed to |
|
391 | """Transform raw parsed tree to evaluatable tree which can be fed to | |
387 | optimize() or getset() |
|
392 | optimize() or getset() | |
388 |
|
393 | |||
389 | All pseudo operations should be mapped to real operations or functions |
|
394 | All pseudo operations should be mapped to real operations or functions | |
390 | defined in methods or symbols table respectively. |
|
395 | defined in methods or symbols table respectively. | |
391 |
|
396 | |||
392 | 'order' specifies how the current expression 'x' is ordered (see the |
|
397 | 'order' specifies how the current expression 'x' is ordered (see the | |
393 | constants defined above.) |
|
398 | constants defined above.) | |
394 | """ |
|
399 | """ | |
395 | return _analyze(x, order) |
|
400 | return _analyze(x, order) | |
396 |
|
401 | |||
397 | def _optimize(x, small): |
|
402 | def _optimize(x, small): | |
398 | if x is None: |
|
403 | if x is None: | |
399 | return 0, x |
|
404 | return 0, x | |
400 |
|
405 | |||
401 | smallbonus = 1 |
|
406 | smallbonus = 1 | |
402 | if small: |
|
407 | if small: | |
403 | smallbonus = .5 |
|
408 | smallbonus = .5 | |
404 |
|
409 | |||
405 | op = x[0] |
|
410 | op = x[0] | |
406 | if op in ('string', 'symbol'): |
|
411 | if op in ('string', 'symbol'): | |
407 | return smallbonus, x # single revisions are small |
|
412 | return smallbonus, x # single revisions are small | |
408 | elif op == 'and': |
|
413 | elif op == 'and': | |
409 | wa, ta = _optimize(x[1], True) |
|
414 | wa, ta = _optimize(x[1], True) | |
410 | wb, tb = _optimize(x[2], True) |
|
415 | wb, tb = _optimize(x[2], True) | |
411 | order = x[3] |
|
416 | order = x[3] | |
412 | w = min(wa, wb) |
|
417 | w = min(wa, wb) | |
413 |
|
418 | |||
414 | # (::x and not ::y)/(not ::y and ::x) have a fast path |
|
419 | # (::x and not ::y)/(not ::y and ::x) have a fast path | |
415 | tm = _matchonly(ta, tb) or _matchonly(tb, ta) |
|
420 | tm = _matchonly(ta, tb) or _matchonly(tb, ta) | |
416 | if tm: |
|
421 | if tm: | |
417 | return w, ('func', ('symbol', 'only'), tm, order) |
|
422 | return w, ('func', ('symbol', 'only'), tm, order) | |
418 |
|
423 | |||
419 | if tb is not None and tb[0] == 'not': |
|
424 | if tb is not None and tb[0] == 'not': | |
420 | return wa, ('difference', ta, tb[1], order) |
|
425 | return wa, ('difference', ta, tb[1], order) | |
421 |
|
426 | |||
422 | if wa > wb: |
|
427 | if wa > wb: | |
423 | return w, (op, tb, ta, order) |
|
428 | return w, (op, tb, ta, order) | |
424 | return w, (op, ta, tb, order) |
|
429 | return w, (op, ta, tb, order) | |
425 | elif op == 'or': |
|
430 | elif op == 'or': | |
426 | # fast path for machine-generated expression, that is likely to have |
|
431 | # fast path for machine-generated expression, that is likely to have | |
427 | # lots of trivial revisions: 'a + b + c()' to '_list(a b) + c()' |
|
432 | # lots of trivial revisions: 'a + b + c()' to '_list(a b) + c()' | |
428 | order = x[2] |
|
433 | order = x[2] | |
429 | ws, ts, ss = [], [], [] |
|
434 | ws, ts, ss = [], [], [] | |
430 | def flushss(): |
|
435 | def flushss(): | |
431 | if not ss: |
|
436 | if not ss: | |
432 | return |
|
437 | return | |
433 | if len(ss) == 1: |
|
438 | if len(ss) == 1: | |
434 | w, t = ss[0] |
|
439 | w, t = ss[0] | |
435 | else: |
|
440 | else: | |
436 | s = '\0'.join(t[1] for w, t in ss) |
|
441 | s = '\0'.join(t[1] for w, t in ss) | |
437 | y = ('func', ('symbol', '_list'), ('string', s), order) |
|
442 | y = ('func', ('symbol', '_list'), ('string', s), order) | |
438 | w, t = _optimize(y, False) |
|
443 | w, t = _optimize(y, False) | |
439 | ws.append(w) |
|
444 | ws.append(w) | |
440 | ts.append(t) |
|
445 | ts.append(t) | |
441 | del ss[:] |
|
446 | del ss[:] | |
442 | for y in getlist(x[1]): |
|
447 | for y in getlist(x[1]): | |
443 | w, t = _optimize(y, False) |
|
448 | w, t = _optimize(y, False) | |
444 | if t is not None and (t[0] == 'string' or t[0] == 'symbol'): |
|
449 | if t is not None and (t[0] == 'string' or t[0] == 'symbol'): | |
445 | ss.append((w, t)) |
|
450 | ss.append((w, t)) | |
446 | continue |
|
451 | continue | |
447 | flushss() |
|
452 | flushss() | |
448 | ws.append(w) |
|
453 | ws.append(w) | |
449 | ts.append(t) |
|
454 | ts.append(t) | |
450 | flushss() |
|
455 | flushss() | |
451 | if len(ts) == 1: |
|
456 | if len(ts) == 1: | |
452 | return ws[0], ts[0] # 'or' operation is fully optimized out |
|
457 | return ws[0], ts[0] # 'or' operation is fully optimized out | |
453 | if order != defineorder: |
|
458 | if order != defineorder: | |
454 | # reorder by weight only when f(a + b) == f(b + a) |
|
459 | # reorder by weight only when f(a + b) == f(b + a) | |
455 | ts = [wt[1] for wt in sorted(zip(ws, ts), key=lambda wt: wt[0])] |
|
460 | ts = [wt[1] for wt in sorted(zip(ws, ts), key=lambda wt: wt[0])] | |
456 | return max(ws), (op, ('list',) + tuple(ts), order) |
|
461 | return max(ws), (op, ('list',) + tuple(ts), order) | |
457 | elif op == 'not': |
|
462 | elif op == 'not': | |
458 | # Optimize not public() to _notpublic() because we have a fast version |
|
463 | # Optimize not public() to _notpublic() because we have a fast version | |
459 | if x[1][:3] == ('func', ('symbol', 'public'), None): |
|
464 | if x[1][:3] == ('func', ('symbol', 'public'), None): | |
460 | order = x[1][3] |
|
465 | order = x[1][3] | |
461 | newsym = ('func', ('symbol', '_notpublic'), None, order) |
|
466 | newsym = ('func', ('symbol', '_notpublic'), None, order) | |
462 | o = _optimize(newsym, not small) |
|
467 | o = _optimize(newsym, not small) | |
463 | return o[0], o[1] |
|
468 | return o[0], o[1] | |
464 | else: |
|
469 | else: | |
465 | o = _optimize(x[1], not small) |
|
470 | o = _optimize(x[1], not small) | |
466 | order = x[2] |
|
471 | order = x[2] | |
467 | return o[0], (op, o[1], order) |
|
472 | return o[0], (op, o[1], order) | |
468 | elif op == 'rangeall': |
|
473 | elif op == 'rangeall': | |
469 | return smallbonus, x |
|
474 | return smallbonus, x | |
470 | elif op in ('rangepre', 'rangepost', 'parentpost'): |
|
475 | elif op in ('rangepre', 'rangepost', 'parentpost'): | |
471 | o = _optimize(x[1], small) |
|
476 | o = _optimize(x[1], small) | |
472 | order = x[2] |
|
477 | order = x[2] | |
473 | return o[0], (op, o[1], order) |
|
478 | return o[0], (op, o[1], order) | |
474 | elif op in ('dagrange', 'range', 'parent', 'ancestor'): |
|
479 | elif op in ('dagrange', 'range', 'parent', 'ancestor'): | |
475 | wa, ta = _optimize(x[1], small) |
|
480 | wa, ta = _optimize(x[1], small) | |
476 | wb, tb = _optimize(x[2], small) |
|
481 | wb, tb = _optimize(x[2], small) | |
477 | order = x[3] |
|
482 | order = x[3] | |
478 | return wa + wb, (op, ta, tb, order) |
|
483 | return wa + wb, (op, ta, tb, order) | |
479 | elif op == 'list': |
|
484 | elif op == 'list': | |
480 | ws, ts = zip(*(_optimize(y, small) for y in x[1:])) |
|
485 | ws, ts = zip(*(_optimize(y, small) for y in x[1:])) | |
481 | return sum(ws), (op,) + ts |
|
486 | return sum(ws), (op,) + ts | |
482 | elif op == 'keyvalue': |
|
487 | elif op == 'keyvalue': | |
483 | w, t = _optimize(x[2], small) |
|
488 | w, t = _optimize(x[2], small) | |
484 | return w, (op, x[1], t) |
|
489 | return w, (op, x[1], t) | |
485 | elif op == 'func': |
|
490 | elif op == 'func': | |
486 | f = getsymbol(x[1]) |
|
491 | f = getsymbol(x[1]) | |
487 | wa, ta = _optimize(x[2], small) |
|
492 | wa, ta = _optimize(x[2], small) | |
488 | if f in ('author', 'branch', 'closed', 'date', 'desc', 'file', 'grep', |
|
493 | if f in ('author', 'branch', 'closed', 'date', 'desc', 'file', 'grep', | |
489 | 'keyword', 'outgoing', 'user', 'destination'): |
|
494 | 'keyword', 'outgoing', 'user', 'destination'): | |
490 | w = 10 # slow |
|
495 | w = 10 # slow | |
491 | elif f in ('modifies', 'adds', 'removes'): |
|
496 | elif f in ('modifies', 'adds', 'removes'): | |
492 | w = 30 # slower |
|
497 | w = 30 # slower | |
493 | elif f == "contains": |
|
498 | elif f == "contains": | |
494 | w = 100 # very slow |
|
499 | w = 100 # very slow | |
495 | elif f == "ancestor": |
|
500 | elif f == "ancestor": | |
496 | w = 1 * smallbonus |
|
501 | w = 1 * smallbonus | |
497 | elif f in ('reverse', 'limit', 'first', 'wdir', '_intlist'): |
|
502 | elif f in ('reverse', 'limit', 'first', 'wdir', '_intlist'): | |
498 | w = 0 |
|
503 | w = 0 | |
499 | elif f == "sort": |
|
504 | elif f == "sort": | |
500 | w = 10 # assume most sorts look at changelog |
|
505 | w = 10 # assume most sorts look at changelog | |
501 | else: |
|
506 | else: | |
502 | w = 1 |
|
507 | w = 1 | |
503 | order = x[3] |
|
508 | order = x[3] | |
504 | return w + wa, (op, x[1], ta, order) |
|
509 | return w + wa, (op, x[1], ta, order) | |
505 | raise ValueError('invalid operator %r' % op) |
|
510 | raise ValueError('invalid operator %r' % op) | |
506 |
|
511 | |||
507 | def optimize(tree): |
|
512 | def optimize(tree): | |
508 | """Optimize evaluatable tree |
|
513 | """Optimize evaluatable tree | |
509 |
|
514 | |||
510 | All pseudo operations should be transformed beforehand. |
|
515 | All pseudo operations should be transformed beforehand. | |
511 | """ |
|
516 | """ | |
512 | _weight, newtree = _optimize(tree, small=True) |
|
517 | _weight, newtree = _optimize(tree, small=True) | |
513 | return newtree |
|
518 | return newtree | |
514 |
|
519 | |||
515 | # the set of valid characters for the initial letter of symbols in |
|
520 | # the set of valid characters for the initial letter of symbols in | |
516 | # alias declarations and definitions |
|
521 | # alias declarations and definitions | |
517 | _aliassyminitletters = _syminitletters | set(pycompat.sysstr('$')) |
|
522 | _aliassyminitletters = _syminitletters | set(pycompat.sysstr('$')) | |
518 |
|
523 | |||
519 | def _parsewith(spec, lookup=None, syminitletters=None): |
|
524 | def _parsewith(spec, lookup=None, syminitletters=None): | |
520 | """Generate a parse tree of given spec with given tokenizing options |
|
525 | """Generate a parse tree of given spec with given tokenizing options | |
521 |
|
526 | |||
522 | >>> _parsewith('foo($1)', syminitletters=_aliassyminitletters) |
|
527 | >>> _parsewith('foo($1)', syminitletters=_aliassyminitletters) | |
523 | ('func', ('symbol', 'foo'), ('symbol', '$1')) |
|
528 | ('func', ('symbol', 'foo'), ('symbol', '$1')) | |
524 | >>> _parsewith('$1') |
|
529 | >>> _parsewith('$1') | |
525 | Traceback (most recent call last): |
|
530 | Traceback (most recent call last): | |
526 | ... |
|
531 | ... | |
527 | ParseError: ("syntax error in revset '$1'", 0) |
|
532 | ParseError: ("syntax error in revset '$1'", 0) | |
528 | >>> _parsewith('foo bar') |
|
533 | >>> _parsewith('foo bar') | |
529 | Traceback (most recent call last): |
|
534 | Traceback (most recent call last): | |
530 | ... |
|
535 | ... | |
531 | ParseError: ('invalid token', 4) |
|
536 | ParseError: ('invalid token', 4) | |
532 | """ |
|
537 | """ | |
533 | p = parser.parser(elements) |
|
538 | p = parser.parser(elements) | |
534 | tree, pos = p.parse(tokenize(spec, lookup=lookup, |
|
539 | tree, pos = p.parse(tokenize(spec, lookup=lookup, | |
535 | syminitletters=syminitletters)) |
|
540 | syminitletters=syminitletters)) | |
536 | if pos != len(spec): |
|
541 | if pos != len(spec): | |
537 | raise error.ParseError(_('invalid token'), pos) |
|
542 | raise error.ParseError(_('invalid token'), pos) | |
538 | return _fixops(parser.simplifyinfixops(tree, ('list', 'or'))) |
|
543 | return _fixops(parser.simplifyinfixops(tree, ('list', 'or'))) | |
539 |
|
544 | |||
540 | class _aliasrules(parser.basealiasrules): |
|
545 | class _aliasrules(parser.basealiasrules): | |
541 | """Parsing and expansion rule set of revset aliases""" |
|
546 | """Parsing and expansion rule set of revset aliases""" | |
542 | _section = _('revset alias') |
|
547 | _section = _('revset alias') | |
543 |
|
548 | |||
544 | @staticmethod |
|
549 | @staticmethod | |
545 | def _parse(spec): |
|
550 | def _parse(spec): | |
546 | """Parse alias declaration/definition ``spec`` |
|
551 | """Parse alias declaration/definition ``spec`` | |
547 |
|
552 | |||
548 | This allows symbol names to use also ``$`` as an initial letter |
|
553 | This allows symbol names to use also ``$`` as an initial letter | |
549 | (for backward compatibility), and callers of this function should |
|
554 | (for backward compatibility), and callers of this function should | |
550 | examine whether ``$`` is used also for unexpected symbols or not. |
|
555 | examine whether ``$`` is used also for unexpected symbols or not. | |
551 | """ |
|
556 | """ | |
552 | return _parsewith(spec, syminitletters=_aliassyminitletters) |
|
557 | return _parsewith(spec, syminitletters=_aliassyminitletters) | |
553 |
|
558 | |||
554 | @staticmethod |
|
559 | @staticmethod | |
555 | def _trygetfunc(tree): |
|
560 | def _trygetfunc(tree): | |
556 | if tree[0] == 'func' and tree[1][0] == 'symbol': |
|
561 | if tree[0] == 'func' and tree[1][0] == 'symbol': | |
557 | return tree[1][1], getlist(tree[2]) |
|
562 | return tree[1][1], getlist(tree[2]) | |
558 |
|
563 | |||
559 | def expandaliases(ui, tree): |
|
564 | def expandaliases(ui, tree): | |
560 | aliases = _aliasrules.buildmap(ui.configitems('revsetalias')) |
|
565 | aliases = _aliasrules.buildmap(ui.configitems('revsetalias')) | |
561 | tree = _aliasrules.expand(aliases, tree) |
|
566 | tree = _aliasrules.expand(aliases, tree) | |
562 | # warn about problematic (but not referred) aliases |
|
567 | # warn about problematic (but not referred) aliases | |
563 | for name, alias in sorted(aliases.iteritems()): |
|
568 | for name, alias in sorted(aliases.iteritems()): | |
564 | if alias.error and not alias.warned: |
|
569 | if alias.error and not alias.warned: | |
565 | ui.warn(_('warning: %s\n') % (alias.error)) |
|
570 | ui.warn(_('warning: %s\n') % (alias.error)) | |
566 | alias.warned = True |
|
571 | alias.warned = True | |
567 | return tree |
|
572 | return tree | |
568 |
|
573 | |||
569 | def foldconcat(tree): |
|
574 | def foldconcat(tree): | |
570 | """Fold elements to be concatenated by `##` |
|
575 | """Fold elements to be concatenated by `##` | |
571 | """ |
|
576 | """ | |
572 | if not isinstance(tree, tuple) or tree[0] in ('string', 'symbol'): |
|
577 | if not isinstance(tree, tuple) or tree[0] in ('string', 'symbol'): | |
573 | return tree |
|
578 | return tree | |
574 | if tree[0] == '_concat': |
|
579 | if tree[0] == '_concat': | |
575 | pending = [tree] |
|
580 | pending = [tree] | |
576 | l = [] |
|
581 | l = [] | |
577 | while pending: |
|
582 | while pending: | |
578 | e = pending.pop() |
|
583 | e = pending.pop() | |
579 | if e[0] == '_concat': |
|
584 | if e[0] == '_concat': | |
580 | pending.extend(reversed(e[1:])) |
|
585 | pending.extend(reversed(e[1:])) | |
581 | elif e[0] in ('string', 'symbol'): |
|
586 | elif e[0] in ('string', 'symbol'): | |
582 | l.append(e[1]) |
|
587 | l.append(e[1]) | |
583 | else: |
|
588 | else: | |
584 | msg = _("\"##\" can't concatenate \"%s\" element") % (e[0]) |
|
589 | msg = _("\"##\" can't concatenate \"%s\" element") % (e[0]) | |
585 | raise error.ParseError(msg) |
|
590 | raise error.ParseError(msg) | |
586 | return ('string', ''.join(l)) |
|
591 | return ('string', ''.join(l)) | |
587 | else: |
|
592 | else: | |
588 | return tuple(foldconcat(t) for t in tree) |
|
593 | return tuple(foldconcat(t) for t in tree) | |
589 |
|
594 | |||
590 | def parse(spec, lookup=None): |
|
595 | def parse(spec, lookup=None): | |
591 | return _parsewith(spec, lookup=lookup) |
|
596 | return _parsewith(spec, lookup=lookup) | |
592 |
|
597 | |||
593 | def _quote(s): |
|
598 | def _quote(s): | |
594 | r"""Quote a value in order to make it safe for the revset engine. |
|
599 | r"""Quote a value in order to make it safe for the revset engine. | |
595 |
|
600 | |||
596 | >>> _quote('asdf') |
|
601 | >>> _quote('asdf') | |
597 | "'asdf'" |
|
602 | "'asdf'" | |
598 | >>> _quote("asdf'\"") |
|
603 | >>> _quote("asdf'\"") | |
599 | '\'asdf\\\'"\'' |
|
604 | '\'asdf\\\'"\'' | |
600 | >>> _quote('asdf\'') |
|
605 | >>> _quote('asdf\'') | |
601 | "'asdf\\''" |
|
606 | "'asdf\\''" | |
602 | >>> _quote(1) |
|
607 | >>> _quote(1) | |
603 | "'1'" |
|
608 | "'1'" | |
604 | """ |
|
609 | """ | |
605 | return "'%s'" % util.escapestr(pycompat.bytestr(s)) |
|
610 | return "'%s'" % util.escapestr(pycompat.bytestr(s)) | |
606 |
|
611 | |||
607 | def formatspec(expr, *args): |
|
612 | def formatspec(expr, *args): | |
608 | ''' |
|
613 | ''' | |
609 | This is a convenience function for using revsets internally, and |
|
614 | This is a convenience function for using revsets internally, and | |
610 | escapes arguments appropriately. Aliases are intentionally ignored |
|
615 | escapes arguments appropriately. Aliases are intentionally ignored | |
611 | so that intended expression behavior isn't accidentally subverted. |
|
616 | so that intended expression behavior isn't accidentally subverted. | |
612 |
|
617 | |||
613 | Supported arguments: |
|
618 | Supported arguments: | |
614 |
|
619 | |||
615 | %r = revset expression, parenthesized |
|
620 | %r = revset expression, parenthesized | |
616 | %d = int(arg), no quoting |
|
621 | %d = int(arg), no quoting | |
617 | %s = string(arg), escaped and single-quoted |
|
622 | %s = string(arg), escaped and single-quoted | |
618 | %b = arg.branch(), escaped and single-quoted |
|
623 | %b = arg.branch(), escaped and single-quoted | |
619 | %n = hex(arg), single-quoted |
|
624 | %n = hex(arg), single-quoted | |
620 | %% = a literal '%' |
|
625 | %% = a literal '%' | |
621 |
|
626 | |||
622 | Prefixing the type with 'l' specifies a parenthesized list of that type. |
|
627 | Prefixing the type with 'l' specifies a parenthesized list of that type. | |
623 |
|
628 | |||
624 | >>> formatspec('%r:: and %lr', '10 or 11', ("this()", "that()")) |
|
629 | >>> formatspec('%r:: and %lr', '10 or 11', ("this()", "that()")) | |
625 | '(10 or 11):: and ((this()) or (that()))' |
|
630 | '(10 or 11):: and ((this()) or (that()))' | |
626 | >>> formatspec('%d:: and not %d::', 10, 20) |
|
631 | >>> formatspec('%d:: and not %d::', 10, 20) | |
627 | '10:: and not 20::' |
|
632 | '10:: and not 20::' | |
628 | >>> formatspec('%ld or %ld', [], [1]) |
|
633 | >>> formatspec('%ld or %ld', [], [1]) | |
629 | "_list('') or 1" |
|
634 | "_list('') or 1" | |
630 | >>> formatspec('keyword(%s)', 'foo\\xe9') |
|
635 | >>> formatspec('keyword(%s)', 'foo\\xe9') | |
631 | "keyword('foo\\\\xe9')" |
|
636 | "keyword('foo\\\\xe9')" | |
632 | >>> b = lambda: 'default' |
|
637 | >>> b = lambda: 'default' | |
633 | >>> b.branch = b |
|
638 | >>> b.branch = b | |
634 | >>> formatspec('branch(%b)', b) |
|
639 | >>> formatspec('branch(%b)', b) | |
635 | "branch('default')" |
|
640 | "branch('default')" | |
636 | >>> formatspec('root(%ls)', ['a', 'b', 'c', 'd']) |
|
641 | >>> formatspec('root(%ls)', ['a', 'b', 'c', 'd']) | |
637 | "root(_list('a\\x00b\\x00c\\x00d'))" |
|
642 | "root(_list('a\\x00b\\x00c\\x00d'))" | |
638 | ''' |
|
643 | ''' | |
639 |
|
644 | |||
640 | def argtype(c, arg): |
|
645 | def argtype(c, arg): | |
641 | if c == 'd': |
|
646 | if c == 'd': | |
642 | return '%d' % int(arg) |
|
647 | return '%d' % int(arg) | |
643 | elif c == 's': |
|
648 | elif c == 's': | |
644 | return _quote(arg) |
|
649 | return _quote(arg) | |
645 | elif c == 'r': |
|
650 | elif c == 'r': | |
646 | parse(arg) # make sure syntax errors are confined |
|
651 | parse(arg) # make sure syntax errors are confined | |
647 | return '(%s)' % arg |
|
652 | return '(%s)' % arg | |
648 | elif c == 'n': |
|
653 | elif c == 'n': | |
649 | return _quote(node.hex(arg)) |
|
654 | return _quote(node.hex(arg)) | |
650 | elif c == 'b': |
|
655 | elif c == 'b': | |
651 | return _quote(arg.branch()) |
|
656 | return _quote(arg.branch()) | |
652 |
|
657 | |||
653 | def listexp(s, t): |
|
658 | def listexp(s, t): | |
654 | l = len(s) |
|
659 | l = len(s) | |
655 | if l == 0: |
|
660 | if l == 0: | |
656 | return "_list('')" |
|
661 | return "_list('')" | |
657 | elif l == 1: |
|
662 | elif l == 1: | |
658 | return argtype(t, s[0]) |
|
663 | return argtype(t, s[0]) | |
659 | elif t == 'd': |
|
664 | elif t == 'd': | |
660 | return "_intlist('%s')" % "\0".join('%d' % int(a) for a in s) |
|
665 | return "_intlist('%s')" % "\0".join('%d' % int(a) for a in s) | |
661 | elif t == 's': |
|
666 | elif t == 's': | |
662 | return "_list('%s')" % "\0".join(s) |
|
667 | return "_list('%s')" % "\0".join(s) | |
663 | elif t == 'n': |
|
668 | elif t == 'n': | |
664 | return "_hexlist('%s')" % "\0".join(node.hex(a) for a in s) |
|
669 | return "_hexlist('%s')" % "\0".join(node.hex(a) for a in s) | |
665 | elif t == 'b': |
|
670 | elif t == 'b': | |
666 | return "_list('%s')" % "\0".join(a.branch() for a in s) |
|
671 | return "_list('%s')" % "\0".join(a.branch() for a in s) | |
667 |
|
672 | |||
668 | m = l // 2 |
|
673 | m = l // 2 | |
669 | return '(%s or %s)' % (listexp(s[:m], t), listexp(s[m:], t)) |
|
674 | return '(%s or %s)' % (listexp(s[:m], t), listexp(s[m:], t)) | |
670 |
|
675 | |||
671 | expr = pycompat.bytestr(expr) |
|
676 | expr = pycompat.bytestr(expr) | |
672 | ret = '' |
|
677 | ret = '' | |
673 | pos = 0 |
|
678 | pos = 0 | |
674 | arg = 0 |
|
679 | arg = 0 | |
675 | while pos < len(expr): |
|
680 | while pos < len(expr): | |
676 | c = expr[pos] |
|
681 | c = expr[pos] | |
677 | if c == '%': |
|
682 | if c == '%': | |
678 | pos += 1 |
|
683 | pos += 1 | |
679 | d = expr[pos] |
|
684 | d = expr[pos] | |
680 | if d == '%': |
|
685 | if d == '%': | |
681 | ret += d |
|
686 | ret += d | |
682 | elif d in 'dsnbr': |
|
687 | elif d in 'dsnbr': | |
683 | ret += argtype(d, args[arg]) |
|
688 | ret += argtype(d, args[arg]) | |
684 | arg += 1 |
|
689 | arg += 1 | |
685 | elif d == 'l': |
|
690 | elif d == 'l': | |
686 | # a list of some type |
|
691 | # a list of some type | |
687 | pos += 1 |
|
692 | pos += 1 | |
688 | d = expr[pos] |
|
693 | d = expr[pos] | |
689 | ret += listexp(list(args[arg]), d) |
|
694 | ret += listexp(list(args[arg]), d) | |
690 | arg += 1 |
|
695 | arg += 1 | |
691 | else: |
|
696 | else: | |
692 | raise error.Abort(_('unexpected revspec format character %s') |
|
697 | raise error.Abort(_('unexpected revspec format character %s') | |
693 | % d) |
|
698 | % d) | |
694 | else: |
|
699 | else: | |
695 | ret += c |
|
700 | ret += c | |
696 | pos += 1 |
|
701 | pos += 1 | |
697 |
|
702 | |||
698 | return ret |
|
703 | return ret | |
699 |
|
704 | |||
700 | def prettyformat(tree): |
|
705 | def prettyformat(tree): | |
701 | return parser.prettyformat(tree, ('string', 'symbol')) |
|
706 | return parser.prettyformat(tree, ('string', 'symbol')) | |
702 |
|
707 | |||
703 | def depth(tree): |
|
708 | def depth(tree): | |
704 | if isinstance(tree, tuple): |
|
709 | if isinstance(tree, tuple): | |
705 | return max(map(depth, tree)) + 1 |
|
710 | return max(map(depth, tree)) + 1 | |
706 | else: |
|
711 | else: | |
707 | return 0 |
|
712 | return 0 | |
708 |
|
713 | |||
709 | def funcsused(tree): |
|
714 | def funcsused(tree): | |
710 | if not isinstance(tree, tuple) or tree[0] in ('string', 'symbol'): |
|
715 | if not isinstance(tree, tuple) or tree[0] in ('string', 'symbol'): | |
711 | return set() |
|
716 | return set() | |
712 | else: |
|
717 | else: | |
713 | funcs = set() |
|
718 | funcs = set() | |
714 | for s in tree[1:]: |
|
719 | for s in tree[1:]: | |
715 | funcs |= funcsused(s) |
|
720 | funcs |= funcsused(s) | |
716 | if tree[0] == 'func': |
|
721 | if tree[0] == 'func': | |
717 | funcs.add(tree[1][1]) |
|
722 | funcs.add(tree[1][1]) | |
718 | return funcs |
|
723 | return funcs |
@@ -1,4014 +1,4073 | |||||
1 | $ HGENCODING=utf-8 |
|
1 | $ HGENCODING=utf-8 | |
2 | $ export HGENCODING |
|
2 | $ export HGENCODING | |
3 | $ cat > testrevset.py << EOF |
|
3 | $ cat > testrevset.py << EOF | |
4 | > import mercurial.revset |
|
4 | > import mercurial.revset | |
5 | > |
|
5 | > | |
6 | > baseset = mercurial.revset.baseset |
|
6 | > baseset = mercurial.revset.baseset | |
7 | > |
|
7 | > | |
8 | > def r3232(repo, subset, x): |
|
8 | > def r3232(repo, subset, x): | |
9 | > """"simple revset that return [3,2,3,2] |
|
9 | > """"simple revset that return [3,2,3,2] | |
10 | > |
|
10 | > | |
11 | > revisions duplicated on purpose. |
|
11 | > revisions duplicated on purpose. | |
12 | > """ |
|
12 | > """ | |
13 | > if 3 not in subset: |
|
13 | > if 3 not in subset: | |
14 | > if 2 in subset: |
|
14 | > if 2 in subset: | |
15 | > return baseset([2,2]) |
|
15 | > return baseset([2,2]) | |
16 | > return baseset() |
|
16 | > return baseset() | |
17 | > return baseset([3,3,2,2]) |
|
17 | > return baseset([3,3,2,2]) | |
18 | > |
|
18 | > | |
19 | > mercurial.revset.symbols['r3232'] = r3232 |
|
19 | > mercurial.revset.symbols['r3232'] = r3232 | |
20 | > EOF |
|
20 | > EOF | |
21 | $ cat >> $HGRCPATH << EOF |
|
21 | $ cat >> $HGRCPATH << EOF | |
22 | > [extensions] |
|
22 | > [extensions] | |
23 | > testrevset=$TESTTMP/testrevset.py |
|
23 | > testrevset=$TESTTMP/testrevset.py | |
24 | > EOF |
|
24 | > EOF | |
25 |
|
25 | |||
26 | $ try() { |
|
26 | $ try() { | |
27 | > hg debugrevspec --debug "$@" |
|
27 | > hg debugrevspec --debug "$@" | |
28 | > } |
|
28 | > } | |
29 |
|
29 | |||
30 | $ log() { |
|
30 | $ log() { | |
31 | > hg log --template '{rev}\n' -r "$1" |
|
31 | > hg log --template '{rev}\n' -r "$1" | |
32 | > } |
|
32 | > } | |
33 |
|
33 | |||
34 | extension to build '_intlist()' and '_hexlist()', which is necessary because |
|
34 | extension to build '_intlist()' and '_hexlist()', which is necessary because | |
35 | these predicates use '\0' as a separator: |
|
35 | these predicates use '\0' as a separator: | |
36 |
|
36 | |||
37 | $ cat <<EOF > debugrevlistspec.py |
|
37 | $ cat <<EOF > debugrevlistspec.py | |
38 | > from __future__ import absolute_import |
|
38 | > from __future__ import absolute_import | |
39 | > from mercurial import ( |
|
39 | > from mercurial import ( | |
40 | > node as nodemod, |
|
40 | > node as nodemod, | |
41 | > registrar, |
|
41 | > registrar, | |
42 | > revset, |
|
42 | > revset, | |
43 | > revsetlang, |
|
43 | > revsetlang, | |
44 | > smartset, |
|
44 | > smartset, | |
45 | > ) |
|
45 | > ) | |
46 | > cmdtable = {} |
|
46 | > cmdtable = {} | |
47 | > command = registrar.command(cmdtable) |
|
47 | > command = registrar.command(cmdtable) | |
48 | > @command('debugrevlistspec', |
|
48 | > @command('debugrevlistspec', | |
49 | > [('', 'optimize', None, 'print parsed tree after optimizing'), |
|
49 | > [('', 'optimize', None, 'print parsed tree after optimizing'), | |
50 | > ('', 'bin', None, 'unhexlify arguments')]) |
|
50 | > ('', 'bin', None, 'unhexlify arguments')]) | |
51 | > def debugrevlistspec(ui, repo, fmt, *args, **opts): |
|
51 | > def debugrevlistspec(ui, repo, fmt, *args, **opts): | |
52 | > if opts['bin']: |
|
52 | > if opts['bin']: | |
53 | > args = map(nodemod.bin, args) |
|
53 | > args = map(nodemod.bin, args) | |
54 | > expr = revsetlang.formatspec(fmt, list(args)) |
|
54 | > expr = revsetlang.formatspec(fmt, list(args)) | |
55 | > if ui.verbose: |
|
55 | > if ui.verbose: | |
56 | > tree = revsetlang.parse(expr, lookup=repo.__contains__) |
|
56 | > tree = revsetlang.parse(expr, lookup=repo.__contains__) | |
57 | > ui.note(revsetlang.prettyformat(tree), "\n") |
|
57 | > ui.note(revsetlang.prettyformat(tree), "\n") | |
58 | > if opts["optimize"]: |
|
58 | > if opts["optimize"]: | |
59 | > opttree = revsetlang.optimize(revsetlang.analyze(tree)) |
|
59 | > opttree = revsetlang.optimize(revsetlang.analyze(tree)) | |
60 | > ui.note("* optimized:\n", revsetlang.prettyformat(opttree), |
|
60 | > ui.note("* optimized:\n", revsetlang.prettyformat(opttree), | |
61 | > "\n") |
|
61 | > "\n") | |
62 | > func = revset.match(ui, expr, repo) |
|
62 | > func = revset.match(ui, expr, repo) | |
63 | > revs = func(repo) |
|
63 | > revs = func(repo) | |
64 | > if ui.verbose: |
|
64 | > if ui.verbose: | |
65 | > ui.note("* set:\n", smartset.prettyformat(revs), "\n") |
|
65 | > ui.note("* set:\n", smartset.prettyformat(revs), "\n") | |
66 | > for c in revs: |
|
66 | > for c in revs: | |
67 | > ui.write("%s\n" % c) |
|
67 | > ui.write("%s\n" % c) | |
68 | > EOF |
|
68 | > EOF | |
69 | $ cat <<EOF >> $HGRCPATH |
|
69 | $ cat <<EOF >> $HGRCPATH | |
70 | > [extensions] |
|
70 | > [extensions] | |
71 | > debugrevlistspec = $TESTTMP/debugrevlistspec.py |
|
71 | > debugrevlistspec = $TESTTMP/debugrevlistspec.py | |
72 | > EOF |
|
72 | > EOF | |
73 | $ trylist() { |
|
73 | $ trylist() { | |
74 | > hg debugrevlistspec --debug "$@" |
|
74 | > hg debugrevlistspec --debug "$@" | |
75 | > } |
|
75 | > } | |
76 |
|
76 | |||
77 | $ hg init repo |
|
77 | $ hg init repo | |
78 | $ cd repo |
|
78 | $ cd repo | |
79 |
|
79 | |||
80 | $ echo a > a |
|
80 | $ echo a > a | |
81 | $ hg branch a |
|
81 | $ hg branch a | |
82 | marked working directory as branch a |
|
82 | marked working directory as branch a | |
83 | (branches are permanent and global, did you want a bookmark?) |
|
83 | (branches are permanent and global, did you want a bookmark?) | |
84 | $ hg ci -Aqm0 |
|
84 | $ hg ci -Aqm0 | |
85 |
|
85 | |||
86 | $ echo b > b |
|
86 | $ echo b > b | |
87 | $ hg branch b |
|
87 | $ hg branch b | |
88 | marked working directory as branch b |
|
88 | marked working directory as branch b | |
89 | $ hg ci -Aqm1 |
|
89 | $ hg ci -Aqm1 | |
90 |
|
90 | |||
91 | $ rm a |
|
91 | $ rm a | |
92 | $ hg branch a-b-c- |
|
92 | $ hg branch a-b-c- | |
93 | marked working directory as branch a-b-c- |
|
93 | marked working directory as branch a-b-c- | |
94 | $ hg ci -Aqm2 -u Bob |
|
94 | $ hg ci -Aqm2 -u Bob | |
95 |
|
95 | |||
96 | $ hg log -r "extra('branch', 'a-b-c-')" --template '{rev}\n' |
|
96 | $ hg log -r "extra('branch', 'a-b-c-')" --template '{rev}\n' | |
97 | 2 |
|
97 | 2 | |
98 | $ hg log -r "extra('branch')" --template '{rev}\n' |
|
98 | $ hg log -r "extra('branch')" --template '{rev}\n' | |
99 | 0 |
|
99 | 0 | |
100 | 1 |
|
100 | 1 | |
101 | 2 |
|
101 | 2 | |
102 | $ hg log -r "extra('branch', 're:a')" --template '{rev} {branch}\n' |
|
102 | $ hg log -r "extra('branch', 're:a')" --template '{rev} {branch}\n' | |
103 | 0 a |
|
103 | 0 a | |
104 | 2 a-b-c- |
|
104 | 2 a-b-c- | |
105 |
|
105 | |||
106 | $ hg co 1 |
|
106 | $ hg co 1 | |
107 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
107 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
108 | $ hg branch +a+b+c+ |
|
108 | $ hg branch +a+b+c+ | |
109 | marked working directory as branch +a+b+c+ |
|
109 | marked working directory as branch +a+b+c+ | |
110 | $ hg ci -Aqm3 |
|
110 | $ hg ci -Aqm3 | |
111 |
|
111 | |||
112 | $ hg co 2 # interleave |
|
112 | $ hg co 2 # interleave | |
113 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
113 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
114 | $ echo bb > b |
|
114 | $ echo bb > b | |
115 | $ hg branch -- -a-b-c- |
|
115 | $ hg branch -- -a-b-c- | |
116 | marked working directory as branch -a-b-c- |
|
116 | marked working directory as branch -a-b-c- | |
117 | $ hg ci -Aqm4 -d "May 12 2005" |
|
117 | $ hg ci -Aqm4 -d "May 12 2005" | |
118 |
|
118 | |||
119 | $ hg co 3 |
|
119 | $ hg co 3 | |
120 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
120 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
121 | $ hg branch !a/b/c/ |
|
121 | $ hg branch !a/b/c/ | |
122 | marked working directory as branch !a/b/c/ |
|
122 | marked working directory as branch !a/b/c/ | |
123 | $ hg ci -Aqm"5 bug" |
|
123 | $ hg ci -Aqm"5 bug" | |
124 |
|
124 | |||
125 | $ hg merge 4 |
|
125 | $ hg merge 4 | |
126 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
126 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
127 | (branch merge, don't forget to commit) |
|
127 | (branch merge, don't forget to commit) | |
128 | $ hg branch _a_b_c_ |
|
128 | $ hg branch _a_b_c_ | |
129 | marked working directory as branch _a_b_c_ |
|
129 | marked working directory as branch _a_b_c_ | |
130 | $ hg ci -Aqm"6 issue619" |
|
130 | $ hg ci -Aqm"6 issue619" | |
131 |
|
131 | |||
132 | $ hg branch .a.b.c. |
|
132 | $ hg branch .a.b.c. | |
133 | marked working directory as branch .a.b.c. |
|
133 | marked working directory as branch .a.b.c. | |
134 | $ hg ci -Aqm7 |
|
134 | $ hg ci -Aqm7 | |
135 |
|
135 | |||
136 | $ hg branch all |
|
136 | $ hg branch all | |
137 | marked working directory as branch all |
|
137 | marked working directory as branch all | |
138 |
|
138 | |||
139 | $ hg co 4 |
|
139 | $ hg co 4 | |
140 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
140 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
141 | $ hg branch Γ© |
|
141 | $ hg branch Γ© | |
142 | marked working directory as branch \xc3\xa9 (esc) |
|
142 | marked working directory as branch \xc3\xa9 (esc) | |
143 | $ hg ci -Aqm9 |
|
143 | $ hg ci -Aqm9 | |
144 |
|
144 | |||
145 | $ hg tag -r6 1.0 |
|
145 | $ hg tag -r6 1.0 | |
146 | $ hg bookmark -r6 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
|
146 | $ hg bookmark -r6 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
147 |
|
147 | |||
148 | $ hg clone --quiet -U -r 7 . ../remote1 |
|
148 | $ hg clone --quiet -U -r 7 . ../remote1 | |
149 | $ hg clone --quiet -U -r 8 . ../remote2 |
|
149 | $ hg clone --quiet -U -r 8 . ../remote2 | |
150 | $ echo "[paths]" >> .hg/hgrc |
|
150 | $ echo "[paths]" >> .hg/hgrc | |
151 | $ echo "default = ../remote1" >> .hg/hgrc |
|
151 | $ echo "default = ../remote1" >> .hg/hgrc | |
152 |
|
152 | |||
153 | trivial |
|
153 | trivial | |
154 |
|
154 | |||
155 | $ try 0:1 |
|
155 | $ try 0:1 | |
156 | (range |
|
156 | (range | |
157 | ('symbol', '0') |
|
157 | ('symbol', '0') | |
158 | ('symbol', '1')) |
|
158 | ('symbol', '1')) | |
159 | * set: |
|
159 | * set: | |
160 | <spanset+ 0:2> |
|
160 | <spanset+ 0:2> | |
161 | 0 |
|
161 | 0 | |
162 | 1 |
|
162 | 1 | |
163 | $ try --optimize : |
|
163 | $ try --optimize : | |
164 | (rangeall |
|
164 | (rangeall | |
165 | None) |
|
165 | None) | |
166 | * optimized: |
|
166 | * optimized: | |
167 | (rangeall |
|
167 | (rangeall | |
168 | None |
|
168 | None | |
169 | define) |
|
169 | define) | |
170 | * set: |
|
170 | * set: | |
171 | <spanset+ 0:10> |
|
171 | <spanset+ 0:10> | |
172 | 0 |
|
172 | 0 | |
173 | 1 |
|
173 | 1 | |
174 | 2 |
|
174 | 2 | |
175 | 3 |
|
175 | 3 | |
176 | 4 |
|
176 | 4 | |
177 | 5 |
|
177 | 5 | |
178 | 6 |
|
178 | 6 | |
179 | 7 |
|
179 | 7 | |
180 | 8 |
|
180 | 8 | |
181 | 9 |
|
181 | 9 | |
182 | $ try 3::6 |
|
182 | $ try 3::6 | |
183 | (dagrange |
|
183 | (dagrange | |
184 | ('symbol', '3') |
|
184 | ('symbol', '3') | |
185 | ('symbol', '6')) |
|
185 | ('symbol', '6')) | |
186 | * set: |
|
186 | * set: | |
187 | <baseset+ [3, 5, 6]> |
|
187 | <baseset+ [3, 5, 6]> | |
188 | 3 |
|
188 | 3 | |
189 | 5 |
|
189 | 5 | |
190 | 6 |
|
190 | 6 | |
191 | $ try '0|1|2' |
|
191 | $ try '0|1|2' | |
192 | (or |
|
192 | (or | |
193 | (list |
|
193 | (list | |
194 | ('symbol', '0') |
|
194 | ('symbol', '0') | |
195 | ('symbol', '1') |
|
195 | ('symbol', '1') | |
196 | ('symbol', '2'))) |
|
196 | ('symbol', '2'))) | |
197 | * set: |
|
197 | * set: | |
198 | <baseset [0, 1, 2]> |
|
198 | <baseset [0, 1, 2]> | |
199 | 0 |
|
199 | 0 | |
200 | 1 |
|
200 | 1 | |
201 | 2 |
|
201 | 2 | |
202 |
|
202 | |||
203 | names that should work without quoting |
|
203 | names that should work without quoting | |
204 |
|
204 | |||
205 | $ try a |
|
205 | $ try a | |
206 | ('symbol', 'a') |
|
206 | ('symbol', 'a') | |
207 | * set: |
|
207 | * set: | |
208 | <baseset [0]> |
|
208 | <baseset [0]> | |
209 | 0 |
|
209 | 0 | |
210 | $ try b-a |
|
210 | $ try b-a | |
211 | (minus |
|
211 | (minus | |
212 | ('symbol', 'b') |
|
212 | ('symbol', 'b') | |
213 | ('symbol', 'a')) |
|
213 | ('symbol', 'a')) | |
214 | * set: |
|
214 | * set: | |
215 | <filteredset |
|
215 | <filteredset | |
216 | <baseset [1]>, |
|
216 | <baseset [1]>, | |
217 | <not |
|
217 | <not | |
218 | <baseset [0]>>> |
|
218 | <baseset [0]>>> | |
219 | 1 |
|
219 | 1 | |
220 | $ try _a_b_c_ |
|
220 | $ try _a_b_c_ | |
221 | ('symbol', '_a_b_c_') |
|
221 | ('symbol', '_a_b_c_') | |
222 | * set: |
|
222 | * set: | |
223 | <baseset [6]> |
|
223 | <baseset [6]> | |
224 | 6 |
|
224 | 6 | |
225 | $ try _a_b_c_-a |
|
225 | $ try _a_b_c_-a | |
226 | (minus |
|
226 | (minus | |
227 | ('symbol', '_a_b_c_') |
|
227 | ('symbol', '_a_b_c_') | |
228 | ('symbol', 'a')) |
|
228 | ('symbol', 'a')) | |
229 | * set: |
|
229 | * set: | |
230 | <filteredset |
|
230 | <filteredset | |
231 | <baseset [6]>, |
|
231 | <baseset [6]>, | |
232 | <not |
|
232 | <not | |
233 | <baseset [0]>>> |
|
233 | <baseset [0]>>> | |
234 | 6 |
|
234 | 6 | |
235 | $ try .a.b.c. |
|
235 | $ try .a.b.c. | |
236 | ('symbol', '.a.b.c.') |
|
236 | ('symbol', '.a.b.c.') | |
237 | * set: |
|
237 | * set: | |
238 | <baseset [7]> |
|
238 | <baseset [7]> | |
239 | 7 |
|
239 | 7 | |
240 | $ try .a.b.c.-a |
|
240 | $ try .a.b.c.-a | |
241 | (minus |
|
241 | (minus | |
242 | ('symbol', '.a.b.c.') |
|
242 | ('symbol', '.a.b.c.') | |
243 | ('symbol', 'a')) |
|
243 | ('symbol', 'a')) | |
244 | * set: |
|
244 | * set: | |
245 | <filteredset |
|
245 | <filteredset | |
246 | <baseset [7]>, |
|
246 | <baseset [7]>, | |
247 | <not |
|
247 | <not | |
248 | <baseset [0]>>> |
|
248 | <baseset [0]>>> | |
249 | 7 |
|
249 | 7 | |
250 |
|
250 | |||
251 | names that should be caught by fallback mechanism |
|
251 | names that should be caught by fallback mechanism | |
252 |
|
252 | |||
253 | $ try -- '-a-b-c-' |
|
253 | $ try -- '-a-b-c-' | |
254 | ('symbol', '-a-b-c-') |
|
254 | ('symbol', '-a-b-c-') | |
255 | * set: |
|
255 | * set: | |
256 | <baseset [4]> |
|
256 | <baseset [4]> | |
257 | 4 |
|
257 | 4 | |
258 | $ log -a-b-c- |
|
258 | $ log -a-b-c- | |
259 | 4 |
|
259 | 4 | |
260 | $ try '+a+b+c+' |
|
260 | $ try '+a+b+c+' | |
261 | ('symbol', '+a+b+c+') |
|
261 | ('symbol', '+a+b+c+') | |
262 | * set: |
|
262 | * set: | |
263 | <baseset [3]> |
|
263 | <baseset [3]> | |
264 | 3 |
|
264 | 3 | |
265 | $ try '+a+b+c+:' |
|
265 | $ try '+a+b+c+:' | |
266 | (rangepost |
|
266 | (rangepost | |
267 | ('symbol', '+a+b+c+')) |
|
267 | ('symbol', '+a+b+c+')) | |
268 | * set: |
|
268 | * set: | |
269 | <spanset+ 3:10> |
|
269 | <spanset+ 3:10> | |
270 | 3 |
|
270 | 3 | |
271 | 4 |
|
271 | 4 | |
272 | 5 |
|
272 | 5 | |
273 | 6 |
|
273 | 6 | |
274 | 7 |
|
274 | 7 | |
275 | 8 |
|
275 | 8 | |
276 | 9 |
|
276 | 9 | |
277 | $ try ':+a+b+c+' |
|
277 | $ try ':+a+b+c+' | |
278 | (rangepre |
|
278 | (rangepre | |
279 | ('symbol', '+a+b+c+')) |
|
279 | ('symbol', '+a+b+c+')) | |
280 | * set: |
|
280 | * set: | |
281 | <spanset+ 0:4> |
|
281 | <spanset+ 0:4> | |
282 | 0 |
|
282 | 0 | |
283 | 1 |
|
283 | 1 | |
284 | 2 |
|
284 | 2 | |
285 | 3 |
|
285 | 3 | |
286 | $ try -- '-a-b-c-:+a+b+c+' |
|
286 | $ try -- '-a-b-c-:+a+b+c+' | |
287 | (range |
|
287 | (range | |
288 | ('symbol', '-a-b-c-') |
|
288 | ('symbol', '-a-b-c-') | |
289 | ('symbol', '+a+b+c+')) |
|
289 | ('symbol', '+a+b+c+')) | |
290 | * set: |
|
290 | * set: | |
291 | <spanset- 3:5> |
|
291 | <spanset- 3:5> | |
292 | 4 |
|
292 | 4 | |
293 | 3 |
|
293 | 3 | |
294 | $ log '-a-b-c-:+a+b+c+' |
|
294 | $ log '-a-b-c-:+a+b+c+' | |
295 | 4 |
|
295 | 4 | |
296 | 3 |
|
296 | 3 | |
297 |
|
297 | |||
298 | $ try -- -a-b-c--a # complains |
|
298 | $ try -- -a-b-c--a # complains | |
299 | (minus |
|
299 | (minus | |
300 | (minus |
|
300 | (minus | |
301 | (minus |
|
301 | (minus | |
302 | (negate |
|
302 | (negate | |
303 | ('symbol', 'a')) |
|
303 | ('symbol', 'a')) | |
304 | ('symbol', 'b')) |
|
304 | ('symbol', 'b')) | |
305 | ('symbol', 'c')) |
|
305 | ('symbol', 'c')) | |
306 | (negate |
|
306 | (negate | |
307 | ('symbol', 'a'))) |
|
307 | ('symbol', 'a'))) | |
308 | abort: unknown revision '-a'! |
|
308 | abort: unknown revision '-a'! | |
309 | [255] |
|
309 | [255] | |
310 | $ try Γ© |
|
310 | $ try Γ© | |
311 | ('symbol', '\xc3\xa9') |
|
311 | ('symbol', '\xc3\xa9') | |
312 | * set: |
|
312 | * set: | |
313 | <baseset [9]> |
|
313 | <baseset [9]> | |
314 | 9 |
|
314 | 9 | |
315 |
|
315 | |||
316 | no quoting needed |
|
316 | no quoting needed | |
317 |
|
317 | |||
318 | $ log ::a-b-c- |
|
318 | $ log ::a-b-c- | |
319 | 0 |
|
319 | 0 | |
320 | 1 |
|
320 | 1 | |
321 | 2 |
|
321 | 2 | |
322 |
|
322 | |||
323 | quoting needed |
|
323 | quoting needed | |
324 |
|
324 | |||
325 | $ try '"-a-b-c-"-a' |
|
325 | $ try '"-a-b-c-"-a' | |
326 | (minus |
|
326 | (minus | |
327 | ('string', '-a-b-c-') |
|
327 | ('string', '-a-b-c-') | |
328 | ('symbol', 'a')) |
|
328 | ('symbol', 'a')) | |
329 | * set: |
|
329 | * set: | |
330 | <filteredset |
|
330 | <filteredset | |
331 | <baseset [4]>, |
|
331 | <baseset [4]>, | |
332 | <not |
|
332 | <not | |
333 | <baseset [0]>>> |
|
333 | <baseset [0]>>> | |
334 | 4 |
|
334 | 4 | |
335 |
|
335 | |||
336 | $ log '1 or 2' |
|
336 | $ log '1 or 2' | |
337 | 1 |
|
337 | 1 | |
338 | 2 |
|
338 | 2 | |
339 | $ log '1|2' |
|
339 | $ log '1|2' | |
340 | 1 |
|
340 | 1 | |
341 | 2 |
|
341 | 2 | |
342 | $ log '1 and 2' |
|
342 | $ log '1 and 2' | |
343 | $ log '1&2' |
|
343 | $ log '1&2' | |
344 | $ try '1&2|3' # precedence - and is higher |
|
344 | $ try '1&2|3' # precedence - and is higher | |
345 | (or |
|
345 | (or | |
346 | (list |
|
346 | (list | |
347 | (and |
|
347 | (and | |
348 | ('symbol', '1') |
|
348 | ('symbol', '1') | |
349 | ('symbol', '2')) |
|
349 | ('symbol', '2')) | |
350 | ('symbol', '3'))) |
|
350 | ('symbol', '3'))) | |
351 | * set: |
|
351 | * set: | |
352 | <addset |
|
352 | <addset | |
353 | <baseset []>, |
|
353 | <baseset []>, | |
354 | <baseset [3]>> |
|
354 | <baseset [3]>> | |
355 | 3 |
|
355 | 3 | |
356 | $ try '1|2&3' |
|
356 | $ try '1|2&3' | |
357 | (or |
|
357 | (or | |
358 | (list |
|
358 | (list | |
359 | ('symbol', '1') |
|
359 | ('symbol', '1') | |
360 | (and |
|
360 | (and | |
361 | ('symbol', '2') |
|
361 | ('symbol', '2') | |
362 | ('symbol', '3')))) |
|
362 | ('symbol', '3')))) | |
363 | * set: |
|
363 | * set: | |
364 | <addset |
|
364 | <addset | |
365 | <baseset [1]>, |
|
365 | <baseset [1]>, | |
366 | <baseset []>> |
|
366 | <baseset []>> | |
367 | 1 |
|
367 | 1 | |
368 | $ try '1&2&3' # associativity |
|
368 | $ try '1&2&3' # associativity | |
369 | (and |
|
369 | (and | |
370 | (and |
|
370 | (and | |
371 | ('symbol', '1') |
|
371 | ('symbol', '1') | |
372 | ('symbol', '2')) |
|
372 | ('symbol', '2')) | |
373 | ('symbol', '3')) |
|
373 | ('symbol', '3')) | |
374 | * set: |
|
374 | * set: | |
375 | <baseset []> |
|
375 | <baseset []> | |
376 | $ try '1|(2|3)' |
|
376 | $ try '1|(2|3)' | |
377 | (or |
|
377 | (or | |
378 | (list |
|
378 | (list | |
379 | ('symbol', '1') |
|
379 | ('symbol', '1') | |
380 | (group |
|
380 | (group | |
381 | (or |
|
381 | (or | |
382 | (list |
|
382 | (list | |
383 | ('symbol', '2') |
|
383 | ('symbol', '2') | |
384 | ('symbol', '3')))))) |
|
384 | ('symbol', '3')))))) | |
385 | * set: |
|
385 | * set: | |
386 | <addset |
|
386 | <addset | |
387 | <baseset [1]>, |
|
387 | <baseset [1]>, | |
388 | <baseset [2, 3]>> |
|
388 | <baseset [2, 3]>> | |
389 | 1 |
|
389 | 1 | |
390 | 2 |
|
390 | 2 | |
391 | 3 |
|
391 | 3 | |
392 | $ log '1.0' # tag |
|
392 | $ log '1.0' # tag | |
393 | 6 |
|
393 | 6 | |
394 | $ log 'a' # branch |
|
394 | $ log 'a' # branch | |
395 | 0 |
|
395 | 0 | |
396 | $ log '2785f51ee' |
|
396 | $ log '2785f51ee' | |
397 | 0 |
|
397 | 0 | |
398 | $ log 'date(2005)' |
|
398 | $ log 'date(2005)' | |
399 | 4 |
|
399 | 4 | |
400 | $ log 'date(this is a test)' |
|
400 | $ log 'date(this is a test)' | |
401 | hg: parse error at 10: unexpected token: symbol |
|
401 | hg: parse error at 10: unexpected token: symbol | |
402 | [255] |
|
402 | [255] | |
403 | $ log 'date()' |
|
403 | $ log 'date()' | |
404 | hg: parse error: date requires a string |
|
404 | hg: parse error: date requires a string | |
405 | [255] |
|
405 | [255] | |
406 | $ log 'date' |
|
406 | $ log 'date' | |
407 | abort: unknown revision 'date'! |
|
407 | abort: unknown revision 'date'! | |
408 | [255] |
|
408 | [255] | |
409 | $ log 'date(' |
|
409 | $ log 'date(' | |
410 | hg: parse error at 5: not a prefix: end |
|
410 | hg: parse error at 5: not a prefix: end | |
411 | [255] |
|
411 | [255] | |
412 | $ log 'date("\xy")' |
|
412 | $ log 'date("\xy")' | |
413 | hg: parse error: invalid \x escape |
|
413 | hg: parse error: invalid \x escape | |
414 | [255] |
|
414 | [255] | |
415 | $ log 'date(tip)' |
|
415 | $ log 'date(tip)' | |
416 | hg: parse error: invalid date: 'tip' |
|
416 | hg: parse error: invalid date: 'tip' | |
417 | [255] |
|
417 | [255] | |
418 | $ log '0:date' |
|
418 | $ log '0:date' | |
419 | abort: unknown revision 'date'! |
|
419 | abort: unknown revision 'date'! | |
420 | [255] |
|
420 | [255] | |
421 | $ log '::"date"' |
|
421 | $ log '::"date"' | |
422 | abort: unknown revision 'date'! |
|
422 | abort: unknown revision 'date'! | |
423 | [255] |
|
423 | [255] | |
424 | $ hg book date -r 4 |
|
424 | $ hg book date -r 4 | |
425 | $ log '0:date' |
|
425 | $ log '0:date' | |
426 | 0 |
|
426 | 0 | |
427 | 1 |
|
427 | 1 | |
428 | 2 |
|
428 | 2 | |
429 | 3 |
|
429 | 3 | |
430 | 4 |
|
430 | 4 | |
431 | $ log '::date' |
|
431 | $ log '::date' | |
432 | 0 |
|
432 | 0 | |
433 | 1 |
|
433 | 1 | |
434 | 2 |
|
434 | 2 | |
435 | 4 |
|
435 | 4 | |
436 | $ log '::"date"' |
|
436 | $ log '::"date"' | |
437 | 0 |
|
437 | 0 | |
438 | 1 |
|
438 | 1 | |
439 | 2 |
|
439 | 2 | |
440 | 4 |
|
440 | 4 | |
441 | $ log 'date(2005) and 1::' |
|
441 | $ log 'date(2005) and 1::' | |
442 | 4 |
|
442 | 4 | |
443 | $ hg book -d date |
|
443 | $ hg book -d date | |
444 |
|
444 | |||
445 | function name should be a symbol |
|
445 | function name should be a symbol | |
446 |
|
446 | |||
447 | $ log '"date"(2005)' |
|
447 | $ log '"date"(2005)' | |
448 | hg: parse error: not a symbol |
|
448 | hg: parse error: not a symbol | |
449 | [255] |
|
449 | [255] | |
450 |
|
450 | |||
451 | keyword arguments |
|
451 | keyword arguments | |
452 |
|
452 | |||
453 | $ log 'extra(branch, value=a)' |
|
453 | $ log 'extra(branch, value=a)' | |
454 | 0 |
|
454 | 0 | |
455 |
|
455 | |||
456 | $ log 'extra(branch, a, b)' |
|
456 | $ log 'extra(branch, a, b)' | |
457 | hg: parse error: extra takes at most 2 positional arguments |
|
457 | hg: parse error: extra takes at most 2 positional arguments | |
458 | [255] |
|
458 | [255] | |
459 | $ log 'extra(a, label=b)' |
|
459 | $ log 'extra(a, label=b)' | |
460 | hg: parse error: extra got multiple values for keyword argument 'label' |
|
460 | hg: parse error: extra got multiple values for keyword argument 'label' | |
461 | [255] |
|
461 | [255] | |
462 | $ log 'extra(label=branch, default)' |
|
462 | $ log 'extra(label=branch, default)' | |
463 | hg: parse error: extra got an invalid argument |
|
463 | hg: parse error: extra got an invalid argument | |
464 | [255] |
|
464 | [255] | |
465 | $ log 'extra(branch, foo+bar=baz)' |
|
465 | $ log 'extra(branch, foo+bar=baz)' | |
466 | hg: parse error: extra got an invalid argument |
|
466 | hg: parse error: extra got an invalid argument | |
467 | [255] |
|
467 | [255] | |
468 | $ log 'extra(unknown=branch)' |
|
468 | $ log 'extra(unknown=branch)' | |
469 | hg: parse error: extra got an unexpected keyword argument 'unknown' |
|
469 | hg: parse error: extra got an unexpected keyword argument 'unknown' | |
470 | [255] |
|
470 | [255] | |
471 |
|
471 | |||
472 | $ try 'foo=bar|baz' |
|
472 | $ try 'foo=bar|baz' | |
473 | (keyvalue |
|
473 | (keyvalue | |
474 | ('symbol', 'foo') |
|
474 | ('symbol', 'foo') | |
475 | (or |
|
475 | (or | |
476 | (list |
|
476 | (list | |
477 | ('symbol', 'bar') |
|
477 | ('symbol', 'bar') | |
478 | ('symbol', 'baz')))) |
|
478 | ('symbol', 'baz')))) | |
479 | hg: parse error: can't use a key-value pair in this context |
|
479 | hg: parse error: can't use a key-value pair in this context | |
480 | [255] |
|
480 | [255] | |
481 |
|
481 | |||
482 | right-hand side should be optimized recursively |
|
482 | right-hand side should be optimized recursively | |
483 |
|
483 | |||
484 | $ try --optimize 'foo=(not public())' |
|
484 | $ try --optimize 'foo=(not public())' | |
485 | (keyvalue |
|
485 | (keyvalue | |
486 | ('symbol', 'foo') |
|
486 | ('symbol', 'foo') | |
487 | (group |
|
487 | (group | |
488 | (not |
|
488 | (not | |
489 | (func |
|
489 | (func | |
490 | ('symbol', 'public') |
|
490 | ('symbol', 'public') | |
491 | None)))) |
|
491 | None)))) | |
492 | * optimized: |
|
492 | * optimized: | |
493 | (keyvalue |
|
493 | (keyvalue | |
494 | ('symbol', 'foo') |
|
494 | ('symbol', 'foo') | |
495 | (func |
|
495 | (func | |
496 | ('symbol', '_notpublic') |
|
496 | ('symbol', '_notpublic') | |
497 | None |
|
497 | None | |
498 | any)) |
|
498 | any)) | |
499 | hg: parse error: can't use a key-value pair in this context |
|
499 | hg: parse error: can't use a key-value pair in this context | |
500 | [255] |
|
500 | [255] | |
501 |
|
501 | |||
502 | parsed tree at stages: |
|
502 | parsed tree at stages: | |
503 |
|
503 | |||
504 | $ hg debugrevspec -p all '()' |
|
504 | $ hg debugrevspec -p all '()' | |
505 | * parsed: |
|
505 | * parsed: | |
506 | (group |
|
506 | (group | |
507 | None) |
|
507 | None) | |
508 | * expanded: |
|
508 | * expanded: | |
509 | (group |
|
509 | (group | |
510 | None) |
|
510 | None) | |
511 | * concatenated: |
|
511 | * concatenated: | |
512 | (group |
|
512 | (group | |
513 | None) |
|
513 | None) | |
514 | * analyzed: |
|
514 | * analyzed: | |
515 | None |
|
515 | None | |
516 | * optimized: |
|
516 | * optimized: | |
517 | None |
|
517 | None | |
518 | hg: parse error: missing argument |
|
518 | hg: parse error: missing argument | |
519 | [255] |
|
519 | [255] | |
520 |
|
520 | |||
521 | $ hg debugrevspec --no-optimized -p all '()' |
|
521 | $ hg debugrevspec --no-optimized -p all '()' | |
522 | * parsed: |
|
522 | * parsed: | |
523 | (group |
|
523 | (group | |
524 | None) |
|
524 | None) | |
525 | * expanded: |
|
525 | * expanded: | |
526 | (group |
|
526 | (group | |
527 | None) |
|
527 | None) | |
528 | * concatenated: |
|
528 | * concatenated: | |
529 | (group |
|
529 | (group | |
530 | None) |
|
530 | None) | |
531 | * analyzed: |
|
531 | * analyzed: | |
532 | None |
|
532 | None | |
533 | hg: parse error: missing argument |
|
533 | hg: parse error: missing argument | |
534 | [255] |
|
534 | [255] | |
535 |
|
535 | |||
536 | $ hg debugrevspec -p parsed -p analyzed -p optimized '(0|1)-1' |
|
536 | $ hg debugrevspec -p parsed -p analyzed -p optimized '(0|1)-1' | |
537 | * parsed: |
|
537 | * parsed: | |
538 | (minus |
|
538 | (minus | |
539 | (group |
|
539 | (group | |
540 | (or |
|
540 | (or | |
541 | (list |
|
541 | (list | |
542 | ('symbol', '0') |
|
542 | ('symbol', '0') | |
543 | ('symbol', '1')))) |
|
543 | ('symbol', '1')))) | |
544 | ('symbol', '1')) |
|
544 | ('symbol', '1')) | |
545 | * analyzed: |
|
545 | * analyzed: | |
546 | (and |
|
546 | (and | |
547 | (or |
|
547 | (or | |
548 | (list |
|
548 | (list | |
549 | ('symbol', '0') |
|
549 | ('symbol', '0') | |
550 | ('symbol', '1')) |
|
550 | ('symbol', '1')) | |
551 | define) |
|
551 | define) | |
552 | (not |
|
552 | (not | |
553 | ('symbol', '1') |
|
553 | ('symbol', '1') | |
554 | follow) |
|
554 | follow) | |
555 | define) |
|
555 | define) | |
556 | * optimized: |
|
556 | * optimized: | |
557 | (difference |
|
557 | (difference | |
558 | (func |
|
558 | (func | |
559 | ('symbol', '_list') |
|
559 | ('symbol', '_list') | |
560 | ('string', '0\x001') |
|
560 | ('string', '0\x001') | |
561 | define) |
|
561 | define) | |
562 | ('symbol', '1') |
|
562 | ('symbol', '1') | |
563 | define) |
|
563 | define) | |
564 | 0 |
|
564 | 0 | |
565 |
|
565 | |||
566 | $ hg debugrevspec -p unknown '0' |
|
566 | $ hg debugrevspec -p unknown '0' | |
567 | abort: invalid stage name: unknown |
|
567 | abort: invalid stage name: unknown | |
568 | [255] |
|
568 | [255] | |
569 |
|
569 | |||
570 | $ hg debugrevspec -p all --optimize '0' |
|
570 | $ hg debugrevspec -p all --optimize '0' | |
571 | abort: cannot use --optimize with --show-stage |
|
571 | abort: cannot use --optimize with --show-stage | |
572 | [255] |
|
572 | [255] | |
573 |
|
573 | |||
574 | verify optimized tree: |
|
574 | verify optimized tree: | |
575 |
|
575 | |||
576 | $ hg debugrevspec --verify '0|1' |
|
576 | $ hg debugrevspec --verify '0|1' | |
577 |
|
577 | |||
578 | $ hg debugrevspec --verify -v -p analyzed -p optimized 'r3232() & 2' |
|
578 | $ hg debugrevspec --verify -v -p analyzed -p optimized 'r3232() & 2' | |
579 | * analyzed: |
|
579 | * analyzed: | |
580 | (and |
|
580 | (and | |
581 | (func |
|
581 | (func | |
582 | ('symbol', 'r3232') |
|
582 | ('symbol', 'r3232') | |
583 | None |
|
583 | None | |
584 | define) |
|
584 | define) | |
585 | ('symbol', '2') |
|
585 | ('symbol', '2') | |
586 | define) |
|
586 | define) | |
587 | * optimized: |
|
587 | * optimized: | |
588 | (and |
|
588 | (and | |
589 | ('symbol', '2') |
|
589 | ('symbol', '2') | |
590 | (func |
|
590 | (func | |
591 | ('symbol', 'r3232') |
|
591 | ('symbol', 'r3232') | |
592 | None |
|
592 | None | |
593 | define) |
|
593 | define) | |
594 | define) |
|
594 | define) | |
595 | * analyzed set: |
|
595 | * analyzed set: | |
596 | <baseset [2]> |
|
596 | <baseset [2]> | |
597 | * optimized set: |
|
597 | * optimized set: | |
598 | <baseset [2, 2]> |
|
598 | <baseset [2, 2]> | |
599 | --- analyzed |
|
599 | --- analyzed | |
600 | +++ optimized |
|
600 | +++ optimized | |
601 | 2 |
|
601 | 2 | |
602 | +2 |
|
602 | +2 | |
603 | [1] |
|
603 | [1] | |
604 |
|
604 | |||
605 | $ hg debugrevspec --no-optimized --verify-optimized '0' |
|
605 | $ hg debugrevspec --no-optimized --verify-optimized '0' | |
606 | abort: cannot use --verify-optimized with --no-optimized |
|
606 | abort: cannot use --verify-optimized with --no-optimized | |
607 | [255] |
|
607 | [255] | |
608 |
|
608 | |||
609 | Test that symbols only get parsed as functions if there's an opening |
|
609 | Test that symbols only get parsed as functions if there's an opening | |
610 | parenthesis. |
|
610 | parenthesis. | |
611 |
|
611 | |||
612 | $ hg book only -r 9 |
|
612 | $ hg book only -r 9 | |
613 | $ log 'only(only)' # Outer "only" is a function, inner "only" is the bookmark |
|
613 | $ log 'only(only)' # Outer "only" is a function, inner "only" is the bookmark | |
614 | 8 |
|
614 | 8 | |
615 | 9 |
|
615 | 9 | |
616 |
|
616 | |||
617 | ':y' behaves like '0:y', but can't be rewritten as such since the revision '0' |
|
617 | ':y' behaves like '0:y', but can't be rewritten as such since the revision '0' | |
618 | may be hidden (issue5385) |
|
618 | may be hidden (issue5385) | |
619 |
|
619 | |||
620 | $ try -p parsed -p analyzed ':' |
|
620 | $ try -p parsed -p analyzed ':' | |
621 | * parsed: |
|
621 | * parsed: | |
622 | (rangeall |
|
622 | (rangeall | |
623 | None) |
|
623 | None) | |
624 | * analyzed: |
|
624 | * analyzed: | |
625 | (rangeall |
|
625 | (rangeall | |
626 | None |
|
626 | None | |
627 | define) |
|
627 | define) | |
628 | * set: |
|
628 | * set: | |
629 | <spanset+ 0:10> |
|
629 | <spanset+ 0:10> | |
630 | 0 |
|
630 | 0 | |
631 | 1 |
|
631 | 1 | |
632 | 2 |
|
632 | 2 | |
633 | 3 |
|
633 | 3 | |
634 | 4 |
|
634 | 4 | |
635 | 5 |
|
635 | 5 | |
636 | 6 |
|
636 | 6 | |
637 | 7 |
|
637 | 7 | |
638 | 8 |
|
638 | 8 | |
639 | 9 |
|
639 | 9 | |
640 | $ try -p analyzed ':1' |
|
640 | $ try -p analyzed ':1' | |
641 | * analyzed: |
|
641 | * analyzed: | |
642 | (rangepre |
|
642 | (rangepre | |
643 | ('symbol', '1') |
|
643 | ('symbol', '1') | |
644 | define) |
|
644 | define) | |
645 | * set: |
|
645 | * set: | |
646 | <spanset+ 0:2> |
|
646 | <spanset+ 0:2> | |
647 | 0 |
|
647 | 0 | |
648 | 1 |
|
648 | 1 | |
649 | $ try -p analyzed ':(1|2)' |
|
649 | $ try -p analyzed ':(1|2)' | |
650 | * analyzed: |
|
650 | * analyzed: | |
651 | (rangepre |
|
651 | (rangepre | |
652 | (or |
|
652 | (or | |
653 | (list |
|
653 | (list | |
654 | ('symbol', '1') |
|
654 | ('symbol', '1') | |
655 | ('symbol', '2')) |
|
655 | ('symbol', '2')) | |
656 | define) |
|
656 | define) | |
657 | define) |
|
657 | define) | |
658 | * set: |
|
658 | * set: | |
659 | <spanset+ 0:3> |
|
659 | <spanset+ 0:3> | |
660 | 0 |
|
660 | 0 | |
661 | 1 |
|
661 | 1 | |
662 | 2 |
|
662 | 2 | |
663 | $ try -p analyzed ':(1&2)' |
|
663 | $ try -p analyzed ':(1&2)' | |
664 | * analyzed: |
|
664 | * analyzed: | |
665 | (rangepre |
|
665 | (rangepre | |
666 | (and |
|
666 | (and | |
667 | ('symbol', '1') |
|
667 | ('symbol', '1') | |
668 | ('symbol', '2') |
|
668 | ('symbol', '2') | |
669 | define) |
|
669 | define) | |
670 | define) |
|
670 | define) | |
671 | * set: |
|
671 | * set: | |
672 | <baseset []> |
|
672 | <baseset []> | |
673 |
|
673 | |||
674 | infix/suffix resolution of ^ operator (issue2884): |
|
674 | infix/suffix resolution of ^ operator (issue2884): | |
675 |
|
675 | |||
676 | x^:y means (x^):y |
|
676 | x^:y means (x^):y | |
677 |
|
677 | |||
678 | $ try '1^:2' |
|
678 | $ try '1^:2' | |
679 | (range |
|
679 | (range | |
680 | (parentpost |
|
680 | (parentpost | |
681 | ('symbol', '1')) |
|
681 | ('symbol', '1')) | |
682 | ('symbol', '2')) |
|
682 | ('symbol', '2')) | |
683 | * set: |
|
683 | * set: | |
684 | <spanset+ 0:3> |
|
684 | <spanset+ 0:3> | |
685 | 0 |
|
685 | 0 | |
686 | 1 |
|
686 | 1 | |
687 | 2 |
|
687 | 2 | |
688 |
|
688 | |||
689 | $ try '1^::2' |
|
689 | $ try '1^::2' | |
690 | (dagrange |
|
690 | (dagrange | |
691 | (parentpost |
|
691 | (parentpost | |
692 | ('symbol', '1')) |
|
692 | ('symbol', '1')) | |
693 | ('symbol', '2')) |
|
693 | ('symbol', '2')) | |
694 | * set: |
|
694 | * set: | |
695 | <baseset+ [0, 1, 2]> |
|
695 | <baseset+ [0, 1, 2]> | |
696 | 0 |
|
696 | 0 | |
697 | 1 |
|
697 | 1 | |
698 | 2 |
|
698 | 2 | |
699 |
|
699 | |||
700 | $ try '9^:' |
|
700 | $ try '9^:' | |
701 | (rangepost |
|
701 | (rangepost | |
702 | (parentpost |
|
702 | (parentpost | |
703 | ('symbol', '9'))) |
|
703 | ('symbol', '9'))) | |
704 | * set: |
|
704 | * set: | |
705 | <spanset+ 8:10> |
|
705 | <spanset+ 8:10> | |
706 | 8 |
|
706 | 8 | |
707 | 9 |
|
707 | 9 | |
708 |
|
708 | |||
709 | x^:y should be resolved before omitting group operators |
|
709 | x^:y should be resolved before omitting group operators | |
710 |
|
710 | |||
711 | $ try '1^(:2)' |
|
711 | $ try '1^(:2)' | |
712 | (parent |
|
712 | (parent | |
713 | ('symbol', '1') |
|
713 | ('symbol', '1') | |
714 | (group |
|
714 | (group | |
715 | (rangepre |
|
715 | (rangepre | |
716 | ('symbol', '2')))) |
|
716 | ('symbol', '2')))) | |
717 | hg: parse error: ^ expects a number 0, 1, or 2 |
|
717 | hg: parse error: ^ expects a number 0, 1, or 2 | |
718 | [255] |
|
718 | [255] | |
719 |
|
719 | |||
720 | x^:y should be resolved recursively |
|
720 | x^:y should be resolved recursively | |
721 |
|
721 | |||
722 | $ try 'sort(1^:2)' |
|
722 | $ try 'sort(1^:2)' | |
723 | (func |
|
723 | (func | |
724 | ('symbol', 'sort') |
|
724 | ('symbol', 'sort') | |
725 | (range |
|
725 | (range | |
726 | (parentpost |
|
726 | (parentpost | |
727 | ('symbol', '1')) |
|
727 | ('symbol', '1')) | |
728 | ('symbol', '2'))) |
|
728 | ('symbol', '2'))) | |
729 | * set: |
|
729 | * set: | |
730 | <spanset+ 0:3> |
|
730 | <spanset+ 0:3> | |
731 | 0 |
|
731 | 0 | |
732 | 1 |
|
732 | 1 | |
733 | 2 |
|
733 | 2 | |
734 |
|
734 | |||
735 | $ try '(3^:4)^:2' |
|
735 | $ try '(3^:4)^:2' | |
736 | (range |
|
736 | (range | |
737 | (parentpost |
|
737 | (parentpost | |
738 | (group |
|
738 | (group | |
739 | (range |
|
739 | (range | |
740 | (parentpost |
|
740 | (parentpost | |
741 | ('symbol', '3')) |
|
741 | ('symbol', '3')) | |
742 | ('symbol', '4')))) |
|
742 | ('symbol', '4')))) | |
743 | ('symbol', '2')) |
|
743 | ('symbol', '2')) | |
744 | * set: |
|
744 | * set: | |
745 | <spanset+ 0:3> |
|
745 | <spanset+ 0:3> | |
746 | 0 |
|
746 | 0 | |
747 | 1 |
|
747 | 1 | |
748 | 2 |
|
748 | 2 | |
749 |
|
749 | |||
750 | $ try '(3^::4)^::2' |
|
750 | $ try '(3^::4)^::2' | |
751 | (dagrange |
|
751 | (dagrange | |
752 | (parentpost |
|
752 | (parentpost | |
753 | (group |
|
753 | (group | |
754 | (dagrange |
|
754 | (dagrange | |
755 | (parentpost |
|
755 | (parentpost | |
756 | ('symbol', '3')) |
|
756 | ('symbol', '3')) | |
757 | ('symbol', '4')))) |
|
757 | ('symbol', '4')))) | |
758 | ('symbol', '2')) |
|
758 | ('symbol', '2')) | |
759 | * set: |
|
759 | * set: | |
760 | <baseset+ [0, 1, 2]> |
|
760 | <baseset+ [0, 1, 2]> | |
761 | 0 |
|
761 | 0 | |
762 | 1 |
|
762 | 1 | |
763 | 2 |
|
763 | 2 | |
764 |
|
764 | |||
765 | $ try '(9^:)^:' |
|
765 | $ try '(9^:)^:' | |
766 | (rangepost |
|
766 | (rangepost | |
767 | (parentpost |
|
767 | (parentpost | |
768 | (group |
|
768 | (group | |
769 | (rangepost |
|
769 | (rangepost | |
770 | (parentpost |
|
770 | (parentpost | |
771 | ('symbol', '9')))))) |
|
771 | ('symbol', '9')))))) | |
772 | * set: |
|
772 | * set: | |
773 | <spanset+ 4:10> |
|
773 | <spanset+ 4:10> | |
774 | 4 |
|
774 | 4 | |
775 | 5 |
|
775 | 5 | |
776 | 6 |
|
776 | 6 | |
777 | 7 |
|
777 | 7 | |
778 | 8 |
|
778 | 8 | |
779 | 9 |
|
779 | 9 | |
780 |
|
780 | |||
781 | x^ in alias should also be resolved |
|
781 | x^ in alias should also be resolved | |
782 |
|
782 | |||
783 | $ try 'A' --config 'revsetalias.A=1^:2' |
|
783 | $ try 'A' --config 'revsetalias.A=1^:2' | |
784 | ('symbol', 'A') |
|
784 | ('symbol', 'A') | |
785 | * expanded: |
|
785 | * expanded: | |
786 | (range |
|
786 | (range | |
787 | (parentpost |
|
787 | (parentpost | |
788 | ('symbol', '1')) |
|
788 | ('symbol', '1')) | |
789 | ('symbol', '2')) |
|
789 | ('symbol', '2')) | |
790 | * set: |
|
790 | * set: | |
791 | <spanset+ 0:3> |
|
791 | <spanset+ 0:3> | |
792 | 0 |
|
792 | 0 | |
793 | 1 |
|
793 | 1 | |
794 | 2 |
|
794 | 2 | |
795 |
|
795 | |||
796 | $ try 'A:2' --config 'revsetalias.A=1^' |
|
796 | $ try 'A:2' --config 'revsetalias.A=1^' | |
797 | (range |
|
797 | (range | |
798 | ('symbol', 'A') |
|
798 | ('symbol', 'A') | |
799 | ('symbol', '2')) |
|
799 | ('symbol', '2')) | |
800 | * expanded: |
|
800 | * expanded: | |
801 | (range |
|
801 | (range | |
802 | (parentpost |
|
802 | (parentpost | |
803 | ('symbol', '1')) |
|
803 | ('symbol', '1')) | |
804 | ('symbol', '2')) |
|
804 | ('symbol', '2')) | |
805 | * set: |
|
805 | * set: | |
806 | <spanset+ 0:3> |
|
806 | <spanset+ 0:3> | |
807 | 0 |
|
807 | 0 | |
808 | 1 |
|
808 | 1 | |
809 | 2 |
|
809 | 2 | |
810 |
|
810 | |||
811 | but not beyond the boundary of alias expansion, because the resolution should |
|
811 | but not beyond the boundary of alias expansion, because the resolution should | |
812 | be made at the parsing stage |
|
812 | be made at the parsing stage | |
813 |
|
813 | |||
814 | $ try '1^A' --config 'revsetalias.A=:2' |
|
814 | $ try '1^A' --config 'revsetalias.A=:2' | |
815 | (parent |
|
815 | (parent | |
816 | ('symbol', '1') |
|
816 | ('symbol', '1') | |
817 | ('symbol', 'A')) |
|
817 | ('symbol', 'A')) | |
818 | * expanded: |
|
818 | * expanded: | |
819 | (parent |
|
819 | (parent | |
820 | ('symbol', '1') |
|
820 | ('symbol', '1') | |
821 | (rangepre |
|
821 | (rangepre | |
822 | ('symbol', '2'))) |
|
822 | ('symbol', '2'))) | |
823 | hg: parse error: ^ expects a number 0, 1, or 2 |
|
823 | hg: parse error: ^ expects a number 0, 1, or 2 | |
824 | [255] |
|
824 | [255] | |
825 |
|
825 | |||
826 | ancestor can accept 0 or more arguments |
|
826 | ancestor can accept 0 or more arguments | |
827 |
|
827 | |||
828 | $ log 'ancestor()' |
|
828 | $ log 'ancestor()' | |
829 | $ log 'ancestor(1)' |
|
829 | $ log 'ancestor(1)' | |
830 | 1 |
|
830 | 1 | |
831 | $ log 'ancestor(4,5)' |
|
831 | $ log 'ancestor(4,5)' | |
832 | 1 |
|
832 | 1 | |
833 | $ log 'ancestor(4,5) and 4' |
|
833 | $ log 'ancestor(4,5) and 4' | |
834 | $ log 'ancestor(0,0,1,3)' |
|
834 | $ log 'ancestor(0,0,1,3)' | |
835 | 0 |
|
835 | 0 | |
836 | $ log 'ancestor(3,1,5,3,5,1)' |
|
836 | $ log 'ancestor(3,1,5,3,5,1)' | |
837 | 1 |
|
837 | 1 | |
838 | $ log 'ancestor(0,1,3,5)' |
|
838 | $ log 'ancestor(0,1,3,5)' | |
839 | 0 |
|
839 | 0 | |
840 | $ log 'ancestor(1,2,3,4,5)' |
|
840 | $ log 'ancestor(1,2,3,4,5)' | |
841 | 1 |
|
841 | 1 | |
842 |
|
842 | |||
843 | test ancestors |
|
843 | test ancestors | |
844 |
|
844 | |||
845 | $ log 'ancestors(5)' |
|
845 | $ log 'ancestors(5)' | |
846 | 0 |
|
846 | 0 | |
847 | 1 |
|
847 | 1 | |
848 | 3 |
|
848 | 3 | |
849 | 5 |
|
849 | 5 | |
850 | $ log 'ancestor(ancestors(5))' |
|
850 | $ log 'ancestor(ancestors(5))' | |
851 | 0 |
|
851 | 0 | |
852 | $ log '::r3232()' |
|
852 | $ log '::r3232()' | |
853 | 0 |
|
853 | 0 | |
854 | 1 |
|
854 | 1 | |
855 | 2 |
|
855 | 2 | |
856 | 3 |
|
856 | 3 | |
857 |
|
857 | |||
858 | $ log 'author(bob)' |
|
858 | $ log 'author(bob)' | |
859 | 2 |
|
859 | 2 | |
860 | $ log 'author("re:bob|test")' |
|
860 | $ log 'author("re:bob|test")' | |
861 | 0 |
|
861 | 0 | |
862 | 1 |
|
862 | 1 | |
863 | 2 |
|
863 | 2 | |
864 | 3 |
|
864 | 3 | |
865 | 4 |
|
865 | 4 | |
866 | 5 |
|
866 | 5 | |
867 | 6 |
|
867 | 6 | |
868 | 7 |
|
868 | 7 | |
869 | 8 |
|
869 | 8 | |
870 | 9 |
|
870 | 9 | |
871 | $ log 'author(r"re:\S")' |
|
871 | $ log 'author(r"re:\S")' | |
872 | 0 |
|
872 | 0 | |
873 | 1 |
|
873 | 1 | |
874 | 2 |
|
874 | 2 | |
875 | 3 |
|
875 | 3 | |
876 | 4 |
|
876 | 4 | |
877 | 5 |
|
877 | 5 | |
878 | 6 |
|
878 | 6 | |
879 | 7 |
|
879 | 7 | |
880 | 8 |
|
880 | 8 | |
881 | 9 |
|
881 | 9 | |
882 | $ log 'branch(Γ©)' |
|
882 | $ log 'branch(Γ©)' | |
883 | 8 |
|
883 | 8 | |
884 | 9 |
|
884 | 9 | |
885 | $ log 'branch(a)' |
|
885 | $ log 'branch(a)' | |
886 | 0 |
|
886 | 0 | |
887 | $ hg log -r 'branch("re:a")' --template '{rev} {branch}\n' |
|
887 | $ hg log -r 'branch("re:a")' --template '{rev} {branch}\n' | |
888 | 0 a |
|
888 | 0 a | |
889 | 2 a-b-c- |
|
889 | 2 a-b-c- | |
890 | 3 +a+b+c+ |
|
890 | 3 +a+b+c+ | |
891 | 4 -a-b-c- |
|
891 | 4 -a-b-c- | |
892 | 5 !a/b/c/ |
|
892 | 5 !a/b/c/ | |
893 | 6 _a_b_c_ |
|
893 | 6 _a_b_c_ | |
894 | 7 .a.b.c. |
|
894 | 7 .a.b.c. | |
895 | $ log 'children(ancestor(4,5))' |
|
895 | $ log 'children(ancestor(4,5))' | |
896 | 2 |
|
896 | 2 | |
897 | 3 |
|
897 | 3 | |
898 |
|
898 | |||
899 | $ log 'children(4)' |
|
899 | $ log 'children(4)' | |
900 | 6 |
|
900 | 6 | |
901 | 8 |
|
901 | 8 | |
902 | $ log 'children(null)' |
|
902 | $ log 'children(null)' | |
903 | 0 |
|
903 | 0 | |
904 |
|
904 | |||
905 | $ log 'closed()' |
|
905 | $ log 'closed()' | |
906 | $ log 'contains(a)' |
|
906 | $ log 'contains(a)' | |
907 | 0 |
|
907 | 0 | |
908 | 1 |
|
908 | 1 | |
909 | 3 |
|
909 | 3 | |
910 | 5 |
|
910 | 5 | |
911 | $ log 'contains("../repo/a")' |
|
911 | $ log 'contains("../repo/a")' | |
912 | 0 |
|
912 | 0 | |
913 | 1 |
|
913 | 1 | |
914 | 3 |
|
914 | 3 | |
915 | 5 |
|
915 | 5 | |
916 | $ log 'desc(B)' |
|
916 | $ log 'desc(B)' | |
917 | 5 |
|
917 | 5 | |
918 | $ hg log -r 'desc(r"re:S?u")' --template "{rev} {desc|firstline}\n" |
|
918 | $ hg log -r 'desc(r"re:S?u")' --template "{rev} {desc|firstline}\n" | |
919 | 5 5 bug |
|
919 | 5 5 bug | |
920 | 6 6 issue619 |
|
920 | 6 6 issue619 | |
921 | $ log 'descendants(2 or 3)' |
|
921 | $ log 'descendants(2 or 3)' | |
922 | 2 |
|
922 | 2 | |
923 | 3 |
|
923 | 3 | |
924 | 4 |
|
924 | 4 | |
925 | 5 |
|
925 | 5 | |
926 | 6 |
|
926 | 6 | |
927 | 7 |
|
927 | 7 | |
928 | 8 |
|
928 | 8 | |
929 | 9 |
|
929 | 9 | |
930 | $ log 'file("b*")' |
|
930 | $ log 'file("b*")' | |
931 | 1 |
|
931 | 1 | |
932 | 4 |
|
932 | 4 | |
933 | $ log 'filelog("b")' |
|
933 | $ log 'filelog("b")' | |
934 | 1 |
|
934 | 1 | |
935 | 4 |
|
935 | 4 | |
936 | $ log 'filelog("../repo/b")' |
|
936 | $ log 'filelog("../repo/b")' | |
937 | 1 |
|
937 | 1 | |
938 | 4 |
|
938 | 4 | |
939 | $ log 'follow()' |
|
939 | $ log 'follow()' | |
940 | 0 |
|
940 | 0 | |
941 | 1 |
|
941 | 1 | |
942 | 2 |
|
942 | 2 | |
943 | 4 |
|
943 | 4 | |
944 | 8 |
|
944 | 8 | |
945 | 9 |
|
945 | 9 | |
946 | $ log 'grep("issue\d+")' |
|
946 | $ log 'grep("issue\d+")' | |
947 | 6 |
|
947 | 6 | |
948 | $ try 'grep("(")' # invalid regular expression |
|
948 | $ try 'grep("(")' # invalid regular expression | |
949 | (func |
|
949 | (func | |
950 | ('symbol', 'grep') |
|
950 | ('symbol', 'grep') | |
951 | ('string', '(')) |
|
951 | ('string', '(')) | |
952 | hg: parse error: invalid match pattern: unbalanced parenthesis |
|
952 | hg: parse error: invalid match pattern: unbalanced parenthesis | |
953 | [255] |
|
953 | [255] | |
954 | $ try 'grep("\bissue\d+")' |
|
954 | $ try 'grep("\bissue\d+")' | |
955 | (func |
|
955 | (func | |
956 | ('symbol', 'grep') |
|
956 | ('symbol', 'grep') | |
957 | ('string', '\x08issue\\d+')) |
|
957 | ('string', '\x08issue\\d+')) | |
958 | * set: |
|
958 | * set: | |
959 | <filteredset |
|
959 | <filteredset | |
960 | <fullreposet+ 0:10>, |
|
960 | <fullreposet+ 0:10>, | |
961 | <grep '\x08issue\\d+'>> |
|
961 | <grep '\x08issue\\d+'>> | |
962 | $ try 'grep(r"\bissue\d+")' |
|
962 | $ try 'grep(r"\bissue\d+")' | |
963 | (func |
|
963 | (func | |
964 | ('symbol', 'grep') |
|
964 | ('symbol', 'grep') | |
965 | ('string', '\\bissue\\d+')) |
|
965 | ('string', '\\bissue\\d+')) | |
966 | * set: |
|
966 | * set: | |
967 | <filteredset |
|
967 | <filteredset | |
968 | <fullreposet+ 0:10>, |
|
968 | <fullreposet+ 0:10>, | |
969 | <grep '\\bissue\\d+'>> |
|
969 | <grep '\\bissue\\d+'>> | |
970 | 6 |
|
970 | 6 | |
971 | $ try 'grep(r"\")' |
|
971 | $ try 'grep(r"\")' | |
972 | hg: parse error at 7: unterminated string |
|
972 | hg: parse error at 7: unterminated string | |
973 | [255] |
|
973 | [255] | |
974 | $ log 'head()' |
|
974 | $ log 'head()' | |
975 | 0 |
|
975 | 0 | |
976 | 1 |
|
976 | 1 | |
977 | 2 |
|
977 | 2 | |
978 | 3 |
|
978 | 3 | |
979 | 4 |
|
979 | 4 | |
980 | 5 |
|
980 | 5 | |
981 | 6 |
|
981 | 6 | |
982 | 7 |
|
982 | 7 | |
983 | 9 |
|
983 | 9 | |
984 | $ log 'heads(6::)' |
|
984 | $ log 'heads(6::)' | |
985 | 7 |
|
985 | 7 | |
986 | $ log 'keyword(issue)' |
|
986 | $ log 'keyword(issue)' | |
987 | 6 |
|
987 | 6 | |
988 | $ log 'keyword("test a")' |
|
988 | $ log 'keyword("test a")' | |
989 |
|
989 | |||
990 | Test first (=limit) and last |
|
990 | Test first (=limit) and last | |
991 |
|
991 | |||
992 | $ log 'limit(head(), 1)' |
|
992 | $ log 'limit(head(), 1)' | |
993 | 0 |
|
993 | 0 | |
994 | $ log 'limit(author("re:bob|test"), 3, 5)' |
|
994 | $ log 'limit(author("re:bob|test"), 3, 5)' | |
995 | 5 |
|
995 | 5 | |
996 | 6 |
|
996 | 6 | |
997 | 7 |
|
997 | 7 | |
998 | $ log 'limit(author("re:bob|test"), offset=6)' |
|
998 | $ log 'limit(author("re:bob|test"), offset=6)' | |
999 | 6 |
|
999 | 6 | |
1000 | $ log 'limit(author("re:bob|test"), offset=10)' |
|
1000 | $ log 'limit(author("re:bob|test"), offset=10)' | |
1001 | $ log 'limit(all(), 1, -1)' |
|
1001 | $ log 'limit(all(), 1, -1)' | |
1002 | hg: parse error: negative offset |
|
1002 | hg: parse error: negative offset | |
1003 | [255] |
|
1003 | [255] | |
1004 | $ log 'limit(all(), -1)' |
|
1004 | $ log 'limit(all(), -1)' | |
1005 | hg: parse error: negative number to select |
|
1005 | hg: parse error: negative number to select | |
1006 | [255] |
|
1006 | [255] | |
1007 | $ log 'limit(all(), 0)' |
|
1007 | $ log 'limit(all(), 0)' | |
1008 |
|
1008 | |||
1009 | $ log 'last(all(), -1)' |
|
1009 | $ log 'last(all(), -1)' | |
1010 | hg: parse error: negative number to select |
|
1010 | hg: parse error: negative number to select | |
1011 | [255] |
|
1011 | [255] | |
1012 | $ log 'last(all(), 0)' |
|
1012 | $ log 'last(all(), 0)' | |
1013 | $ log 'last(all(), 1)' |
|
1013 | $ log 'last(all(), 1)' | |
1014 | 9 |
|
1014 | 9 | |
1015 | $ log 'last(all(), 2)' |
|
1015 | $ log 'last(all(), 2)' | |
1016 | 8 |
|
1016 | 8 | |
1017 | 9 |
|
1017 | 9 | |
1018 |
|
1018 | |||
1019 | Test smartset.slice() by first/last() |
|
1019 | Test smartset.slice() by first/last() | |
1020 |
|
1020 | |||
1021 | (using unoptimized set, filteredset as example) |
|
1021 | (using unoptimized set, filteredset as example) | |
1022 |
|
1022 | |||
1023 | $ hg debugrevspec --no-show-revs -s '0:7 & branch("re:")' |
|
1023 | $ hg debugrevspec --no-show-revs -s '0:7 & branch("re:")' | |
1024 | * set: |
|
1024 | * set: | |
1025 | <filteredset |
|
1025 | <filteredset | |
1026 | <spanset+ 0:8>, |
|
1026 | <spanset+ 0:8>, | |
1027 | <branch 're:'>> |
|
1027 | <branch 're:'>> | |
1028 | $ log 'limit(0:7 & branch("re:"), 3, 4)' |
|
1028 | $ log 'limit(0:7 & branch("re:"), 3, 4)' | |
1029 | 4 |
|
1029 | 4 | |
1030 | 5 |
|
1030 | 5 | |
1031 | 6 |
|
1031 | 6 | |
1032 | $ log 'limit(7:0 & branch("re:"), 3, 4)' |
|
1032 | $ log 'limit(7:0 & branch("re:"), 3, 4)' | |
1033 | 3 |
|
1033 | 3 | |
1034 | 2 |
|
1034 | 2 | |
1035 | 1 |
|
1035 | 1 | |
1036 | $ log 'last(0:7 & branch("re:"), 2)' |
|
1036 | $ log 'last(0:7 & branch("re:"), 2)' | |
1037 | 6 |
|
1037 | 6 | |
1038 | 7 |
|
1038 | 7 | |
1039 |
|
1039 | |||
1040 | (using baseset) |
|
1040 | (using baseset) | |
1041 |
|
1041 | |||
1042 | $ hg debugrevspec --no-show-revs -s 0+1+2+3+4+5+6+7 |
|
1042 | $ hg debugrevspec --no-show-revs -s 0+1+2+3+4+5+6+7 | |
1043 | * set: |
|
1043 | * set: | |
1044 | <baseset [0, 1, 2, 3, 4, 5, 6, 7]> |
|
1044 | <baseset [0, 1, 2, 3, 4, 5, 6, 7]> | |
1045 | $ hg debugrevspec --no-show-revs -s 0::7 |
|
1045 | $ hg debugrevspec --no-show-revs -s 0::7 | |
1046 | * set: |
|
1046 | * set: | |
1047 | <baseset+ [0, 1, 2, 3, 4, 5, 6, 7]> |
|
1047 | <baseset+ [0, 1, 2, 3, 4, 5, 6, 7]> | |
1048 | $ log 'limit(0+1+2+3+4+5+6+7, 3, 4)' |
|
1048 | $ log 'limit(0+1+2+3+4+5+6+7, 3, 4)' | |
1049 | 4 |
|
1049 | 4 | |
1050 | 5 |
|
1050 | 5 | |
1051 | 6 |
|
1051 | 6 | |
1052 | $ log 'limit(sort(0::7, rev), 3, 4)' |
|
1052 | $ log 'limit(sort(0::7, rev), 3, 4)' | |
1053 | 4 |
|
1053 | 4 | |
1054 | 5 |
|
1054 | 5 | |
1055 | 6 |
|
1055 | 6 | |
1056 | $ log 'limit(sort(0::7, -rev), 3, 4)' |
|
1056 | $ log 'limit(sort(0::7, -rev), 3, 4)' | |
1057 | 3 |
|
1057 | 3 | |
1058 | 2 |
|
1058 | 2 | |
1059 | 1 |
|
1059 | 1 | |
1060 | $ log 'last(sort(0::7, rev), 2)' |
|
1060 | $ log 'last(sort(0::7, rev), 2)' | |
1061 | 6 |
|
1061 | 6 | |
1062 | 7 |
|
1062 | 7 | |
1063 | $ hg debugrevspec -s 'limit(sort(0::7, rev), 3, 6)' |
|
1063 | $ hg debugrevspec -s 'limit(sort(0::7, rev), 3, 6)' | |
1064 | * set: |
|
1064 | * set: | |
1065 | <baseset+ [6, 7]> |
|
1065 | <baseset+ [6, 7]> | |
1066 | 6 |
|
1066 | 6 | |
1067 | 7 |
|
1067 | 7 | |
1068 | $ hg debugrevspec -s 'limit(sort(0::7, rev), 3, 9)' |
|
1068 | $ hg debugrevspec -s 'limit(sort(0::7, rev), 3, 9)' | |
1069 | * set: |
|
1069 | * set: | |
1070 | <baseset+ []> |
|
1070 | <baseset+ []> | |
1071 | $ hg debugrevspec -s 'limit(sort(0::7, -rev), 3, 6)' |
|
1071 | $ hg debugrevspec -s 'limit(sort(0::7, -rev), 3, 6)' | |
1072 | * set: |
|
1072 | * set: | |
1073 | <baseset- [0, 1]> |
|
1073 | <baseset- [0, 1]> | |
1074 | 1 |
|
1074 | 1 | |
1075 | 0 |
|
1075 | 0 | |
1076 | $ hg debugrevspec -s 'limit(sort(0::7, -rev), 3, 9)' |
|
1076 | $ hg debugrevspec -s 'limit(sort(0::7, -rev), 3, 9)' | |
1077 | * set: |
|
1077 | * set: | |
1078 | <baseset- []> |
|
1078 | <baseset- []> | |
1079 | $ hg debugrevspec -s 'limit(0::7, 0)' |
|
1079 | $ hg debugrevspec -s 'limit(0::7, 0)' | |
1080 | * set: |
|
1080 | * set: | |
1081 | <baseset+ []> |
|
1081 | <baseset+ []> | |
1082 |
|
1082 | |||
1083 | (using spanset) |
|
1083 | (using spanset) | |
1084 |
|
1084 | |||
1085 | $ hg debugrevspec --no-show-revs -s 0:7 |
|
1085 | $ hg debugrevspec --no-show-revs -s 0:7 | |
1086 | * set: |
|
1086 | * set: | |
1087 | <spanset+ 0:8> |
|
1087 | <spanset+ 0:8> | |
1088 | $ log 'limit(0:7, 3, 4)' |
|
1088 | $ log 'limit(0:7, 3, 4)' | |
1089 | 4 |
|
1089 | 4 | |
1090 | 5 |
|
1090 | 5 | |
1091 | 6 |
|
1091 | 6 | |
1092 | $ log 'limit(7:0, 3, 4)' |
|
1092 | $ log 'limit(7:0, 3, 4)' | |
1093 | 3 |
|
1093 | 3 | |
1094 | 2 |
|
1094 | 2 | |
1095 | 1 |
|
1095 | 1 | |
1096 | $ log 'limit(0:7, 3, 6)' |
|
1096 | $ log 'limit(0:7, 3, 6)' | |
1097 | 6 |
|
1097 | 6 | |
1098 | 7 |
|
1098 | 7 | |
1099 | $ log 'limit(7:0, 3, 6)' |
|
1099 | $ log 'limit(7:0, 3, 6)' | |
1100 | 1 |
|
1100 | 1 | |
1101 | 0 |
|
1101 | 0 | |
1102 | $ log 'last(0:7, 2)' |
|
1102 | $ log 'last(0:7, 2)' | |
1103 | 6 |
|
1103 | 6 | |
1104 | 7 |
|
1104 | 7 | |
1105 | $ hg debugrevspec -s 'limit(0:7, 3, 6)' |
|
1105 | $ hg debugrevspec -s 'limit(0:7, 3, 6)' | |
1106 | * set: |
|
1106 | * set: | |
1107 | <spanset+ 6:8> |
|
1107 | <spanset+ 6:8> | |
1108 | 6 |
|
1108 | 6 | |
1109 | 7 |
|
1109 | 7 | |
1110 | $ hg debugrevspec -s 'limit(0:7, 3, 9)' |
|
1110 | $ hg debugrevspec -s 'limit(0:7, 3, 9)' | |
1111 | * set: |
|
1111 | * set: | |
1112 | <spanset+ 8:8> |
|
1112 | <spanset+ 8:8> | |
1113 | $ hg debugrevspec -s 'limit(7:0, 3, 6)' |
|
1113 | $ hg debugrevspec -s 'limit(7:0, 3, 6)' | |
1114 | * set: |
|
1114 | * set: | |
1115 | <spanset- 0:2> |
|
1115 | <spanset- 0:2> | |
1116 | 1 |
|
1116 | 1 | |
1117 | 0 |
|
1117 | 0 | |
1118 | $ hg debugrevspec -s 'limit(7:0, 3, 9)' |
|
1118 | $ hg debugrevspec -s 'limit(7:0, 3, 9)' | |
1119 | * set: |
|
1119 | * set: | |
1120 | <spanset- 0:0> |
|
1120 | <spanset- 0:0> | |
1121 | $ hg debugrevspec -s 'limit(0:7, 0)' |
|
1121 | $ hg debugrevspec -s 'limit(0:7, 0)' | |
1122 | * set: |
|
1122 | * set: | |
1123 | <spanset+ 0:0> |
|
1123 | <spanset+ 0:0> | |
1124 |
|
1124 | |||
1125 | Test order of first/last revisions |
|
1125 | Test order of first/last revisions | |
1126 |
|
1126 | |||
1127 | $ hg debugrevspec -s 'first(4:0, 3) & 3:' |
|
1127 | $ hg debugrevspec -s 'first(4:0, 3) & 3:' | |
1128 | * set: |
|
1128 | * set: | |
1129 | <filteredset |
|
1129 | <filteredset | |
1130 | <spanset- 2:5>, |
|
1130 | <spanset- 2:5>, | |
1131 | <spanset+ 3:10>> |
|
1131 | <spanset+ 3:10>> | |
1132 | 4 |
|
1132 | 4 | |
1133 | 3 |
|
1133 | 3 | |
1134 |
|
1134 | |||
1135 | $ hg debugrevspec -s '3: & first(4:0, 3)' |
|
1135 | $ hg debugrevspec -s '3: & first(4:0, 3)' | |
1136 | * set: |
|
1136 | * set: | |
1137 | <filteredset |
|
1137 | <filteredset | |
1138 | <spanset+ 3:10>, |
|
1138 | <spanset+ 3:10>, | |
1139 | <spanset- 2:5>> |
|
1139 | <spanset- 2:5>> | |
1140 | 3 |
|
1140 | 3 | |
1141 | 4 |
|
1141 | 4 | |
1142 |
|
1142 | |||
1143 | $ hg debugrevspec -s 'last(4:0, 3) & :1' |
|
1143 | $ hg debugrevspec -s 'last(4:0, 3) & :1' | |
1144 | * set: |
|
1144 | * set: | |
1145 | <filteredset |
|
1145 | <filteredset | |
1146 | <spanset- 0:3>, |
|
1146 | <spanset- 0:3>, | |
1147 | <spanset+ 0:2>> |
|
1147 | <spanset+ 0:2>> | |
1148 | 1 |
|
1148 | 1 | |
1149 | 0 |
|
1149 | 0 | |
1150 |
|
1150 | |||
1151 | $ hg debugrevspec -s ':1 & last(4:0, 3)' |
|
1151 | $ hg debugrevspec -s ':1 & last(4:0, 3)' | |
1152 | * set: |
|
1152 | * set: | |
1153 | <filteredset |
|
1153 | <filteredset | |
1154 | <spanset+ 0:2>, |
|
1154 | <spanset+ 0:2>, | |
1155 | <spanset+ 0:3>> |
|
1155 | <spanset+ 0:3>> | |
1156 | 0 |
|
1156 | 0 | |
1157 | 1 |
|
1157 | 1 | |
1158 |
|
1158 | |||
1159 | Test matching |
|
1159 | Test matching | |
1160 |
|
1160 | |||
1161 | $ log 'matching(6)' |
|
1161 | $ log 'matching(6)' | |
1162 | 6 |
|
1162 | 6 | |
1163 | $ log 'matching(6:7, "phase parents user date branch summary files description substate")' |
|
1163 | $ log 'matching(6:7, "phase parents user date branch summary files description substate")' | |
1164 | 6 |
|
1164 | 6 | |
1165 | 7 |
|
1165 | 7 | |
1166 |
|
1166 | |||
1167 | Testing min and max |
|
1167 | Testing min and max | |
1168 |
|
1168 | |||
1169 | max: simple |
|
1169 | max: simple | |
1170 |
|
1170 | |||
1171 | $ log 'max(contains(a))' |
|
1171 | $ log 'max(contains(a))' | |
1172 | 5 |
|
1172 | 5 | |
1173 |
|
1173 | |||
1174 | max: simple on unordered set) |
|
1174 | max: simple on unordered set) | |
1175 |
|
1175 | |||
1176 | $ log 'max((4+0+2+5+7) and contains(a))' |
|
1176 | $ log 'max((4+0+2+5+7) and contains(a))' | |
1177 | 5 |
|
1177 | 5 | |
1178 |
|
1178 | |||
1179 | max: no result |
|
1179 | max: no result | |
1180 |
|
1180 | |||
1181 | $ log 'max(contains(stringthatdoesnotappearanywhere))' |
|
1181 | $ log 'max(contains(stringthatdoesnotappearanywhere))' | |
1182 |
|
1182 | |||
1183 | max: no result on unordered set |
|
1183 | max: no result on unordered set | |
1184 |
|
1184 | |||
1185 | $ log 'max((4+0+2+5+7) and contains(stringthatdoesnotappearanywhere))' |
|
1185 | $ log 'max((4+0+2+5+7) and contains(stringthatdoesnotappearanywhere))' | |
1186 |
|
1186 | |||
1187 | min: simple |
|
1187 | min: simple | |
1188 |
|
1188 | |||
1189 | $ log 'min(contains(a))' |
|
1189 | $ log 'min(contains(a))' | |
1190 | 0 |
|
1190 | 0 | |
1191 |
|
1191 | |||
1192 | min: simple on unordered set |
|
1192 | min: simple on unordered set | |
1193 |
|
1193 | |||
1194 | $ log 'min((4+0+2+5+7) and contains(a))' |
|
1194 | $ log 'min((4+0+2+5+7) and contains(a))' | |
1195 | 0 |
|
1195 | 0 | |
1196 |
|
1196 | |||
1197 | min: empty |
|
1197 | min: empty | |
1198 |
|
1198 | |||
1199 | $ log 'min(contains(stringthatdoesnotappearanywhere))' |
|
1199 | $ log 'min(contains(stringthatdoesnotappearanywhere))' | |
1200 |
|
1200 | |||
1201 | min: empty on unordered set |
|
1201 | min: empty on unordered set | |
1202 |
|
1202 | |||
1203 | $ log 'min((4+0+2+5+7) and contains(stringthatdoesnotappearanywhere))' |
|
1203 | $ log 'min((4+0+2+5+7) and contains(stringthatdoesnotappearanywhere))' | |
1204 |
|
1204 | |||
1205 |
|
1205 | |||
1206 | $ log 'merge()' |
|
1206 | $ log 'merge()' | |
1207 | 6 |
|
1207 | 6 | |
1208 | $ log 'branchpoint()' |
|
1208 | $ log 'branchpoint()' | |
1209 | 1 |
|
1209 | 1 | |
1210 | 4 |
|
1210 | 4 | |
1211 | $ log 'modifies(b)' |
|
1211 | $ log 'modifies(b)' | |
1212 | 4 |
|
1212 | 4 | |
1213 | $ log 'modifies("path:b")' |
|
1213 | $ log 'modifies("path:b")' | |
1214 | 4 |
|
1214 | 4 | |
1215 | $ log 'modifies("*")' |
|
1215 | $ log 'modifies("*")' | |
1216 | 4 |
|
1216 | 4 | |
1217 | 6 |
|
1217 | 6 | |
1218 | $ log 'modifies("set:modified()")' |
|
1218 | $ log 'modifies("set:modified()")' | |
1219 | 4 |
|
1219 | 4 | |
1220 | $ log 'id(5)' |
|
1220 | $ log 'id(5)' | |
1221 | 2 |
|
1221 | 2 | |
1222 | $ log 'only(9)' |
|
1222 | $ log 'only(9)' | |
1223 | 8 |
|
1223 | 8 | |
1224 | 9 |
|
1224 | 9 | |
1225 | $ log 'only(8)' |
|
1225 | $ log 'only(8)' | |
1226 | 8 |
|
1226 | 8 | |
1227 | $ log 'only(9, 5)' |
|
1227 | $ log 'only(9, 5)' | |
1228 | 2 |
|
1228 | 2 | |
1229 | 4 |
|
1229 | 4 | |
1230 | 8 |
|
1230 | 8 | |
1231 | 9 |
|
1231 | 9 | |
1232 | $ log 'only(7 + 9, 5 + 2)' |
|
1232 | $ log 'only(7 + 9, 5 + 2)' | |
1233 | 4 |
|
1233 | 4 | |
1234 | 6 |
|
1234 | 6 | |
1235 | 7 |
|
1235 | 7 | |
1236 | 8 |
|
1236 | 8 | |
1237 | 9 |
|
1237 | 9 | |
1238 |
|
1238 | |||
1239 | Test empty set input |
|
1239 | Test empty set input | |
1240 | $ log 'only(p2())' |
|
1240 | $ log 'only(p2())' | |
1241 | $ log 'only(p1(), p2())' |
|
1241 | $ log 'only(p1(), p2())' | |
1242 | 0 |
|
1242 | 0 | |
1243 | 1 |
|
1243 | 1 | |
1244 | 2 |
|
1244 | 2 | |
1245 | 4 |
|
1245 | 4 | |
1246 | 8 |
|
1246 | 8 | |
1247 | 9 |
|
1247 | 9 | |
1248 |
|
1248 | |||
1249 | Test '%' operator |
|
1249 | Test '%' operator | |
1250 |
|
1250 | |||
1251 | $ log '9%' |
|
1251 | $ log '9%' | |
1252 | 8 |
|
1252 | 8 | |
1253 | 9 |
|
1253 | 9 | |
1254 | $ log '9%5' |
|
1254 | $ log '9%5' | |
1255 | 2 |
|
1255 | 2 | |
1256 | 4 |
|
1256 | 4 | |
1257 | 8 |
|
1257 | 8 | |
1258 | 9 |
|
1258 | 9 | |
1259 | $ log '(7 + 9)%(5 + 2)' |
|
1259 | $ log '(7 + 9)%(5 + 2)' | |
1260 | 4 |
|
1260 | 4 | |
1261 | 6 |
|
1261 | 6 | |
1262 | 7 |
|
1262 | 7 | |
1263 | 8 |
|
1263 | 8 | |
1264 | 9 |
|
1264 | 9 | |
1265 |
|
1265 | |||
1266 | Test operand of '%' is optimized recursively (issue4670) |
|
1266 | Test operand of '%' is optimized recursively (issue4670) | |
1267 |
|
1267 | |||
1268 | $ try --optimize '8:9-8%' |
|
1268 | $ try --optimize '8:9-8%' | |
1269 | (onlypost |
|
1269 | (onlypost | |
1270 | (minus |
|
1270 | (minus | |
1271 | (range |
|
1271 | (range | |
1272 | ('symbol', '8') |
|
1272 | ('symbol', '8') | |
1273 | ('symbol', '9')) |
|
1273 | ('symbol', '9')) | |
1274 | ('symbol', '8'))) |
|
1274 | ('symbol', '8'))) | |
1275 | * optimized: |
|
1275 | * optimized: | |
1276 | (func |
|
1276 | (func | |
1277 | ('symbol', 'only') |
|
1277 | ('symbol', 'only') | |
1278 | (difference |
|
1278 | (difference | |
1279 | (range |
|
1279 | (range | |
1280 | ('symbol', '8') |
|
1280 | ('symbol', '8') | |
1281 | ('symbol', '9') |
|
1281 | ('symbol', '9') | |
1282 | define) |
|
1282 | define) | |
1283 | ('symbol', '8') |
|
1283 | ('symbol', '8') | |
1284 | define) |
|
1284 | define) | |
1285 | define) |
|
1285 | define) | |
1286 | * set: |
|
1286 | * set: | |
1287 | <baseset+ [8, 9]> |
|
1287 | <baseset+ [8, 9]> | |
1288 | 8 |
|
1288 | 8 | |
1289 | 9 |
|
1289 | 9 | |
1290 | $ try --optimize '(9)%(5)' |
|
1290 | $ try --optimize '(9)%(5)' | |
1291 | (only |
|
1291 | (only | |
1292 | (group |
|
1292 | (group | |
1293 | ('symbol', '9')) |
|
1293 | ('symbol', '9')) | |
1294 | (group |
|
1294 | (group | |
1295 | ('symbol', '5'))) |
|
1295 | ('symbol', '5'))) | |
1296 | * optimized: |
|
1296 | * optimized: | |
1297 | (func |
|
1297 | (func | |
1298 | ('symbol', 'only') |
|
1298 | ('symbol', 'only') | |
1299 | (list |
|
1299 | (list | |
1300 | ('symbol', '9') |
|
1300 | ('symbol', '9') | |
1301 | ('symbol', '5')) |
|
1301 | ('symbol', '5')) | |
1302 | define) |
|
1302 | define) | |
1303 | * set: |
|
1303 | * set: | |
1304 | <baseset+ [2, 4, 8, 9]> |
|
1304 | <baseset+ [2, 4, 8, 9]> | |
1305 | 2 |
|
1305 | 2 | |
1306 | 4 |
|
1306 | 4 | |
1307 | 8 |
|
1307 | 8 | |
1308 | 9 |
|
1308 | 9 | |
1309 |
|
1309 | |||
1310 | Test the order of operations |
|
1310 | Test the order of operations | |
1311 |
|
1311 | |||
1312 | $ log '7 + 9%5 + 2' |
|
1312 | $ log '7 + 9%5 + 2' | |
1313 | 7 |
|
1313 | 7 | |
1314 | 2 |
|
1314 | 2 | |
1315 | 4 |
|
1315 | 4 | |
1316 | 8 |
|
1316 | 8 | |
1317 | 9 |
|
1317 | 9 | |
1318 |
|
1318 | |||
1319 | Test explicit numeric revision |
|
1319 | Test explicit numeric revision | |
1320 | $ log 'rev(-2)' |
|
1320 | $ log 'rev(-2)' | |
1321 | $ log 'rev(-1)' |
|
1321 | $ log 'rev(-1)' | |
1322 | -1 |
|
1322 | -1 | |
1323 | $ log 'rev(0)' |
|
1323 | $ log 'rev(0)' | |
1324 | 0 |
|
1324 | 0 | |
1325 | $ log 'rev(9)' |
|
1325 | $ log 'rev(9)' | |
1326 | 9 |
|
1326 | 9 | |
1327 | $ log 'rev(10)' |
|
1327 | $ log 'rev(10)' | |
1328 | $ log 'rev(tip)' |
|
1328 | $ log 'rev(tip)' | |
1329 | hg: parse error: rev expects a number |
|
1329 | hg: parse error: rev expects a number | |
1330 | [255] |
|
1330 | [255] | |
1331 |
|
1331 | |||
1332 | Test hexadecimal revision |
|
1332 | Test hexadecimal revision | |
1333 | $ log 'id(2)' |
|
1333 | $ log 'id(2)' | |
1334 | abort: 00changelog.i@2: ambiguous identifier! |
|
1334 | abort: 00changelog.i@2: ambiguous identifier! | |
1335 | [255] |
|
1335 | [255] | |
1336 | $ log 'id(23268)' |
|
1336 | $ log 'id(23268)' | |
1337 | 4 |
|
1337 | 4 | |
1338 | $ log 'id(2785f51eece)' |
|
1338 | $ log 'id(2785f51eece)' | |
1339 | 0 |
|
1339 | 0 | |
1340 | $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532c)' |
|
1340 | $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532c)' | |
1341 | 8 |
|
1341 | 8 | |
1342 | $ log 'id(d5d0dcbdc4a)' |
|
1342 | $ log 'id(d5d0dcbdc4a)' | |
1343 | $ log 'id(d5d0dcbdc4w)' |
|
1343 | $ log 'id(d5d0dcbdc4w)' | |
1344 | $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532d)' |
|
1344 | $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532d)' | |
1345 | $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532q)' |
|
1345 | $ log 'id(d5d0dcbdc4d9ff5dbb2d336f32f0bb561c1a532q)' | |
1346 | $ log 'id(1.0)' |
|
1346 | $ log 'id(1.0)' | |
1347 | $ log 'id(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)' |
|
1347 | $ log 'id(xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)' | |
1348 |
|
1348 | |||
1349 | Test null revision |
|
1349 | Test null revision | |
1350 | $ log '(null)' |
|
1350 | $ log '(null)' | |
1351 | -1 |
|
1351 | -1 | |
1352 | $ log '(null:0)' |
|
1352 | $ log '(null:0)' | |
1353 | -1 |
|
1353 | -1 | |
1354 | 0 |
|
1354 | 0 | |
1355 | $ log '(0:null)' |
|
1355 | $ log '(0:null)' | |
1356 | 0 |
|
1356 | 0 | |
1357 | -1 |
|
1357 | -1 | |
1358 | $ log 'null::0' |
|
1358 | $ log 'null::0' | |
1359 | -1 |
|
1359 | -1 | |
1360 | 0 |
|
1360 | 0 | |
1361 | $ log 'null:tip - 0:' |
|
1361 | $ log 'null:tip - 0:' | |
1362 | -1 |
|
1362 | -1 | |
1363 | $ log 'null: and null::' | head -1 |
|
1363 | $ log 'null: and null::' | head -1 | |
1364 | -1 |
|
1364 | -1 | |
1365 | $ log 'null: or 0:' | head -2 |
|
1365 | $ log 'null: or 0:' | head -2 | |
1366 | -1 |
|
1366 | -1 | |
1367 | 0 |
|
1367 | 0 | |
1368 | $ log 'ancestors(null)' |
|
1368 | $ log 'ancestors(null)' | |
1369 | -1 |
|
1369 | -1 | |
1370 | $ log 'reverse(null:)' | tail -2 |
|
1370 | $ log 'reverse(null:)' | tail -2 | |
1371 | 0 |
|
1371 | 0 | |
1372 | -1 |
|
1372 | -1 | |
1373 | $ log 'first(null:)' |
|
1373 | $ log 'first(null:)' | |
1374 | -1 |
|
1374 | -1 | |
1375 | $ log 'min(null:)' |
|
1375 | $ log 'min(null:)' | |
1376 | BROKEN: should be '-1' |
|
1376 | BROKEN: should be '-1' | |
1377 | $ log 'tip:null and all()' | tail -2 |
|
1377 | $ log 'tip:null and all()' | tail -2 | |
1378 | 1 |
|
1378 | 1 | |
1379 | 0 |
|
1379 | 0 | |
1380 |
|
1380 | |||
1381 | Test working-directory revision |
|
1381 | Test working-directory revision | |
1382 | $ hg debugrevspec 'wdir()' |
|
1382 | $ hg debugrevspec 'wdir()' | |
1383 | 2147483647 |
|
1383 | 2147483647 | |
1384 | $ hg debugrevspec 'wdir()^' |
|
1384 | $ hg debugrevspec 'wdir()^' | |
1385 | 9 |
|
1385 | 9 | |
1386 | $ hg up 7 |
|
1386 | $ hg up 7 | |
1387 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1387 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1388 | $ hg debugrevspec 'wdir()^' |
|
1388 | $ hg debugrevspec 'wdir()^' | |
1389 | 7 |
|
1389 | 7 | |
1390 | $ hg debugrevspec 'wdir()^0' |
|
1390 | $ hg debugrevspec 'wdir()^0' | |
1391 | 2147483647 |
|
1391 | 2147483647 | |
1392 | $ hg debugrevspec 'wdir()~3' |
|
1392 | $ hg debugrevspec 'wdir()~3' | |
1393 | 5 |
|
1393 | 5 | |
1394 | $ hg debugrevspec 'ancestors(wdir())' |
|
1394 | $ hg debugrevspec 'ancestors(wdir())' | |
1395 | 0 |
|
1395 | 0 | |
1396 | 1 |
|
1396 | 1 | |
1397 | 2 |
|
1397 | 2 | |
1398 | 3 |
|
1398 | 3 | |
1399 | 4 |
|
1399 | 4 | |
1400 | 5 |
|
1400 | 5 | |
1401 | 6 |
|
1401 | 6 | |
1402 | 7 |
|
1402 | 7 | |
1403 | 2147483647 |
|
1403 | 2147483647 | |
1404 | $ hg debugrevspec 'wdir()~0' |
|
1404 | $ hg debugrevspec 'wdir()~0' | |
1405 | 2147483647 |
|
1405 | 2147483647 | |
1406 | $ hg debugrevspec 'p1(wdir())' |
|
1406 | $ hg debugrevspec 'p1(wdir())' | |
1407 | 7 |
|
1407 | 7 | |
1408 | $ hg debugrevspec 'p2(wdir())' |
|
1408 | $ hg debugrevspec 'p2(wdir())' | |
1409 | $ hg debugrevspec 'parents(wdir())' |
|
1409 | $ hg debugrevspec 'parents(wdir())' | |
1410 | 7 |
|
1410 | 7 | |
1411 | $ hg debugrevspec 'wdir()^1' |
|
1411 | $ hg debugrevspec 'wdir()^1' | |
1412 | 7 |
|
1412 | 7 | |
1413 | $ hg debugrevspec 'wdir()^2' |
|
1413 | $ hg debugrevspec 'wdir()^2' | |
1414 | $ hg debugrevspec 'wdir()^3' |
|
1414 | $ hg debugrevspec 'wdir()^3' | |
1415 | hg: parse error: ^ expects a number 0, 1, or 2 |
|
1415 | hg: parse error: ^ expects a number 0, 1, or 2 | |
1416 | [255] |
|
1416 | [255] | |
1417 | For tests consistency |
|
1417 | For tests consistency | |
1418 | $ hg up 9 |
|
1418 | $ hg up 9 | |
1419 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1419 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1420 | $ hg debugrevspec 'tip or wdir()' |
|
1420 | $ hg debugrevspec 'tip or wdir()' | |
1421 | 9 |
|
1421 | 9 | |
1422 | 2147483647 |
|
1422 | 2147483647 | |
1423 | $ hg debugrevspec '0:tip and wdir()' |
|
1423 | $ hg debugrevspec '0:tip and wdir()' | |
1424 | $ log '0:wdir()' | tail -3 |
|
1424 | $ log '0:wdir()' | tail -3 | |
1425 | 8 |
|
1425 | 8 | |
1426 | 9 |
|
1426 | 9 | |
1427 | 2147483647 |
|
1427 | 2147483647 | |
1428 | $ log 'wdir():0' | head -3 |
|
1428 | $ log 'wdir():0' | head -3 | |
1429 | 2147483647 |
|
1429 | 2147483647 | |
1430 | 9 |
|
1430 | 9 | |
1431 | 8 |
|
1431 | 8 | |
1432 | $ log 'wdir():wdir()' |
|
1432 | $ log 'wdir():wdir()' | |
1433 | 2147483647 |
|
1433 | 2147483647 | |
1434 | $ log '(all() + wdir()) & min(. + wdir())' |
|
1434 | $ log '(all() + wdir()) & min(. + wdir())' | |
1435 | 9 |
|
1435 | 9 | |
1436 | $ log '(all() + wdir()) & max(. + wdir())' |
|
1436 | $ log '(all() + wdir()) & max(. + wdir())' | |
1437 | 2147483647 |
|
1437 | 2147483647 | |
1438 | $ log 'first(wdir() + .)' |
|
1438 | $ log 'first(wdir() + .)' | |
1439 | 2147483647 |
|
1439 | 2147483647 | |
1440 | $ log 'last(. + wdir())' |
|
1440 | $ log 'last(. + wdir())' | |
1441 | 2147483647 |
|
1441 | 2147483647 | |
1442 |
|
1442 | |||
1443 | Test working-directory integer revision and node id |
|
1443 | Test working-directory integer revision and node id | |
1444 | (BUG: '0:wdir()' is still needed to populate wdir revision) |
|
1444 | (BUG: '0:wdir()' is still needed to populate wdir revision) | |
1445 |
|
1445 | |||
1446 | $ hg debugrevspec '0:wdir() & 2147483647' |
|
1446 | $ hg debugrevspec '0:wdir() & 2147483647' | |
1447 | 2147483647 |
|
1447 | 2147483647 | |
1448 | $ hg debugrevspec '0:wdir() & rev(2147483647)' |
|
1448 | $ hg debugrevspec '0:wdir() & rev(2147483647)' | |
1449 | 2147483647 |
|
1449 | 2147483647 | |
1450 | $ hg debugrevspec '0:wdir() & ffffffffffffffffffffffffffffffffffffffff' |
|
1450 | $ hg debugrevspec '0:wdir() & ffffffffffffffffffffffffffffffffffffffff' | |
1451 | 2147483647 |
|
1451 | 2147483647 | |
1452 | $ hg debugrevspec '0:wdir() & ffffffffffff' |
|
1452 | $ hg debugrevspec '0:wdir() & ffffffffffff' | |
1453 | 2147483647 |
|
1453 | 2147483647 | |
1454 | $ hg debugrevspec '0:wdir() & id(ffffffffffffffffffffffffffffffffffffffff)' |
|
1454 | $ hg debugrevspec '0:wdir() & id(ffffffffffffffffffffffffffffffffffffffff)' | |
1455 | 2147483647 |
|
1455 | 2147483647 | |
1456 | $ hg debugrevspec '0:wdir() & id(ffffffffffff)' |
|
1456 | $ hg debugrevspec '0:wdir() & id(ffffffffffff)' | |
1457 | 2147483647 |
|
1457 | 2147483647 | |
1458 |
|
1458 | |||
1459 | $ cd .. |
|
1459 | $ cd .. | |
1460 |
|
1460 | |||
1461 | Test short 'ff...' hash collision |
|
1461 | Test short 'ff...' hash collision | |
1462 | (BUG: '0:wdir()' is still needed to populate wdir revision) |
|
1462 | (BUG: '0:wdir()' is still needed to populate wdir revision) | |
1463 |
|
1463 | |||
1464 | $ hg init wdir-hashcollision |
|
1464 | $ hg init wdir-hashcollision | |
1465 | $ cd wdir-hashcollision |
|
1465 | $ cd wdir-hashcollision | |
1466 | $ cat <<EOF >> .hg/hgrc |
|
1466 | $ cat <<EOF >> .hg/hgrc | |
1467 | > [experimental] |
|
1467 | > [experimental] | |
1468 | > evolution = createmarkers |
|
1468 | > evolution = createmarkers | |
1469 | > EOF |
|
1469 | > EOF | |
1470 | $ echo 0 > a |
|
1470 | $ echo 0 > a | |
1471 | $ hg ci -qAm 0 |
|
1471 | $ hg ci -qAm 0 | |
1472 | $ for i in 2463 2961 6726 78127; do |
|
1472 | $ for i in 2463 2961 6726 78127; do | |
1473 | > hg up -q 0 |
|
1473 | > hg up -q 0 | |
1474 | > echo $i > a |
|
1474 | > echo $i > a | |
1475 | > hg ci -qm $i |
|
1475 | > hg ci -qm $i | |
1476 | > done |
|
1476 | > done | |
1477 | $ hg up -q null |
|
1477 | $ hg up -q null | |
1478 | $ hg log -r '0:wdir()' -T '{rev}:{node} {shortest(node, 3)}\n' |
|
1478 | $ hg log -r '0:wdir()' -T '{rev}:{node} {shortest(node, 3)}\n' | |
1479 | 0:b4e73ffab476aa0ee32ed81ca51e07169844bc6a b4e |
|
1479 | 0:b4e73ffab476aa0ee32ed81ca51e07169844bc6a b4e | |
1480 | 1:fffbae3886c8fbb2114296380d276fd37715d571 fffba |
|
1480 | 1:fffbae3886c8fbb2114296380d276fd37715d571 fffba | |
1481 | 2:fffb6093b00943f91034b9bdad069402c834e572 fffb6 |
|
1481 | 2:fffb6093b00943f91034b9bdad069402c834e572 fffb6 | |
1482 | 3:fff48a9b9de34a4d64120c29548214c67980ade3 fff4 |
|
1482 | 3:fff48a9b9de34a4d64120c29548214c67980ade3 fff4 | |
1483 | 4:ffff85cff0ff78504fcdc3c0bc10de0c65379249 ffff8 |
|
1483 | 4:ffff85cff0ff78504fcdc3c0bc10de0c65379249 ffff8 | |
1484 | 2147483647:ffffffffffffffffffffffffffffffffffffffff fffff |
|
1484 | 2147483647:ffffffffffffffffffffffffffffffffffffffff fffff | |
1485 | $ hg debugobsolete fffbae3886c8fbb2114296380d276fd37715d571 |
|
1485 | $ hg debugobsolete fffbae3886c8fbb2114296380d276fd37715d571 | |
1486 |
|
1486 | |||
1487 | $ hg debugrevspec '0:wdir() & fff' |
|
1487 | $ hg debugrevspec '0:wdir() & fff' | |
1488 | abort: 00changelog.i@fff: ambiguous identifier! |
|
1488 | abort: 00changelog.i@fff: ambiguous identifier! | |
1489 | [255] |
|
1489 | [255] | |
1490 | $ hg debugrevspec '0:wdir() & ffff' |
|
1490 | $ hg debugrevspec '0:wdir() & ffff' | |
1491 | abort: 00changelog.i@ffff: ambiguous identifier! |
|
1491 | abort: 00changelog.i@ffff: ambiguous identifier! | |
1492 | [255] |
|
1492 | [255] | |
1493 | $ hg debugrevspec '0:wdir() & fffb' |
|
1493 | $ hg debugrevspec '0:wdir() & fffb' | |
1494 | abort: 00changelog.i@fffb: ambiguous identifier! |
|
1494 | abort: 00changelog.i@fffb: ambiguous identifier! | |
1495 | [255] |
|
1495 | [255] | |
1496 | BROKEN should be '2' (node lookup uses unfiltered repo since dc25ed84bee8) |
|
1496 | BROKEN should be '2' (node lookup uses unfiltered repo since dc25ed84bee8) | |
1497 | $ hg debugrevspec '0:wdir() & id(fffb)' |
|
1497 | $ hg debugrevspec '0:wdir() & id(fffb)' | |
1498 | 2 |
|
1498 | 2 | |
1499 | $ hg debugrevspec '0:wdir() & ffff8' |
|
1499 | $ hg debugrevspec '0:wdir() & ffff8' | |
1500 | 4 |
|
1500 | 4 | |
1501 | $ hg debugrevspec '0:wdir() & fffff' |
|
1501 | $ hg debugrevspec '0:wdir() & fffff' | |
1502 | 2147483647 |
|
1502 | 2147483647 | |
1503 |
|
1503 | |||
1504 | $ cd .. |
|
1504 | $ cd .. | |
1505 |
|
1505 | |||
1506 | Test branch() with wdir() |
|
1506 | Test branch() with wdir() | |
1507 |
|
1507 | |||
1508 | $ cd repo |
|
1508 | $ cd repo | |
1509 |
|
1509 | |||
1510 | $ log '0:wdir() & branch("literal:Γ©")' |
|
1510 | $ log '0:wdir() & branch("literal:Γ©")' | |
1511 | 8 |
|
1511 | 8 | |
1512 | 9 |
|
1512 | 9 | |
1513 | 2147483647 |
|
1513 | 2147483647 | |
1514 | $ log '0:wdir() & branch("re:Γ©")' |
|
1514 | $ log '0:wdir() & branch("re:Γ©")' | |
1515 | 8 |
|
1515 | 8 | |
1516 | 9 |
|
1516 | 9 | |
1517 | 2147483647 |
|
1517 | 2147483647 | |
1518 | $ log '0:wdir() & branch("re:^a")' |
|
1518 | $ log '0:wdir() & branch("re:^a")' | |
1519 | 0 |
|
1519 | 0 | |
1520 | 2 |
|
1520 | 2 | |
1521 | $ log '0:wdir() & branch(8)' |
|
1521 | $ log '0:wdir() & branch(8)' | |
1522 | 8 |
|
1522 | 8 | |
1523 | 9 |
|
1523 | 9 | |
1524 | 2147483647 |
|
1524 | 2147483647 | |
1525 |
|
1525 | |||
1526 | branch(wdir()) returns all revisions belonging to the working branch. The wdir |
|
1526 | branch(wdir()) returns all revisions belonging to the working branch. The wdir | |
1527 | itself isn't returned unless it is explicitly populated. |
|
1527 | itself isn't returned unless it is explicitly populated. | |
1528 |
|
1528 | |||
1529 | $ log 'branch(wdir())' |
|
1529 | $ log 'branch(wdir())' | |
1530 | 8 |
|
1530 | 8 | |
1531 | 9 |
|
1531 | 9 | |
1532 | $ log '0:wdir() & branch(wdir())' |
|
1532 | $ log '0:wdir() & branch(wdir())' | |
1533 | 8 |
|
1533 | 8 | |
1534 | 9 |
|
1534 | 9 | |
1535 | 2147483647 |
|
1535 | 2147483647 | |
1536 |
|
1536 | |||
1537 | $ log 'outgoing()' |
|
1537 | $ log 'outgoing()' | |
1538 | 8 |
|
1538 | 8 | |
1539 | 9 |
|
1539 | 9 | |
1540 | $ log 'outgoing("../remote1")' |
|
1540 | $ log 'outgoing("../remote1")' | |
1541 | 8 |
|
1541 | 8 | |
1542 | 9 |
|
1542 | 9 | |
1543 | $ log 'outgoing("../remote2")' |
|
1543 | $ log 'outgoing("../remote2")' | |
1544 | 3 |
|
1544 | 3 | |
1545 | 5 |
|
1545 | 5 | |
1546 | 6 |
|
1546 | 6 | |
1547 | 7 |
|
1547 | 7 | |
1548 | 9 |
|
1548 | 9 | |
1549 | $ log 'p1(merge())' |
|
1549 | $ log 'p1(merge())' | |
1550 | 5 |
|
1550 | 5 | |
1551 | $ log 'p2(merge())' |
|
1551 | $ log 'p2(merge())' | |
1552 | 4 |
|
1552 | 4 | |
1553 | $ log 'parents(merge())' |
|
1553 | $ log 'parents(merge())' | |
1554 | 4 |
|
1554 | 4 | |
1555 | 5 |
|
1555 | 5 | |
1556 | $ log 'p1(branchpoint())' |
|
1556 | $ log 'p1(branchpoint())' | |
1557 | 0 |
|
1557 | 0 | |
1558 | 2 |
|
1558 | 2 | |
1559 | $ log 'p2(branchpoint())' |
|
1559 | $ log 'p2(branchpoint())' | |
1560 | $ log 'parents(branchpoint())' |
|
1560 | $ log 'parents(branchpoint())' | |
1561 | 0 |
|
1561 | 0 | |
1562 | 2 |
|
1562 | 2 | |
1563 | $ log 'removes(a)' |
|
1563 | $ log 'removes(a)' | |
1564 | 2 |
|
1564 | 2 | |
1565 | 6 |
|
1565 | 6 | |
1566 | $ log 'roots(all())' |
|
1566 | $ log 'roots(all())' | |
1567 | 0 |
|
1567 | 0 | |
1568 | $ log 'reverse(2 or 3 or 4 or 5)' |
|
1568 | $ log 'reverse(2 or 3 or 4 or 5)' | |
1569 | 5 |
|
1569 | 5 | |
1570 | 4 |
|
1570 | 4 | |
1571 | 3 |
|
1571 | 3 | |
1572 | 2 |
|
1572 | 2 | |
1573 | $ log 'reverse(all())' |
|
1573 | $ log 'reverse(all())' | |
1574 | 9 |
|
1574 | 9 | |
1575 | 8 |
|
1575 | 8 | |
1576 | 7 |
|
1576 | 7 | |
1577 | 6 |
|
1577 | 6 | |
1578 | 5 |
|
1578 | 5 | |
1579 | 4 |
|
1579 | 4 | |
1580 | 3 |
|
1580 | 3 | |
1581 | 2 |
|
1581 | 2 | |
1582 | 1 |
|
1582 | 1 | |
1583 | 0 |
|
1583 | 0 | |
1584 | $ log 'reverse(all()) & filelog(b)' |
|
1584 | $ log 'reverse(all()) & filelog(b)' | |
1585 | 4 |
|
1585 | 4 | |
1586 | 1 |
|
1586 | 1 | |
1587 | $ log 'rev(5)' |
|
1587 | $ log 'rev(5)' | |
1588 | 5 |
|
1588 | 5 | |
1589 | $ log 'sort(limit(reverse(all()), 3))' |
|
1589 | $ log 'sort(limit(reverse(all()), 3))' | |
1590 | 7 |
|
1590 | 7 | |
1591 | 8 |
|
1591 | 8 | |
1592 | 9 |
|
1592 | 9 | |
1593 | $ log 'sort(2 or 3 or 4 or 5, date)' |
|
1593 | $ log 'sort(2 or 3 or 4 or 5, date)' | |
1594 | 2 |
|
1594 | 2 | |
1595 | 3 |
|
1595 | 3 | |
1596 | 5 |
|
1596 | 5 | |
1597 | 4 |
|
1597 | 4 | |
1598 | $ log 'tagged()' |
|
1598 | $ log 'tagged()' | |
1599 | 6 |
|
1599 | 6 | |
1600 | $ log 'tag()' |
|
1600 | $ log 'tag()' | |
1601 | 6 |
|
1601 | 6 | |
1602 | $ log 'tag(1.0)' |
|
1602 | $ log 'tag(1.0)' | |
1603 | 6 |
|
1603 | 6 | |
1604 | $ log 'tag(tip)' |
|
1604 | $ log 'tag(tip)' | |
1605 | 9 |
|
1605 | 9 | |
1606 |
|
1606 | |||
1607 | Test order of revisions in compound expression |
|
1607 | Test order of revisions in compound expression | |
1608 | ---------------------------------------------- |
|
1608 | ---------------------------------------------- | |
1609 |
|
1609 | |||
1610 | The general rule is that only the outermost (= leftmost) predicate can |
|
1610 | The general rule is that only the outermost (= leftmost) predicate can | |
1611 | enforce its ordering requirement. The other predicates should take the |
|
1611 | enforce its ordering requirement. The other predicates should take the | |
1612 | ordering defined by it. |
|
1612 | ordering defined by it. | |
1613 |
|
1613 | |||
1614 | 'A & B' should follow the order of 'A': |
|
1614 | 'A & B' should follow the order of 'A': | |
1615 |
|
1615 | |||
1616 | $ log '2:0 & 0::2' |
|
1616 | $ log '2:0 & 0::2' | |
1617 | 2 |
|
1617 | 2 | |
1618 | 1 |
|
1618 | 1 | |
1619 | 0 |
|
1619 | 0 | |
1620 |
|
1620 | |||
1621 | 'head()' combines sets in right order: |
|
1621 | 'head()' combines sets in right order: | |
1622 |
|
1622 | |||
1623 | $ log '2:0 & head()' |
|
1623 | $ log '2:0 & head()' | |
1624 | 2 |
|
1624 | 2 | |
1625 | 1 |
|
1625 | 1 | |
1626 | 0 |
|
1626 | 0 | |
1627 |
|
1627 | |||
1628 | 'x:y' takes ordering parameter into account: |
|
1628 | 'x:y' takes ordering parameter into account: | |
1629 |
|
1629 | |||
1630 | $ try -p optimized '3:0 & 0:3 & not 2:1' |
|
1630 | $ try -p optimized '3:0 & 0:3 & not 2:1' | |
1631 | * optimized: |
|
1631 | * optimized: | |
1632 | (difference |
|
1632 | (difference | |
1633 | (and |
|
1633 | (and | |
1634 | (range |
|
1634 | (range | |
1635 | ('symbol', '3') |
|
1635 | ('symbol', '3') | |
1636 | ('symbol', '0') |
|
1636 | ('symbol', '0') | |
1637 | define) |
|
1637 | define) | |
1638 | (range |
|
1638 | (range | |
1639 | ('symbol', '0') |
|
1639 | ('symbol', '0') | |
1640 | ('symbol', '3') |
|
1640 | ('symbol', '3') | |
1641 | follow) |
|
1641 | follow) | |
1642 | define) |
|
1642 | define) | |
1643 | (range |
|
1643 | (range | |
1644 | ('symbol', '2') |
|
1644 | ('symbol', '2') | |
1645 | ('symbol', '1') |
|
1645 | ('symbol', '1') | |
1646 | any) |
|
1646 | any) | |
1647 | define) |
|
1647 | define) | |
1648 | * set: |
|
1648 | * set: | |
1649 | <filteredset |
|
1649 | <filteredset | |
1650 | <filteredset |
|
1650 | <filteredset | |
1651 | <spanset- 0:4>, |
|
1651 | <spanset- 0:4>, | |
1652 | <spanset+ 0:4>>, |
|
1652 | <spanset+ 0:4>>, | |
1653 | <not |
|
1653 | <not | |
1654 | <spanset+ 1:3>>> |
|
1654 | <spanset+ 1:3>>> | |
1655 | 3 |
|
1655 | 3 | |
1656 | 0 |
|
1656 | 0 | |
1657 |
|
1657 | |||
1658 | 'a + b', which is optimized to '_list(a b)', should take the ordering of |
|
1658 | 'a + b', which is optimized to '_list(a b)', should take the ordering of | |
1659 | the left expression: |
|
1659 | the left expression: | |
1660 |
|
1660 | |||
1661 | $ try --optimize '2:0 & (0 + 1 + 2)' |
|
1661 | $ try --optimize '2:0 & (0 + 1 + 2)' | |
1662 | (and |
|
1662 | (and | |
1663 | (range |
|
1663 | (range | |
1664 | ('symbol', '2') |
|
1664 | ('symbol', '2') | |
1665 | ('symbol', '0')) |
|
1665 | ('symbol', '0')) | |
1666 | (group |
|
1666 | (group | |
1667 | (or |
|
1667 | (or | |
1668 | (list |
|
1668 | (list | |
1669 | ('symbol', '0') |
|
1669 | ('symbol', '0') | |
1670 | ('symbol', '1') |
|
1670 | ('symbol', '1') | |
1671 | ('symbol', '2'))))) |
|
1671 | ('symbol', '2'))))) | |
1672 | * optimized: |
|
1672 | * optimized: | |
1673 | (and |
|
1673 | (and | |
1674 | (range |
|
1674 | (range | |
1675 | ('symbol', '2') |
|
1675 | ('symbol', '2') | |
1676 | ('symbol', '0') |
|
1676 | ('symbol', '0') | |
1677 | define) |
|
1677 | define) | |
1678 | (func |
|
1678 | (func | |
1679 | ('symbol', '_list') |
|
1679 | ('symbol', '_list') | |
1680 | ('string', '0\x001\x002') |
|
1680 | ('string', '0\x001\x002') | |
1681 | follow) |
|
1681 | follow) | |
1682 | define) |
|
1682 | define) | |
1683 | * set: |
|
1683 | * set: | |
1684 | <filteredset |
|
1684 | <filteredset | |
1685 | <spanset- 0:3>, |
|
1685 | <spanset- 0:3>, | |
1686 | <baseset [0, 1, 2]>> |
|
1686 | <baseset [0, 1, 2]>> | |
1687 | 2 |
|
1687 | 2 | |
1688 | 1 |
|
1688 | 1 | |
1689 | 0 |
|
1689 | 0 | |
1690 |
|
1690 | |||
1691 | 'A + B' should take the ordering of the left expression: |
|
1691 | 'A + B' should take the ordering of the left expression: | |
1692 |
|
1692 | |||
1693 | $ try --optimize '2:0 & (0:1 + 2)' |
|
1693 | $ try --optimize '2:0 & (0:1 + 2)' | |
1694 | (and |
|
1694 | (and | |
1695 | (range |
|
1695 | (range | |
1696 | ('symbol', '2') |
|
1696 | ('symbol', '2') | |
1697 | ('symbol', '0')) |
|
1697 | ('symbol', '0')) | |
1698 | (group |
|
1698 | (group | |
1699 | (or |
|
1699 | (or | |
1700 | (list |
|
1700 | (list | |
1701 | (range |
|
1701 | (range | |
1702 | ('symbol', '0') |
|
1702 | ('symbol', '0') | |
1703 | ('symbol', '1')) |
|
1703 | ('symbol', '1')) | |
1704 | ('symbol', '2'))))) |
|
1704 | ('symbol', '2'))))) | |
1705 | * optimized: |
|
1705 | * optimized: | |
1706 | (and |
|
1706 | (and | |
1707 | (range |
|
1707 | (range | |
1708 | ('symbol', '2') |
|
1708 | ('symbol', '2') | |
1709 | ('symbol', '0') |
|
1709 | ('symbol', '0') | |
1710 | define) |
|
1710 | define) | |
1711 | (or |
|
1711 | (or | |
1712 | (list |
|
1712 | (list | |
1713 | ('symbol', '2') |
|
1713 | ('symbol', '2') | |
1714 | (range |
|
1714 | (range | |
1715 | ('symbol', '0') |
|
1715 | ('symbol', '0') | |
1716 | ('symbol', '1') |
|
1716 | ('symbol', '1') | |
1717 | follow)) |
|
1717 | follow)) | |
1718 | follow) |
|
1718 | follow) | |
1719 | define) |
|
1719 | define) | |
1720 | * set: |
|
1720 | * set: | |
1721 | <filteredset |
|
1721 | <filteredset | |
1722 | <spanset- 0:3>, |
|
1722 | <spanset- 0:3>, | |
1723 | <addset |
|
1723 | <addset | |
1724 | <baseset [2]>, |
|
1724 | <baseset [2]>, | |
1725 | <spanset+ 0:2>>> |
|
1725 | <spanset+ 0:2>>> | |
1726 | 2 |
|
1726 | 2 | |
1727 | 1 |
|
1727 | 1 | |
1728 | 0 |
|
1728 | 0 | |
1729 |
|
1729 | |||
1730 | '_intlist(a b)' should behave like 'a + b': |
|
1730 | '_intlist(a b)' should behave like 'a + b': | |
1731 |
|
1731 | |||
1732 | $ trylist --optimize '2:0 & %ld' 0 1 2 |
|
1732 | $ trylist --optimize '2:0 & %ld' 0 1 2 | |
1733 | (and |
|
1733 | (and | |
1734 | (range |
|
1734 | (range | |
1735 | ('symbol', '2') |
|
1735 | ('symbol', '2') | |
1736 | ('symbol', '0')) |
|
1736 | ('symbol', '0')) | |
1737 | (func |
|
1737 | (func | |
1738 | ('symbol', '_intlist') |
|
1738 | ('symbol', '_intlist') | |
1739 | ('string', '0\x001\x002'))) |
|
1739 | ('string', '0\x001\x002'))) | |
1740 | * optimized: |
|
1740 | * optimized: | |
1741 | (and |
|
1741 | (and | |
1742 | (func |
|
1742 | (func | |
1743 | ('symbol', '_intlist') |
|
1743 | ('symbol', '_intlist') | |
1744 | ('string', '0\x001\x002') |
|
1744 | ('string', '0\x001\x002') | |
1745 | follow) |
|
1745 | follow) | |
1746 | (range |
|
1746 | (range | |
1747 | ('symbol', '2') |
|
1747 | ('symbol', '2') | |
1748 | ('symbol', '0') |
|
1748 | ('symbol', '0') | |
1749 | define) |
|
1749 | define) | |
1750 | define) |
|
1750 | define) | |
1751 | * set: |
|
1751 | * set: | |
1752 | <filteredset |
|
1752 | <filteredset | |
1753 | <spanset- 0:3>, |
|
1753 | <spanset- 0:3>, | |
1754 | <baseset+ [0, 1, 2]>> |
|
1754 | <baseset+ [0, 1, 2]>> | |
1755 | 2 |
|
1755 | 2 | |
1756 | 1 |
|
1756 | 1 | |
1757 | 0 |
|
1757 | 0 | |
1758 |
|
1758 | |||
1759 | $ trylist --optimize '%ld & 2:0' 0 2 1 |
|
1759 | $ trylist --optimize '%ld & 2:0' 0 2 1 | |
1760 | (and |
|
1760 | (and | |
1761 | (func |
|
1761 | (func | |
1762 | ('symbol', '_intlist') |
|
1762 | ('symbol', '_intlist') | |
1763 | ('string', '0\x002\x001')) |
|
1763 | ('string', '0\x002\x001')) | |
1764 | (range |
|
1764 | (range | |
1765 | ('symbol', '2') |
|
1765 | ('symbol', '2') | |
1766 | ('symbol', '0'))) |
|
1766 | ('symbol', '0'))) | |
1767 | * optimized: |
|
1767 | * optimized: | |
1768 | (and |
|
1768 | (and | |
1769 | (func |
|
1769 | (func | |
1770 | ('symbol', '_intlist') |
|
1770 | ('symbol', '_intlist') | |
1771 | ('string', '0\x002\x001') |
|
1771 | ('string', '0\x002\x001') | |
1772 | define) |
|
1772 | define) | |
1773 | (range |
|
1773 | (range | |
1774 | ('symbol', '2') |
|
1774 | ('symbol', '2') | |
1775 | ('symbol', '0') |
|
1775 | ('symbol', '0') | |
1776 | follow) |
|
1776 | follow) | |
1777 | define) |
|
1777 | define) | |
1778 | * set: |
|
1778 | * set: | |
1779 | <filteredset |
|
1779 | <filteredset | |
1780 | <baseset [0, 2, 1]>, |
|
1780 | <baseset [0, 2, 1]>, | |
1781 | <spanset- 0:3>> |
|
1781 | <spanset- 0:3>> | |
1782 | 0 |
|
1782 | 0 | |
1783 | 2 |
|
1783 | 2 | |
1784 | 1 |
|
1784 | 1 | |
1785 |
|
1785 | |||
1786 | '_hexlist(a b)' should behave like 'a + b': |
|
1786 | '_hexlist(a b)' should behave like 'a + b': | |
1787 |
|
1787 | |||
1788 | $ trylist --optimize --bin '2:0 & %ln' `hg log -T '{node} ' -r0:2` |
|
1788 | $ trylist --optimize --bin '2:0 & %ln' `hg log -T '{node} ' -r0:2` | |
1789 | (and |
|
1789 | (and | |
1790 | (range |
|
1790 | (range | |
1791 | ('symbol', '2') |
|
1791 | ('symbol', '2') | |
1792 | ('symbol', '0')) |
|
1792 | ('symbol', '0')) | |
1793 | (func |
|
1793 | (func | |
1794 | ('symbol', '_hexlist') |
|
1794 | ('symbol', '_hexlist') | |
1795 | ('string', '*'))) (glob) |
|
1795 | ('string', '*'))) (glob) | |
1796 | * optimized: |
|
1796 | * optimized: | |
1797 | (and |
|
1797 | (and | |
1798 | (range |
|
1798 | (range | |
1799 | ('symbol', '2') |
|
1799 | ('symbol', '2') | |
1800 | ('symbol', '0') |
|
1800 | ('symbol', '0') | |
1801 | define) |
|
1801 | define) | |
1802 | (func |
|
1802 | (func | |
1803 | ('symbol', '_hexlist') |
|
1803 | ('symbol', '_hexlist') | |
1804 | ('string', '*') (glob) |
|
1804 | ('string', '*') (glob) | |
1805 | follow) |
|
1805 | follow) | |
1806 | define) |
|
1806 | define) | |
1807 | * set: |
|
1807 | * set: | |
1808 | <filteredset |
|
1808 | <filteredset | |
1809 | <spanset- 0:3>, |
|
1809 | <spanset- 0:3>, | |
1810 | <baseset [0, 1, 2]>> |
|
1810 | <baseset [0, 1, 2]>> | |
1811 | 2 |
|
1811 | 2 | |
1812 | 1 |
|
1812 | 1 | |
1813 | 0 |
|
1813 | 0 | |
1814 |
|
1814 | |||
1815 | $ trylist --optimize --bin '%ln & 2:0' `hg log -T '{node} ' -r0+2+1` |
|
1815 | $ trylist --optimize --bin '%ln & 2:0' `hg log -T '{node} ' -r0+2+1` | |
1816 | (and |
|
1816 | (and | |
1817 | (func |
|
1817 | (func | |
1818 | ('symbol', '_hexlist') |
|
1818 | ('symbol', '_hexlist') | |
1819 | ('string', '*')) (glob) |
|
1819 | ('string', '*')) (glob) | |
1820 | (range |
|
1820 | (range | |
1821 | ('symbol', '2') |
|
1821 | ('symbol', '2') | |
1822 | ('symbol', '0'))) |
|
1822 | ('symbol', '0'))) | |
1823 | * optimized: |
|
1823 | * optimized: | |
1824 | (and |
|
1824 | (and | |
1825 | (range |
|
1825 | (range | |
1826 | ('symbol', '2') |
|
1826 | ('symbol', '2') | |
1827 | ('symbol', '0') |
|
1827 | ('symbol', '0') | |
1828 | follow) |
|
1828 | follow) | |
1829 | (func |
|
1829 | (func | |
1830 | ('symbol', '_hexlist') |
|
1830 | ('symbol', '_hexlist') | |
1831 | ('string', '*') (glob) |
|
1831 | ('string', '*') (glob) | |
1832 | define) |
|
1832 | define) | |
1833 | define) |
|
1833 | define) | |
1834 | * set: |
|
1834 | * set: | |
1835 | <baseset [0, 2, 1]> |
|
1835 | <baseset [0, 2, 1]> | |
1836 | 0 |
|
1836 | 0 | |
1837 | 2 |
|
1837 | 2 | |
1838 | 1 |
|
1838 | 1 | |
1839 |
|
1839 | |||
1840 | '_list' should not go through the slow follow-order path if order doesn't |
|
1840 | '_list' should not go through the slow follow-order path if order doesn't | |
1841 | matter: |
|
1841 | matter: | |
1842 |
|
1842 | |||
1843 | $ try -p optimized '2:0 & not (0 + 1)' |
|
1843 | $ try -p optimized '2:0 & not (0 + 1)' | |
1844 | * optimized: |
|
1844 | * optimized: | |
1845 | (difference |
|
1845 | (difference | |
1846 | (range |
|
1846 | (range | |
1847 | ('symbol', '2') |
|
1847 | ('symbol', '2') | |
1848 | ('symbol', '0') |
|
1848 | ('symbol', '0') | |
1849 | define) |
|
1849 | define) | |
1850 | (func |
|
1850 | (func | |
1851 | ('symbol', '_list') |
|
1851 | ('symbol', '_list') | |
1852 | ('string', '0\x001') |
|
1852 | ('string', '0\x001') | |
1853 | any) |
|
1853 | any) | |
1854 | define) |
|
1854 | define) | |
1855 | * set: |
|
1855 | * set: | |
1856 | <filteredset |
|
1856 | <filteredset | |
1857 | <spanset- 0:3>, |
|
1857 | <spanset- 0:3>, | |
1858 | <not |
|
1858 | <not | |
1859 | <baseset [0, 1]>>> |
|
1859 | <baseset [0, 1]>>> | |
1860 | 2 |
|
1860 | 2 | |
1861 |
|
1861 | |||
1862 | $ try -p optimized '2:0 & not (0:2 & (0 + 1))' |
|
1862 | $ try -p optimized '2:0 & not (0:2 & (0 + 1))' | |
1863 | * optimized: |
|
1863 | * optimized: | |
1864 | (difference |
|
1864 | (difference | |
1865 | (range |
|
1865 | (range | |
1866 | ('symbol', '2') |
|
1866 | ('symbol', '2') | |
1867 | ('symbol', '0') |
|
1867 | ('symbol', '0') | |
1868 | define) |
|
1868 | define) | |
1869 | (and |
|
1869 | (and | |
1870 | (range |
|
1870 | (range | |
1871 | ('symbol', '0') |
|
1871 | ('symbol', '0') | |
1872 | ('symbol', '2') |
|
1872 | ('symbol', '2') | |
1873 | any) |
|
1873 | any) | |
1874 | (func |
|
1874 | (func | |
1875 | ('symbol', '_list') |
|
1875 | ('symbol', '_list') | |
1876 | ('string', '0\x001') |
|
1876 | ('string', '0\x001') | |
1877 | any) |
|
1877 | any) | |
1878 | any) |
|
1878 | any) | |
1879 | define) |
|
1879 | define) | |
1880 | * set: |
|
1880 | * set: | |
1881 | <filteredset |
|
1881 | <filteredset | |
1882 | <spanset- 0:3>, |
|
1882 | <spanset- 0:3>, | |
1883 | <not |
|
1883 | <not | |
1884 | <baseset [0, 1]>>> |
|
1884 | <baseset [0, 1]>>> | |
1885 | 2 |
|
1885 | 2 | |
1886 |
|
1886 | |||
1887 | because 'present()' does nothing other than suppressing an error, the |
|
1887 | because 'present()' does nothing other than suppressing an error, the | |
1888 | ordering requirement should be forwarded to the nested expression |
|
1888 | ordering requirement should be forwarded to the nested expression | |
1889 |
|
1889 | |||
1890 | $ try -p optimized 'present(2 + 0 + 1)' |
|
1890 | $ try -p optimized 'present(2 + 0 + 1)' | |
1891 | * optimized: |
|
1891 | * optimized: | |
1892 | (func |
|
1892 | (func | |
1893 | ('symbol', 'present') |
|
1893 | ('symbol', 'present') | |
1894 | (func |
|
1894 | (func | |
1895 | ('symbol', '_list') |
|
1895 | ('symbol', '_list') | |
1896 | ('string', '2\x000\x001') |
|
1896 | ('string', '2\x000\x001') | |
1897 | define) |
|
1897 | define) | |
1898 | define) |
|
1898 | define) | |
1899 | * set: |
|
1899 | * set: | |
1900 | <baseset [2, 0, 1]> |
|
1900 | <baseset [2, 0, 1]> | |
1901 | 2 |
|
1901 | 2 | |
1902 | 0 |
|
1902 | 0 | |
1903 | 1 |
|
1903 | 1 | |
1904 |
|
1904 | |||
1905 | $ try --optimize '2:0 & present(0 + 1 + 2)' |
|
1905 | $ try --optimize '2:0 & present(0 + 1 + 2)' | |
1906 | (and |
|
1906 | (and | |
1907 | (range |
|
1907 | (range | |
1908 | ('symbol', '2') |
|
1908 | ('symbol', '2') | |
1909 | ('symbol', '0')) |
|
1909 | ('symbol', '0')) | |
1910 | (func |
|
1910 | (func | |
1911 | ('symbol', 'present') |
|
1911 | ('symbol', 'present') | |
1912 | (or |
|
1912 | (or | |
1913 | (list |
|
1913 | (list | |
1914 | ('symbol', '0') |
|
1914 | ('symbol', '0') | |
1915 | ('symbol', '1') |
|
1915 | ('symbol', '1') | |
1916 | ('symbol', '2'))))) |
|
1916 | ('symbol', '2'))))) | |
1917 | * optimized: |
|
1917 | * optimized: | |
1918 | (and |
|
1918 | (and | |
1919 | (range |
|
1919 | (range | |
1920 | ('symbol', '2') |
|
1920 | ('symbol', '2') | |
1921 | ('symbol', '0') |
|
1921 | ('symbol', '0') | |
1922 | define) |
|
1922 | define) | |
1923 | (func |
|
1923 | (func | |
1924 | ('symbol', 'present') |
|
1924 | ('symbol', 'present') | |
1925 | (func |
|
1925 | (func | |
1926 | ('symbol', '_list') |
|
1926 | ('symbol', '_list') | |
1927 | ('string', '0\x001\x002') |
|
1927 | ('string', '0\x001\x002') | |
1928 | follow) |
|
1928 | follow) | |
1929 | follow) |
|
1929 | follow) | |
1930 | define) |
|
1930 | define) | |
1931 | * set: |
|
1931 | * set: | |
1932 | <filteredset |
|
1932 | <filteredset | |
1933 | <spanset- 0:3>, |
|
1933 | <spanset- 0:3>, | |
1934 | <baseset [0, 1, 2]>> |
|
1934 | <baseset [0, 1, 2]>> | |
1935 | 2 |
|
1935 | 2 | |
1936 | 1 |
|
1936 | 1 | |
1937 | 0 |
|
1937 | 0 | |
1938 |
|
1938 | |||
1939 | 'reverse()' should take effect only if it is the outermost expression: |
|
1939 | 'reverse()' should take effect only if it is the outermost expression: | |
1940 |
|
1940 | |||
1941 | $ try --optimize '0:2 & reverse(all())' |
|
1941 | $ try --optimize '0:2 & reverse(all())' | |
1942 | (and |
|
1942 | (and | |
1943 | (range |
|
1943 | (range | |
1944 | ('symbol', '0') |
|
1944 | ('symbol', '0') | |
1945 | ('symbol', '2')) |
|
1945 | ('symbol', '2')) | |
1946 | (func |
|
1946 | (func | |
1947 | ('symbol', 'reverse') |
|
1947 | ('symbol', 'reverse') | |
1948 | (func |
|
1948 | (func | |
1949 | ('symbol', 'all') |
|
1949 | ('symbol', 'all') | |
1950 | None))) |
|
1950 | None))) | |
1951 | * optimized: |
|
1951 | * optimized: | |
1952 | (and |
|
1952 | (and | |
1953 | (range |
|
1953 | (range | |
1954 | ('symbol', '0') |
|
1954 | ('symbol', '0') | |
1955 | ('symbol', '2') |
|
1955 | ('symbol', '2') | |
1956 | define) |
|
1956 | define) | |
1957 | (func |
|
1957 | (func | |
1958 | ('symbol', 'reverse') |
|
1958 | ('symbol', 'reverse') | |
1959 | (func |
|
1959 | (func | |
1960 | ('symbol', 'all') |
|
1960 | ('symbol', 'all') | |
1961 | None |
|
1961 | None | |
1962 | define) |
|
1962 | define) | |
1963 | follow) |
|
1963 | follow) | |
1964 | define) |
|
1964 | define) | |
1965 | * set: |
|
1965 | * set: | |
1966 | <filteredset |
|
1966 | <filteredset | |
1967 | <spanset+ 0:3>, |
|
1967 | <spanset+ 0:3>, | |
1968 | <spanset+ 0:10>> |
|
1968 | <spanset+ 0:10>> | |
1969 | 0 |
|
1969 | 0 | |
1970 | 1 |
|
1970 | 1 | |
1971 | 2 |
|
1971 | 2 | |
1972 |
|
1972 | |||
1973 | 'sort()' should take effect only if it is the outermost expression: |
|
1973 | 'sort()' should take effect only if it is the outermost expression: | |
1974 |
|
1974 | |||
1975 | $ try --optimize '0:2 & sort(all(), -rev)' |
|
1975 | $ try --optimize '0:2 & sort(all(), -rev)' | |
1976 | (and |
|
1976 | (and | |
1977 | (range |
|
1977 | (range | |
1978 | ('symbol', '0') |
|
1978 | ('symbol', '0') | |
1979 | ('symbol', '2')) |
|
1979 | ('symbol', '2')) | |
1980 | (func |
|
1980 | (func | |
1981 | ('symbol', 'sort') |
|
1981 | ('symbol', 'sort') | |
1982 | (list |
|
1982 | (list | |
1983 | (func |
|
1983 | (func | |
1984 | ('symbol', 'all') |
|
1984 | ('symbol', 'all') | |
1985 | None) |
|
1985 | None) | |
1986 | (negate |
|
1986 | (negate | |
1987 | ('symbol', 'rev'))))) |
|
1987 | ('symbol', 'rev'))))) | |
1988 | * optimized: |
|
1988 | * optimized: | |
1989 | (and |
|
1989 | (and | |
1990 | (range |
|
1990 | (range | |
1991 | ('symbol', '0') |
|
1991 | ('symbol', '0') | |
1992 | ('symbol', '2') |
|
1992 | ('symbol', '2') | |
1993 | define) |
|
1993 | define) | |
1994 | (func |
|
1994 | (func | |
1995 | ('symbol', 'sort') |
|
1995 | ('symbol', 'sort') | |
1996 | (list |
|
1996 | (list | |
1997 | (func |
|
1997 | (func | |
1998 | ('symbol', 'all') |
|
1998 | ('symbol', 'all') | |
1999 | None |
|
1999 | None | |
2000 | define) |
|
2000 | define) | |
2001 | ('string', '-rev')) |
|
2001 | ('string', '-rev')) | |
2002 | follow) |
|
2002 | follow) | |
2003 | define) |
|
2003 | define) | |
2004 | * set: |
|
2004 | * set: | |
2005 | <filteredset |
|
2005 | <filteredset | |
2006 | <spanset+ 0:3>, |
|
2006 | <spanset+ 0:3>, | |
2007 | <spanset+ 0:10>> |
|
2007 | <spanset+ 0:10>> | |
2008 | 0 |
|
2008 | 0 | |
2009 | 1 |
|
2009 | 1 | |
2010 | 2 |
|
2010 | 2 | |
2011 |
|
2011 | |||
2012 | invalid argument passed to noop sort(): |
|
2012 | invalid argument passed to noop sort(): | |
2013 |
|
2013 | |||
2014 | $ log '0:2 & sort()' |
|
2014 | $ log '0:2 & sort()' | |
2015 | hg: parse error: sort requires one or two arguments |
|
2015 | hg: parse error: sort requires one or two arguments | |
2016 | [255] |
|
2016 | [255] | |
2017 | $ log '0:2 & sort(all(), -invalid)' |
|
2017 | $ log '0:2 & sort(all(), -invalid)' | |
2018 | hg: parse error: unknown sort key '-invalid' |
|
2018 | hg: parse error: unknown sort key '-invalid' | |
2019 | [255] |
|
2019 | [255] | |
2020 |
|
2020 | |||
2021 | for 'A & f(B)', 'B' should not be affected by the order of 'A': |
|
2021 | for 'A & f(B)', 'B' should not be affected by the order of 'A': | |
2022 |
|
2022 | |||
2023 | $ try --optimize '2:0 & first(1 + 0 + 2)' |
|
2023 | $ try --optimize '2:0 & first(1 + 0 + 2)' | |
2024 | (and |
|
2024 | (and | |
2025 | (range |
|
2025 | (range | |
2026 | ('symbol', '2') |
|
2026 | ('symbol', '2') | |
2027 | ('symbol', '0')) |
|
2027 | ('symbol', '0')) | |
2028 | (func |
|
2028 | (func | |
2029 | ('symbol', 'first') |
|
2029 | ('symbol', 'first') | |
2030 | (or |
|
2030 | (or | |
2031 | (list |
|
2031 | (list | |
2032 | ('symbol', '1') |
|
2032 | ('symbol', '1') | |
2033 | ('symbol', '0') |
|
2033 | ('symbol', '0') | |
2034 | ('symbol', '2'))))) |
|
2034 | ('symbol', '2'))))) | |
2035 | * optimized: |
|
2035 | * optimized: | |
2036 | (and |
|
2036 | (and | |
2037 | (range |
|
2037 | (range | |
2038 | ('symbol', '2') |
|
2038 | ('symbol', '2') | |
2039 | ('symbol', '0') |
|
2039 | ('symbol', '0') | |
2040 | define) |
|
2040 | define) | |
2041 | (func |
|
2041 | (func | |
2042 | ('symbol', 'first') |
|
2042 | ('symbol', 'first') | |
2043 | (func |
|
2043 | (func | |
2044 | ('symbol', '_list') |
|
2044 | ('symbol', '_list') | |
2045 | ('string', '1\x000\x002') |
|
2045 | ('string', '1\x000\x002') | |
2046 | define) |
|
2046 | define) | |
2047 | follow) |
|
2047 | follow) | |
2048 | define) |
|
2048 | define) | |
2049 | * set: |
|
2049 | * set: | |
2050 | <filteredset |
|
2050 | <filteredset | |
2051 | <baseset [1]>, |
|
2051 | <baseset [1]>, | |
2052 | <spanset- 0:3>> |
|
2052 | <spanset- 0:3>> | |
2053 | 1 |
|
2053 | 1 | |
2054 |
|
2054 | |||
2055 | $ try --optimize '2:0 & not last(0 + 2 + 1)' |
|
2055 | $ try --optimize '2:0 & not last(0 + 2 + 1)' | |
2056 | (and |
|
2056 | (and | |
2057 | (range |
|
2057 | (range | |
2058 | ('symbol', '2') |
|
2058 | ('symbol', '2') | |
2059 | ('symbol', '0')) |
|
2059 | ('symbol', '0')) | |
2060 | (not |
|
2060 | (not | |
2061 | (func |
|
2061 | (func | |
2062 | ('symbol', 'last') |
|
2062 | ('symbol', 'last') | |
2063 | (or |
|
2063 | (or | |
2064 | (list |
|
2064 | (list | |
2065 | ('symbol', '0') |
|
2065 | ('symbol', '0') | |
2066 | ('symbol', '2') |
|
2066 | ('symbol', '2') | |
2067 | ('symbol', '1')))))) |
|
2067 | ('symbol', '1')))))) | |
2068 | * optimized: |
|
2068 | * optimized: | |
2069 | (difference |
|
2069 | (difference | |
2070 | (range |
|
2070 | (range | |
2071 | ('symbol', '2') |
|
2071 | ('symbol', '2') | |
2072 | ('symbol', '0') |
|
2072 | ('symbol', '0') | |
2073 | define) |
|
2073 | define) | |
2074 | (func |
|
2074 | (func | |
2075 | ('symbol', 'last') |
|
2075 | ('symbol', 'last') | |
2076 | (func |
|
2076 | (func | |
2077 | ('symbol', '_list') |
|
2077 | ('symbol', '_list') | |
2078 | ('string', '0\x002\x001') |
|
2078 | ('string', '0\x002\x001') | |
2079 | define) |
|
2079 | define) | |
2080 | any) |
|
2080 | any) | |
2081 | define) |
|
2081 | define) | |
2082 | * set: |
|
2082 | * set: | |
2083 | <filteredset |
|
2083 | <filteredset | |
2084 | <spanset- 0:3>, |
|
2084 | <spanset- 0:3>, | |
2085 | <not |
|
2085 | <not | |
2086 | <baseset [1]>>> |
|
2086 | <baseset [1]>>> | |
2087 | 2 |
|
2087 | 2 | |
2088 | 0 |
|
2088 | 0 | |
2089 |
|
2089 | |||
2090 | for 'A & (op)(B)', 'B' should not be affected by the order of 'A': |
|
2090 | for 'A & (op)(B)', 'B' should not be affected by the order of 'A': | |
2091 |
|
2091 | |||
2092 | $ try --optimize '2:0 & (1 + 0 + 2):(0 + 2 + 1)' |
|
2092 | $ try --optimize '2:0 & (1 + 0 + 2):(0 + 2 + 1)' | |
2093 | (and |
|
2093 | (and | |
2094 | (range |
|
2094 | (range | |
2095 | ('symbol', '2') |
|
2095 | ('symbol', '2') | |
2096 | ('symbol', '0')) |
|
2096 | ('symbol', '0')) | |
2097 | (range |
|
2097 | (range | |
2098 | (group |
|
2098 | (group | |
2099 | (or |
|
2099 | (or | |
2100 | (list |
|
2100 | (list | |
2101 | ('symbol', '1') |
|
2101 | ('symbol', '1') | |
2102 | ('symbol', '0') |
|
2102 | ('symbol', '0') | |
2103 | ('symbol', '2')))) |
|
2103 | ('symbol', '2')))) | |
2104 | (group |
|
2104 | (group | |
2105 | (or |
|
2105 | (or | |
2106 | (list |
|
2106 | (list | |
2107 | ('symbol', '0') |
|
2107 | ('symbol', '0') | |
2108 | ('symbol', '2') |
|
2108 | ('symbol', '2') | |
2109 | ('symbol', '1')))))) |
|
2109 | ('symbol', '1')))))) | |
2110 | * optimized: |
|
2110 | * optimized: | |
2111 | (and |
|
2111 | (and | |
2112 | (range |
|
2112 | (range | |
2113 | ('symbol', '2') |
|
2113 | ('symbol', '2') | |
2114 | ('symbol', '0') |
|
2114 | ('symbol', '0') | |
2115 | define) |
|
2115 | define) | |
2116 | (range |
|
2116 | (range | |
2117 | (func |
|
2117 | (func | |
2118 | ('symbol', '_list') |
|
2118 | ('symbol', '_list') | |
2119 | ('string', '1\x000\x002') |
|
2119 | ('string', '1\x000\x002') | |
2120 | define) |
|
2120 | define) | |
2121 | (func |
|
2121 | (func | |
2122 | ('symbol', '_list') |
|
2122 | ('symbol', '_list') | |
2123 | ('string', '0\x002\x001') |
|
2123 | ('string', '0\x002\x001') | |
2124 | define) |
|
2124 | define) | |
2125 | follow) |
|
2125 | follow) | |
2126 | define) |
|
2126 | define) | |
2127 | * set: |
|
2127 | * set: | |
2128 | <filteredset |
|
2128 | <filteredset | |
2129 | <spanset- 0:3>, |
|
2129 | <spanset- 0:3>, | |
2130 | <baseset [1]>> |
|
2130 | <baseset [1]>> | |
2131 | 1 |
|
2131 | 1 | |
2132 |
|
2132 | |||
2133 | 'A & B' can be rewritten as 'B & A' by weight, but that's fine as long as |
|
2133 | 'A & B' can be rewritten as 'B & A' by weight, but that's fine as long as | |
2134 | the ordering rule is determined before the rewrite; in this example, |
|
2134 | the ordering rule is determined before the rewrite; in this example, | |
2135 | 'B' follows the order of the initial set, which is the same order as 'A' |
|
2135 | 'B' follows the order of the initial set, which is the same order as 'A' | |
2136 | since 'A' also follows the order: |
|
2136 | since 'A' also follows the order: | |
2137 |
|
2137 | |||
2138 | $ try --optimize 'contains("glob:*") & (2 + 0 + 1)' |
|
2138 | $ try --optimize 'contains("glob:*") & (2 + 0 + 1)' | |
2139 | (and |
|
2139 | (and | |
2140 | (func |
|
2140 | (func | |
2141 | ('symbol', 'contains') |
|
2141 | ('symbol', 'contains') | |
2142 | ('string', 'glob:*')) |
|
2142 | ('string', 'glob:*')) | |
2143 | (group |
|
2143 | (group | |
2144 | (or |
|
2144 | (or | |
2145 | (list |
|
2145 | (list | |
2146 | ('symbol', '2') |
|
2146 | ('symbol', '2') | |
2147 | ('symbol', '0') |
|
2147 | ('symbol', '0') | |
2148 | ('symbol', '1'))))) |
|
2148 | ('symbol', '1'))))) | |
2149 | * optimized: |
|
2149 | * optimized: | |
2150 | (and |
|
2150 | (and | |
2151 | (func |
|
2151 | (func | |
2152 | ('symbol', '_list') |
|
2152 | ('symbol', '_list') | |
2153 | ('string', '2\x000\x001') |
|
2153 | ('string', '2\x000\x001') | |
2154 | follow) |
|
2154 | follow) | |
2155 | (func |
|
2155 | (func | |
2156 | ('symbol', 'contains') |
|
2156 | ('symbol', 'contains') | |
2157 | ('string', 'glob:*') |
|
2157 | ('string', 'glob:*') | |
2158 | define) |
|
2158 | define) | |
2159 | define) |
|
2159 | define) | |
2160 | * set: |
|
2160 | * set: | |
2161 | <filteredset |
|
2161 | <filteredset | |
2162 | <baseset+ [0, 1, 2]>, |
|
2162 | <baseset+ [0, 1, 2]>, | |
2163 | <contains 'glob:*'>> |
|
2163 | <contains 'glob:*'>> | |
2164 | 0 |
|
2164 | 0 | |
2165 | 1 |
|
2165 | 1 | |
2166 | 2 |
|
2166 | 2 | |
2167 |
|
2167 | |||
2168 | and in this example, 'A & B' is rewritten as 'B & A', but 'A' overrides |
|
2168 | and in this example, 'A & B' is rewritten as 'B & A', but 'A' overrides | |
2169 | the order appropriately: |
|
2169 | the order appropriately: | |
2170 |
|
2170 | |||
2171 | $ try --optimize 'reverse(contains("glob:*")) & (0 + 2 + 1)' |
|
2171 | $ try --optimize 'reverse(contains("glob:*")) & (0 + 2 + 1)' | |
2172 | (and |
|
2172 | (and | |
2173 | (func |
|
2173 | (func | |
2174 | ('symbol', 'reverse') |
|
2174 | ('symbol', 'reverse') | |
2175 | (func |
|
2175 | (func | |
2176 | ('symbol', 'contains') |
|
2176 | ('symbol', 'contains') | |
2177 | ('string', 'glob:*'))) |
|
2177 | ('string', 'glob:*'))) | |
2178 | (group |
|
2178 | (group | |
2179 | (or |
|
2179 | (or | |
2180 | (list |
|
2180 | (list | |
2181 | ('symbol', '0') |
|
2181 | ('symbol', '0') | |
2182 | ('symbol', '2') |
|
2182 | ('symbol', '2') | |
2183 | ('symbol', '1'))))) |
|
2183 | ('symbol', '1'))))) | |
2184 | * optimized: |
|
2184 | * optimized: | |
2185 | (and |
|
2185 | (and | |
2186 | (func |
|
2186 | (func | |
2187 | ('symbol', '_list') |
|
2187 | ('symbol', '_list') | |
2188 | ('string', '0\x002\x001') |
|
2188 | ('string', '0\x002\x001') | |
2189 | follow) |
|
2189 | follow) | |
2190 | (func |
|
2190 | (func | |
2191 | ('symbol', 'reverse') |
|
2191 | ('symbol', 'reverse') | |
2192 | (func |
|
2192 | (func | |
2193 | ('symbol', 'contains') |
|
2193 | ('symbol', 'contains') | |
2194 | ('string', 'glob:*') |
|
2194 | ('string', 'glob:*') | |
2195 | define) |
|
2195 | define) | |
2196 | define) |
|
2196 | define) | |
2197 | define) |
|
2197 | define) | |
2198 | * set: |
|
2198 | * set: | |
2199 | <filteredset |
|
2199 | <filteredset | |
2200 | <baseset- [0, 1, 2]>, |
|
2200 | <baseset- [0, 1, 2]>, | |
2201 | <contains 'glob:*'>> |
|
2201 | <contains 'glob:*'>> | |
2202 | 2 |
|
2202 | 2 | |
2203 | 1 |
|
2203 | 1 | |
2204 | 0 |
|
2204 | 0 | |
2205 |
|
2205 | |||
2206 | 'A + B' can be rewritten to 'B + A' by weight only when the order doesn't |
|
2206 | 'A + B' can be rewritten to 'B + A' by weight only when the order doesn't | |
2207 | matter (e.g. 'X & (A + B)' can be 'X & (B + A)', but '(A + B) & X' can't): |
|
2207 | matter (e.g. 'X & (A + B)' can be 'X & (B + A)', but '(A + B) & X' can't): | |
2208 |
|
2208 | |||
2209 | $ try -p optimized '0:2 & (reverse(contains("a")) + 2)' |
|
2209 | $ try -p optimized '0:2 & (reverse(contains("a")) + 2)' | |
2210 | * optimized: |
|
2210 | * optimized: | |
2211 | (and |
|
2211 | (and | |
2212 | (range |
|
2212 | (range | |
2213 | ('symbol', '0') |
|
2213 | ('symbol', '0') | |
2214 | ('symbol', '2') |
|
2214 | ('symbol', '2') | |
2215 | define) |
|
2215 | define) | |
2216 | (or |
|
2216 | (or | |
2217 | (list |
|
2217 | (list | |
2218 | ('symbol', '2') |
|
2218 | ('symbol', '2') | |
2219 | (func |
|
2219 | (func | |
2220 | ('symbol', 'reverse') |
|
2220 | ('symbol', 'reverse') | |
2221 | (func |
|
2221 | (func | |
2222 | ('symbol', 'contains') |
|
2222 | ('symbol', 'contains') | |
2223 | ('string', 'a') |
|
2223 | ('string', 'a') | |
2224 | define) |
|
2224 | define) | |
2225 | follow)) |
|
2225 | follow)) | |
2226 | follow) |
|
2226 | follow) | |
2227 | define) |
|
2227 | define) | |
2228 | * set: |
|
2228 | * set: | |
2229 | <filteredset |
|
2229 | <filteredset | |
2230 | <spanset+ 0:3>, |
|
2230 | <spanset+ 0:3>, | |
2231 | <addset |
|
2231 | <addset | |
2232 | <baseset [2]>, |
|
2232 | <baseset [2]>, | |
2233 | <filteredset |
|
2233 | <filteredset | |
2234 | <fullreposet+ 0:10>, |
|
2234 | <fullreposet+ 0:10>, | |
2235 | <contains 'a'>>>> |
|
2235 | <contains 'a'>>>> | |
2236 | 0 |
|
2236 | 0 | |
2237 | 1 |
|
2237 | 1 | |
2238 | 2 |
|
2238 | 2 | |
2239 |
|
2239 | |||
2240 | $ try -p optimized '(reverse(contains("a")) + 2) & 0:2' |
|
2240 | $ try -p optimized '(reverse(contains("a")) + 2) & 0:2' | |
2241 | * optimized: |
|
2241 | * optimized: | |
2242 | (and |
|
2242 | (and | |
2243 | (range |
|
2243 | (range | |
2244 | ('symbol', '0') |
|
2244 | ('symbol', '0') | |
2245 | ('symbol', '2') |
|
2245 | ('symbol', '2') | |
2246 | follow) |
|
2246 | follow) | |
2247 | (or |
|
2247 | (or | |
2248 | (list |
|
2248 | (list | |
2249 | (func |
|
2249 | (func | |
2250 | ('symbol', 'reverse') |
|
2250 | ('symbol', 'reverse') | |
2251 | (func |
|
2251 | (func | |
2252 | ('symbol', 'contains') |
|
2252 | ('symbol', 'contains') | |
2253 | ('string', 'a') |
|
2253 | ('string', 'a') | |
2254 | define) |
|
2254 | define) | |
2255 | define) |
|
2255 | define) | |
2256 | ('symbol', '2')) |
|
2256 | ('symbol', '2')) | |
2257 | define) |
|
2257 | define) | |
2258 | define) |
|
2258 | define) | |
2259 | * set: |
|
2259 | * set: | |
2260 | <addset |
|
2260 | <addset | |
2261 | <filteredset |
|
2261 | <filteredset | |
2262 | <spanset- 0:3>, |
|
2262 | <spanset- 0:3>, | |
2263 | <contains 'a'>>, |
|
2263 | <contains 'a'>>, | |
2264 | <baseset [2]>> |
|
2264 | <baseset [2]>> | |
2265 | 1 |
|
2265 | 1 | |
2266 | 0 |
|
2266 | 0 | |
2267 | 2 |
|
2267 | 2 | |
2268 |
|
2268 | |||
2269 | test sort revset |
|
2269 | test sort revset | |
2270 | -------------------------------------------- |
|
2270 | -------------------------------------------- | |
2271 |
|
2271 | |||
2272 | test when adding two unordered revsets |
|
2272 | test when adding two unordered revsets | |
2273 |
|
2273 | |||
2274 | $ log 'sort(keyword(issue) or modifies(b))' |
|
2274 | $ log 'sort(keyword(issue) or modifies(b))' | |
2275 | 4 |
|
2275 | 4 | |
2276 | 6 |
|
2276 | 6 | |
2277 |
|
2277 | |||
2278 | test when sorting a reversed collection in the same way it is |
|
2278 | test when sorting a reversed collection in the same way it is | |
2279 |
|
2279 | |||
2280 | $ log 'sort(reverse(all()), -rev)' |
|
2280 | $ log 'sort(reverse(all()), -rev)' | |
2281 | 9 |
|
2281 | 9 | |
2282 | 8 |
|
2282 | 8 | |
2283 | 7 |
|
2283 | 7 | |
2284 | 6 |
|
2284 | 6 | |
2285 | 5 |
|
2285 | 5 | |
2286 | 4 |
|
2286 | 4 | |
2287 | 3 |
|
2287 | 3 | |
2288 | 2 |
|
2288 | 2 | |
2289 | 1 |
|
2289 | 1 | |
2290 | 0 |
|
2290 | 0 | |
2291 |
|
2291 | |||
2292 | test when sorting a reversed collection |
|
2292 | test when sorting a reversed collection | |
2293 |
|
2293 | |||
2294 | $ log 'sort(reverse(all()), rev)' |
|
2294 | $ log 'sort(reverse(all()), rev)' | |
2295 | 0 |
|
2295 | 0 | |
2296 | 1 |
|
2296 | 1 | |
2297 | 2 |
|
2297 | 2 | |
2298 | 3 |
|
2298 | 3 | |
2299 | 4 |
|
2299 | 4 | |
2300 | 5 |
|
2300 | 5 | |
2301 | 6 |
|
2301 | 6 | |
2302 | 7 |
|
2302 | 7 | |
2303 | 8 |
|
2303 | 8 | |
2304 | 9 |
|
2304 | 9 | |
2305 |
|
2305 | |||
2306 |
|
2306 | |||
2307 | test sorting two sorted collections in different orders |
|
2307 | test sorting two sorted collections in different orders | |
2308 |
|
2308 | |||
2309 | $ log 'sort(outgoing() or reverse(removes(a)), rev)' |
|
2309 | $ log 'sort(outgoing() or reverse(removes(a)), rev)' | |
2310 | 2 |
|
2310 | 2 | |
2311 | 6 |
|
2311 | 6 | |
2312 | 8 |
|
2312 | 8 | |
2313 | 9 |
|
2313 | 9 | |
2314 |
|
2314 | |||
2315 | test sorting two sorted collections in different orders backwards |
|
2315 | test sorting two sorted collections in different orders backwards | |
2316 |
|
2316 | |||
2317 | $ log 'sort(outgoing() or reverse(removes(a)), -rev)' |
|
2317 | $ log 'sort(outgoing() or reverse(removes(a)), -rev)' | |
2318 | 9 |
|
2318 | 9 | |
2319 | 8 |
|
2319 | 8 | |
2320 | 6 |
|
2320 | 6 | |
2321 | 2 |
|
2321 | 2 | |
2322 |
|
2322 | |||
2323 | test empty sort key which is noop |
|
2323 | test empty sort key which is noop | |
2324 |
|
2324 | |||
2325 | $ log 'sort(0 + 2 + 1, "")' |
|
2325 | $ log 'sort(0 + 2 + 1, "")' | |
2326 | 0 |
|
2326 | 0 | |
2327 | 2 |
|
2327 | 2 | |
2328 | 1 |
|
2328 | 1 | |
2329 |
|
2329 | |||
2330 | test invalid sort keys |
|
2330 | test invalid sort keys | |
2331 |
|
2331 | |||
2332 | $ log 'sort(all(), -invalid)' |
|
2332 | $ log 'sort(all(), -invalid)' | |
2333 | hg: parse error: unknown sort key '-invalid' |
|
2333 | hg: parse error: unknown sort key '-invalid' | |
2334 | [255] |
|
2334 | [255] | |
2335 |
|
2335 | |||
2336 | $ cd .. |
|
2336 | $ cd .. | |
2337 |
|
2337 | |||
2338 | test sorting by multiple keys including variable-length strings |
|
2338 | test sorting by multiple keys including variable-length strings | |
2339 |
|
2339 | |||
2340 | $ hg init sorting |
|
2340 | $ hg init sorting | |
2341 | $ cd sorting |
|
2341 | $ cd sorting | |
2342 | $ cat <<EOF >> .hg/hgrc |
|
2342 | $ cat <<EOF >> .hg/hgrc | |
2343 | > [ui] |
|
2343 | > [ui] | |
2344 | > logtemplate = '{rev} {branch|p5}{desc|p5}{author|p5}{date|hgdate}\n' |
|
2344 | > logtemplate = '{rev} {branch|p5}{desc|p5}{author|p5}{date|hgdate}\n' | |
2345 | > [templatealias] |
|
2345 | > [templatealias] | |
2346 | > p5(s) = pad(s, 5) |
|
2346 | > p5(s) = pad(s, 5) | |
2347 | > EOF |
|
2347 | > EOF | |
2348 | $ hg branch -qf b12 |
|
2348 | $ hg branch -qf b12 | |
2349 | $ hg ci -m m111 -u u112 -d '111 10800' |
|
2349 | $ hg ci -m m111 -u u112 -d '111 10800' | |
2350 | $ hg branch -qf b11 |
|
2350 | $ hg branch -qf b11 | |
2351 | $ hg ci -m m12 -u u111 -d '112 7200' |
|
2351 | $ hg ci -m m12 -u u111 -d '112 7200' | |
2352 | $ hg branch -qf b111 |
|
2352 | $ hg branch -qf b111 | |
2353 | $ hg ci -m m11 -u u12 -d '111 3600' |
|
2353 | $ hg ci -m m11 -u u12 -d '111 3600' | |
2354 | $ hg branch -qf b112 |
|
2354 | $ hg branch -qf b112 | |
2355 | $ hg ci -m m111 -u u11 -d '120 0' |
|
2355 | $ hg ci -m m111 -u u11 -d '120 0' | |
2356 | $ hg branch -qf b111 |
|
2356 | $ hg branch -qf b111 | |
2357 | $ hg ci -m m112 -u u111 -d '110 14400' |
|
2357 | $ hg ci -m m112 -u u111 -d '110 14400' | |
2358 | created new head |
|
2358 | created new head | |
2359 |
|
2359 | |||
2360 | compare revisions (has fast path): |
|
2360 | compare revisions (has fast path): | |
2361 |
|
2361 | |||
2362 | $ hg log -r 'sort(all(), rev)' |
|
2362 | $ hg log -r 'sort(all(), rev)' | |
2363 | 0 b12 m111 u112 111 10800 |
|
2363 | 0 b12 m111 u112 111 10800 | |
2364 | 1 b11 m12 u111 112 7200 |
|
2364 | 1 b11 m12 u111 112 7200 | |
2365 | 2 b111 m11 u12 111 3600 |
|
2365 | 2 b111 m11 u12 111 3600 | |
2366 | 3 b112 m111 u11 120 0 |
|
2366 | 3 b112 m111 u11 120 0 | |
2367 | 4 b111 m112 u111 110 14400 |
|
2367 | 4 b111 m112 u111 110 14400 | |
2368 |
|
2368 | |||
2369 | $ hg log -r 'sort(all(), -rev)' |
|
2369 | $ hg log -r 'sort(all(), -rev)' | |
2370 | 4 b111 m112 u111 110 14400 |
|
2370 | 4 b111 m112 u111 110 14400 | |
2371 | 3 b112 m111 u11 120 0 |
|
2371 | 3 b112 m111 u11 120 0 | |
2372 | 2 b111 m11 u12 111 3600 |
|
2372 | 2 b111 m11 u12 111 3600 | |
2373 | 1 b11 m12 u111 112 7200 |
|
2373 | 1 b11 m12 u111 112 7200 | |
2374 | 0 b12 m111 u112 111 10800 |
|
2374 | 0 b12 m111 u112 111 10800 | |
2375 |
|
2375 | |||
2376 | compare variable-length strings (issue5218): |
|
2376 | compare variable-length strings (issue5218): | |
2377 |
|
2377 | |||
2378 | $ hg log -r 'sort(all(), branch)' |
|
2378 | $ hg log -r 'sort(all(), branch)' | |
2379 | 1 b11 m12 u111 112 7200 |
|
2379 | 1 b11 m12 u111 112 7200 | |
2380 | 2 b111 m11 u12 111 3600 |
|
2380 | 2 b111 m11 u12 111 3600 | |
2381 | 4 b111 m112 u111 110 14400 |
|
2381 | 4 b111 m112 u111 110 14400 | |
2382 | 3 b112 m111 u11 120 0 |
|
2382 | 3 b112 m111 u11 120 0 | |
2383 | 0 b12 m111 u112 111 10800 |
|
2383 | 0 b12 m111 u112 111 10800 | |
2384 |
|
2384 | |||
2385 | $ hg log -r 'sort(all(), -branch)' |
|
2385 | $ hg log -r 'sort(all(), -branch)' | |
2386 | 0 b12 m111 u112 111 10800 |
|
2386 | 0 b12 m111 u112 111 10800 | |
2387 | 3 b112 m111 u11 120 0 |
|
2387 | 3 b112 m111 u11 120 0 | |
2388 | 2 b111 m11 u12 111 3600 |
|
2388 | 2 b111 m11 u12 111 3600 | |
2389 | 4 b111 m112 u111 110 14400 |
|
2389 | 4 b111 m112 u111 110 14400 | |
2390 | 1 b11 m12 u111 112 7200 |
|
2390 | 1 b11 m12 u111 112 7200 | |
2391 |
|
2391 | |||
2392 | $ hg log -r 'sort(all(), desc)' |
|
2392 | $ hg log -r 'sort(all(), desc)' | |
2393 | 2 b111 m11 u12 111 3600 |
|
2393 | 2 b111 m11 u12 111 3600 | |
2394 | 0 b12 m111 u112 111 10800 |
|
2394 | 0 b12 m111 u112 111 10800 | |
2395 | 3 b112 m111 u11 120 0 |
|
2395 | 3 b112 m111 u11 120 0 | |
2396 | 4 b111 m112 u111 110 14400 |
|
2396 | 4 b111 m112 u111 110 14400 | |
2397 | 1 b11 m12 u111 112 7200 |
|
2397 | 1 b11 m12 u111 112 7200 | |
2398 |
|
2398 | |||
2399 | $ hg log -r 'sort(all(), -desc)' |
|
2399 | $ hg log -r 'sort(all(), -desc)' | |
2400 | 1 b11 m12 u111 112 7200 |
|
2400 | 1 b11 m12 u111 112 7200 | |
2401 | 4 b111 m112 u111 110 14400 |
|
2401 | 4 b111 m112 u111 110 14400 | |
2402 | 0 b12 m111 u112 111 10800 |
|
2402 | 0 b12 m111 u112 111 10800 | |
2403 | 3 b112 m111 u11 120 0 |
|
2403 | 3 b112 m111 u11 120 0 | |
2404 | 2 b111 m11 u12 111 3600 |
|
2404 | 2 b111 m11 u12 111 3600 | |
2405 |
|
2405 | |||
2406 | $ hg log -r 'sort(all(), user)' |
|
2406 | $ hg log -r 'sort(all(), user)' | |
2407 | 3 b112 m111 u11 120 0 |
|
2407 | 3 b112 m111 u11 120 0 | |
2408 | 1 b11 m12 u111 112 7200 |
|
2408 | 1 b11 m12 u111 112 7200 | |
2409 | 4 b111 m112 u111 110 14400 |
|
2409 | 4 b111 m112 u111 110 14400 | |
2410 | 0 b12 m111 u112 111 10800 |
|
2410 | 0 b12 m111 u112 111 10800 | |
2411 | 2 b111 m11 u12 111 3600 |
|
2411 | 2 b111 m11 u12 111 3600 | |
2412 |
|
2412 | |||
2413 | $ hg log -r 'sort(all(), -user)' |
|
2413 | $ hg log -r 'sort(all(), -user)' | |
2414 | 2 b111 m11 u12 111 3600 |
|
2414 | 2 b111 m11 u12 111 3600 | |
2415 | 0 b12 m111 u112 111 10800 |
|
2415 | 0 b12 m111 u112 111 10800 | |
2416 | 1 b11 m12 u111 112 7200 |
|
2416 | 1 b11 m12 u111 112 7200 | |
2417 | 4 b111 m112 u111 110 14400 |
|
2417 | 4 b111 m112 u111 110 14400 | |
2418 | 3 b112 m111 u11 120 0 |
|
2418 | 3 b112 m111 u11 120 0 | |
2419 |
|
2419 | |||
2420 | compare dates (tz offset should have no effect): |
|
2420 | compare dates (tz offset should have no effect): | |
2421 |
|
2421 | |||
2422 | $ hg log -r 'sort(all(), date)' |
|
2422 | $ hg log -r 'sort(all(), date)' | |
2423 | 4 b111 m112 u111 110 14400 |
|
2423 | 4 b111 m112 u111 110 14400 | |
2424 | 0 b12 m111 u112 111 10800 |
|
2424 | 0 b12 m111 u112 111 10800 | |
2425 | 2 b111 m11 u12 111 3600 |
|
2425 | 2 b111 m11 u12 111 3600 | |
2426 | 1 b11 m12 u111 112 7200 |
|
2426 | 1 b11 m12 u111 112 7200 | |
2427 | 3 b112 m111 u11 120 0 |
|
2427 | 3 b112 m111 u11 120 0 | |
2428 |
|
2428 | |||
2429 | $ hg log -r 'sort(all(), -date)' |
|
2429 | $ hg log -r 'sort(all(), -date)' | |
2430 | 3 b112 m111 u11 120 0 |
|
2430 | 3 b112 m111 u11 120 0 | |
2431 | 1 b11 m12 u111 112 7200 |
|
2431 | 1 b11 m12 u111 112 7200 | |
2432 | 0 b12 m111 u112 111 10800 |
|
2432 | 0 b12 m111 u112 111 10800 | |
2433 | 2 b111 m11 u12 111 3600 |
|
2433 | 2 b111 m11 u12 111 3600 | |
2434 | 4 b111 m112 u111 110 14400 |
|
2434 | 4 b111 m112 u111 110 14400 | |
2435 |
|
2435 | |||
2436 | be aware that 'sort(x, -k)' is not exactly the same as 'reverse(sort(x, k))' |
|
2436 | be aware that 'sort(x, -k)' is not exactly the same as 'reverse(sort(x, k))' | |
2437 | because '-k' reverses the comparison, not the list itself: |
|
2437 | because '-k' reverses the comparison, not the list itself: | |
2438 |
|
2438 | |||
2439 | $ hg log -r 'sort(0 + 2, date)' |
|
2439 | $ hg log -r 'sort(0 + 2, date)' | |
2440 | 0 b12 m111 u112 111 10800 |
|
2440 | 0 b12 m111 u112 111 10800 | |
2441 | 2 b111 m11 u12 111 3600 |
|
2441 | 2 b111 m11 u12 111 3600 | |
2442 |
|
2442 | |||
2443 | $ hg log -r 'sort(0 + 2, -date)' |
|
2443 | $ hg log -r 'sort(0 + 2, -date)' | |
2444 | 0 b12 m111 u112 111 10800 |
|
2444 | 0 b12 m111 u112 111 10800 | |
2445 | 2 b111 m11 u12 111 3600 |
|
2445 | 2 b111 m11 u12 111 3600 | |
2446 |
|
2446 | |||
2447 | $ hg log -r 'reverse(sort(0 + 2, date))' |
|
2447 | $ hg log -r 'reverse(sort(0 + 2, date))' | |
2448 | 2 b111 m11 u12 111 3600 |
|
2448 | 2 b111 m11 u12 111 3600 | |
2449 | 0 b12 m111 u112 111 10800 |
|
2449 | 0 b12 m111 u112 111 10800 | |
2450 |
|
2450 | |||
2451 | sort by multiple keys: |
|
2451 | sort by multiple keys: | |
2452 |
|
2452 | |||
2453 | $ hg log -r 'sort(all(), "branch -rev")' |
|
2453 | $ hg log -r 'sort(all(), "branch -rev")' | |
2454 | 1 b11 m12 u111 112 7200 |
|
2454 | 1 b11 m12 u111 112 7200 | |
2455 | 4 b111 m112 u111 110 14400 |
|
2455 | 4 b111 m112 u111 110 14400 | |
2456 | 2 b111 m11 u12 111 3600 |
|
2456 | 2 b111 m11 u12 111 3600 | |
2457 | 3 b112 m111 u11 120 0 |
|
2457 | 3 b112 m111 u11 120 0 | |
2458 | 0 b12 m111 u112 111 10800 |
|
2458 | 0 b12 m111 u112 111 10800 | |
2459 |
|
2459 | |||
2460 | $ hg log -r 'sort(all(), "-desc -date")' |
|
2460 | $ hg log -r 'sort(all(), "-desc -date")' | |
2461 | 1 b11 m12 u111 112 7200 |
|
2461 | 1 b11 m12 u111 112 7200 | |
2462 | 4 b111 m112 u111 110 14400 |
|
2462 | 4 b111 m112 u111 110 14400 | |
2463 | 3 b112 m111 u11 120 0 |
|
2463 | 3 b112 m111 u11 120 0 | |
2464 | 0 b12 m111 u112 111 10800 |
|
2464 | 0 b12 m111 u112 111 10800 | |
2465 | 2 b111 m11 u12 111 3600 |
|
2465 | 2 b111 m11 u12 111 3600 | |
2466 |
|
2466 | |||
2467 | $ hg log -r 'sort(all(), "user -branch date rev")' |
|
2467 | $ hg log -r 'sort(all(), "user -branch date rev")' | |
2468 | 3 b112 m111 u11 120 0 |
|
2468 | 3 b112 m111 u11 120 0 | |
2469 | 4 b111 m112 u111 110 14400 |
|
2469 | 4 b111 m112 u111 110 14400 | |
2470 | 1 b11 m12 u111 112 7200 |
|
2470 | 1 b11 m12 u111 112 7200 | |
2471 | 0 b12 m111 u112 111 10800 |
|
2471 | 0 b12 m111 u112 111 10800 | |
2472 | 2 b111 m11 u12 111 3600 |
|
2472 | 2 b111 m11 u12 111 3600 | |
2473 |
|
2473 | |||
2474 | toposort prioritises graph branches |
|
2474 | toposort prioritises graph branches | |
2475 |
|
2475 | |||
2476 | $ hg up 2 |
|
2476 | $ hg up 2 | |
2477 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
2477 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
2478 | $ touch a |
|
2478 | $ touch a | |
2479 | $ hg addremove |
|
2479 | $ hg addremove | |
2480 | adding a |
|
2480 | adding a | |
2481 | $ hg ci -m 't1' -u 'tu' -d '130 0' |
|
2481 | $ hg ci -m 't1' -u 'tu' -d '130 0' | |
2482 | created new head |
|
2482 | created new head | |
2483 | $ echo 'a' >> a |
|
2483 | $ echo 'a' >> a | |
2484 | $ hg ci -m 't2' -u 'tu' -d '130 0' |
|
2484 | $ hg ci -m 't2' -u 'tu' -d '130 0' | |
2485 | $ hg book book1 |
|
2485 | $ hg book book1 | |
2486 | $ hg up 4 |
|
2486 | $ hg up 4 | |
2487 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
2487 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
2488 | (leaving bookmark book1) |
|
2488 | (leaving bookmark book1) | |
2489 | $ touch a |
|
2489 | $ touch a | |
2490 | $ hg addremove |
|
2490 | $ hg addremove | |
2491 | adding a |
|
2491 | adding a | |
2492 | $ hg ci -m 't3' -u 'tu' -d '130 0' |
|
2492 | $ hg ci -m 't3' -u 'tu' -d '130 0' | |
2493 |
|
2493 | |||
2494 | $ hg log -r 'sort(all(), topo)' |
|
2494 | $ hg log -r 'sort(all(), topo)' | |
2495 | 7 b111 t3 tu 130 0 |
|
2495 | 7 b111 t3 tu 130 0 | |
2496 | 4 b111 m112 u111 110 14400 |
|
2496 | 4 b111 m112 u111 110 14400 | |
2497 | 3 b112 m111 u11 120 0 |
|
2497 | 3 b112 m111 u11 120 0 | |
2498 | 6 b111 t2 tu 130 0 |
|
2498 | 6 b111 t2 tu 130 0 | |
2499 | 5 b111 t1 tu 130 0 |
|
2499 | 5 b111 t1 tu 130 0 | |
2500 | 2 b111 m11 u12 111 3600 |
|
2500 | 2 b111 m11 u12 111 3600 | |
2501 | 1 b11 m12 u111 112 7200 |
|
2501 | 1 b11 m12 u111 112 7200 | |
2502 | 0 b12 m111 u112 111 10800 |
|
2502 | 0 b12 m111 u112 111 10800 | |
2503 |
|
2503 | |||
2504 | $ hg log -r 'sort(all(), -topo)' |
|
2504 | $ hg log -r 'sort(all(), -topo)' | |
2505 | 0 b12 m111 u112 111 10800 |
|
2505 | 0 b12 m111 u112 111 10800 | |
2506 | 1 b11 m12 u111 112 7200 |
|
2506 | 1 b11 m12 u111 112 7200 | |
2507 | 2 b111 m11 u12 111 3600 |
|
2507 | 2 b111 m11 u12 111 3600 | |
2508 | 5 b111 t1 tu 130 0 |
|
2508 | 5 b111 t1 tu 130 0 | |
2509 | 6 b111 t2 tu 130 0 |
|
2509 | 6 b111 t2 tu 130 0 | |
2510 | 3 b112 m111 u11 120 0 |
|
2510 | 3 b112 m111 u11 120 0 | |
2511 | 4 b111 m112 u111 110 14400 |
|
2511 | 4 b111 m112 u111 110 14400 | |
2512 | 7 b111 t3 tu 130 0 |
|
2512 | 7 b111 t3 tu 130 0 | |
2513 |
|
2513 | |||
2514 | $ hg log -r 'sort(all(), topo, topo.firstbranch=book1)' |
|
2514 | $ hg log -r 'sort(all(), topo, topo.firstbranch=book1)' | |
2515 | 6 b111 t2 tu 130 0 |
|
2515 | 6 b111 t2 tu 130 0 | |
2516 | 5 b111 t1 tu 130 0 |
|
2516 | 5 b111 t1 tu 130 0 | |
2517 | 7 b111 t3 tu 130 0 |
|
2517 | 7 b111 t3 tu 130 0 | |
2518 | 4 b111 m112 u111 110 14400 |
|
2518 | 4 b111 m112 u111 110 14400 | |
2519 | 3 b112 m111 u11 120 0 |
|
2519 | 3 b112 m111 u11 120 0 | |
2520 | 2 b111 m11 u12 111 3600 |
|
2520 | 2 b111 m11 u12 111 3600 | |
2521 | 1 b11 m12 u111 112 7200 |
|
2521 | 1 b11 m12 u111 112 7200 | |
2522 | 0 b12 m111 u112 111 10800 |
|
2522 | 0 b12 m111 u112 111 10800 | |
2523 |
|
2523 | |||
2524 | topographical sorting can't be combined with other sort keys, and you can't |
|
2524 | topographical sorting can't be combined with other sort keys, and you can't | |
2525 | use the topo.firstbranch option when topo sort is not active: |
|
2525 | use the topo.firstbranch option when topo sort is not active: | |
2526 |
|
2526 | |||
2527 | $ hg log -r 'sort(all(), "topo user")' |
|
2527 | $ hg log -r 'sort(all(), "topo user")' | |
2528 | hg: parse error: topo sort order cannot be combined with other sort keys |
|
2528 | hg: parse error: topo sort order cannot be combined with other sort keys | |
2529 | [255] |
|
2529 | [255] | |
2530 |
|
2530 | |||
2531 | $ hg log -r 'sort(all(), user, topo.firstbranch=book1)' |
|
2531 | $ hg log -r 'sort(all(), user, topo.firstbranch=book1)' | |
2532 | hg: parse error: topo.firstbranch can only be used when using the topo sort key |
|
2532 | hg: parse error: topo.firstbranch can only be used when using the topo sort key | |
2533 | [255] |
|
2533 | [255] | |
2534 |
|
2534 | |||
2535 | topo.firstbranch should accept any kind of expressions: |
|
2535 | topo.firstbranch should accept any kind of expressions: | |
2536 |
|
2536 | |||
2537 | $ hg log -r 'sort(0, topo, topo.firstbranch=(book1))' |
|
2537 | $ hg log -r 'sort(0, topo, topo.firstbranch=(book1))' | |
2538 | 0 b12 m111 u112 111 10800 |
|
2538 | 0 b12 m111 u112 111 10800 | |
2539 |
|
2539 | |||
2540 | $ cd .. |
|
2540 | $ cd .. | |
2541 | $ cd repo |
|
2541 | $ cd repo | |
2542 |
|
2542 | |||
2543 | test subtracting something from an addset |
|
2543 | test subtracting something from an addset | |
2544 |
|
2544 | |||
2545 | $ log '(outgoing() or removes(a)) - removes(a)' |
|
2545 | $ log '(outgoing() or removes(a)) - removes(a)' | |
2546 | 8 |
|
2546 | 8 | |
2547 | 9 |
|
2547 | 9 | |
2548 |
|
2548 | |||
2549 | test intersecting something with an addset |
|
2549 | test intersecting something with an addset | |
2550 |
|
2550 | |||
2551 | $ log 'parents(outgoing() or removes(a))' |
|
2551 | $ log 'parents(outgoing() or removes(a))' | |
2552 | 1 |
|
2552 | 1 | |
2553 | 4 |
|
2553 | 4 | |
2554 | 5 |
|
2554 | 5 | |
2555 | 8 |
|
2555 | 8 | |
2556 |
|
2556 | |||
2557 | test that `or` operation combines elements in the right order: |
|
2557 | test that `or` operation combines elements in the right order: | |
2558 |
|
2558 | |||
2559 | $ log '3:4 or 2:5' |
|
2559 | $ log '3:4 or 2:5' | |
2560 | 3 |
|
2560 | 3 | |
2561 | 4 |
|
2561 | 4 | |
2562 | 2 |
|
2562 | 2 | |
2563 | 5 |
|
2563 | 5 | |
2564 | $ log '3:4 or 5:2' |
|
2564 | $ log '3:4 or 5:2' | |
2565 | 3 |
|
2565 | 3 | |
2566 | 4 |
|
2566 | 4 | |
2567 | 5 |
|
2567 | 5 | |
2568 | 2 |
|
2568 | 2 | |
2569 | $ log 'sort(3:4 or 2:5)' |
|
2569 | $ log 'sort(3:4 or 2:5)' | |
2570 | 2 |
|
2570 | 2 | |
2571 | 3 |
|
2571 | 3 | |
2572 | 4 |
|
2572 | 4 | |
2573 | 5 |
|
2573 | 5 | |
2574 | $ log 'sort(3:4 or 5:2)' |
|
2574 | $ log 'sort(3:4 or 5:2)' | |
2575 | 2 |
|
2575 | 2 | |
2576 | 3 |
|
2576 | 3 | |
2577 | 4 |
|
2577 | 4 | |
2578 | 5 |
|
2578 | 5 | |
2579 |
|
2579 | |||
2580 | test that more than one `-r`s are combined in the right order and deduplicated: |
|
2580 | test that more than one `-r`s are combined in the right order and deduplicated: | |
2581 |
|
2581 | |||
2582 | $ hg log -T '{rev}\n' -r 3 -r 3 -r 4 -r 5:2 -r 'ancestors(4)' |
|
2582 | $ hg log -T '{rev}\n' -r 3 -r 3 -r 4 -r 5:2 -r 'ancestors(4)' | |
2583 | 3 |
|
2583 | 3 | |
2584 | 4 |
|
2584 | 4 | |
2585 | 5 |
|
2585 | 5 | |
2586 | 2 |
|
2586 | 2 | |
2587 | 0 |
|
2587 | 0 | |
2588 | 1 |
|
2588 | 1 | |
2589 |
|
2589 | |||
2590 | test that `or` operation skips duplicated revisions from right-hand side |
|
2590 | test that `or` operation skips duplicated revisions from right-hand side | |
2591 |
|
2591 | |||
2592 | $ try 'reverse(1::5) or ancestors(4)' |
|
2592 | $ try 'reverse(1::5) or ancestors(4)' | |
2593 | (or |
|
2593 | (or | |
2594 | (list |
|
2594 | (list | |
2595 | (func |
|
2595 | (func | |
2596 | ('symbol', 'reverse') |
|
2596 | ('symbol', 'reverse') | |
2597 | (dagrange |
|
2597 | (dagrange | |
2598 | ('symbol', '1') |
|
2598 | ('symbol', '1') | |
2599 | ('symbol', '5'))) |
|
2599 | ('symbol', '5'))) | |
2600 | (func |
|
2600 | (func | |
2601 | ('symbol', 'ancestors') |
|
2601 | ('symbol', 'ancestors') | |
2602 | ('symbol', '4')))) |
|
2602 | ('symbol', '4')))) | |
2603 | * set: |
|
2603 | * set: | |
2604 | <addset |
|
2604 | <addset | |
2605 | <baseset- [1, 3, 5]>, |
|
2605 | <baseset- [1, 3, 5]>, | |
2606 | <generatorset+>> |
|
2606 | <generatorset+>> | |
2607 | 5 |
|
2607 | 5 | |
2608 | 3 |
|
2608 | 3 | |
2609 | 1 |
|
2609 | 1 | |
2610 | 0 |
|
2610 | 0 | |
2611 | 2 |
|
2611 | 2 | |
2612 | 4 |
|
2612 | 4 | |
2613 | $ try 'sort(ancestors(4) or reverse(1::5))' |
|
2613 | $ try 'sort(ancestors(4) or reverse(1::5))' | |
2614 | (func |
|
2614 | (func | |
2615 | ('symbol', 'sort') |
|
2615 | ('symbol', 'sort') | |
2616 | (or |
|
2616 | (or | |
2617 | (list |
|
2617 | (list | |
2618 | (func |
|
2618 | (func | |
2619 | ('symbol', 'ancestors') |
|
2619 | ('symbol', 'ancestors') | |
2620 | ('symbol', '4')) |
|
2620 | ('symbol', '4')) | |
2621 | (func |
|
2621 | (func | |
2622 | ('symbol', 'reverse') |
|
2622 | ('symbol', 'reverse') | |
2623 | (dagrange |
|
2623 | (dagrange | |
2624 | ('symbol', '1') |
|
2624 | ('symbol', '1') | |
2625 | ('symbol', '5')))))) |
|
2625 | ('symbol', '5')))))) | |
2626 | * set: |
|
2626 | * set: | |
2627 | <addset+ |
|
2627 | <addset+ | |
2628 | <generatorset+>, |
|
2628 | <generatorset+>, | |
2629 | <baseset- [1, 3, 5]>> |
|
2629 | <baseset- [1, 3, 5]>> | |
2630 | 0 |
|
2630 | 0 | |
2631 | 1 |
|
2631 | 1 | |
2632 | 2 |
|
2632 | 2 | |
2633 | 3 |
|
2633 | 3 | |
2634 | 4 |
|
2634 | 4 | |
2635 | 5 |
|
2635 | 5 | |
2636 |
|
2636 | |||
2637 | test optimization of trivial `or` operation |
|
2637 | test optimization of trivial `or` operation | |
2638 |
|
2638 | |||
2639 | $ try --optimize '0|(1)|"2"|-2|tip|null' |
|
2639 | $ try --optimize '0|(1)|"2"|-2|tip|null' | |
2640 | (or |
|
2640 | (or | |
2641 | (list |
|
2641 | (list | |
2642 | ('symbol', '0') |
|
2642 | ('symbol', '0') | |
2643 | (group |
|
2643 | (group | |
2644 | ('symbol', '1')) |
|
2644 | ('symbol', '1')) | |
2645 | ('string', '2') |
|
2645 | ('string', '2') | |
2646 | (negate |
|
2646 | (negate | |
2647 | ('symbol', '2')) |
|
2647 | ('symbol', '2')) | |
2648 | ('symbol', 'tip') |
|
2648 | ('symbol', 'tip') | |
2649 | ('symbol', 'null'))) |
|
2649 | ('symbol', 'null'))) | |
2650 | * optimized: |
|
2650 | * optimized: | |
2651 | (func |
|
2651 | (func | |
2652 | ('symbol', '_list') |
|
2652 | ('symbol', '_list') | |
2653 | ('string', '0\x001\x002\x00-2\x00tip\x00null') |
|
2653 | ('string', '0\x001\x002\x00-2\x00tip\x00null') | |
2654 | define) |
|
2654 | define) | |
2655 | * set: |
|
2655 | * set: | |
2656 | <baseset [0, 1, 2, 8, 9, -1]> |
|
2656 | <baseset [0, 1, 2, 8, 9, -1]> | |
2657 | 0 |
|
2657 | 0 | |
2658 | 1 |
|
2658 | 1 | |
2659 | 2 |
|
2659 | 2 | |
2660 | 8 |
|
2660 | 8 | |
2661 | 9 |
|
2661 | 9 | |
2662 | -1 |
|
2662 | -1 | |
2663 |
|
2663 | |||
2664 | $ try --optimize '0|1|2:3' |
|
2664 | $ try --optimize '0|1|2:3' | |
2665 | (or |
|
2665 | (or | |
2666 | (list |
|
2666 | (list | |
2667 | ('symbol', '0') |
|
2667 | ('symbol', '0') | |
2668 | ('symbol', '1') |
|
2668 | ('symbol', '1') | |
2669 | (range |
|
2669 | (range | |
2670 | ('symbol', '2') |
|
2670 | ('symbol', '2') | |
2671 | ('symbol', '3')))) |
|
2671 | ('symbol', '3')))) | |
2672 | * optimized: |
|
2672 | * optimized: | |
2673 | (or |
|
2673 | (or | |
2674 | (list |
|
2674 | (list | |
2675 | (func |
|
2675 | (func | |
2676 | ('symbol', '_list') |
|
2676 | ('symbol', '_list') | |
2677 | ('string', '0\x001') |
|
2677 | ('string', '0\x001') | |
2678 | define) |
|
2678 | define) | |
2679 | (range |
|
2679 | (range | |
2680 | ('symbol', '2') |
|
2680 | ('symbol', '2') | |
2681 | ('symbol', '3') |
|
2681 | ('symbol', '3') | |
2682 | define)) |
|
2682 | define)) | |
2683 | define) |
|
2683 | define) | |
2684 | * set: |
|
2684 | * set: | |
2685 | <addset |
|
2685 | <addset | |
2686 | <baseset [0, 1]>, |
|
2686 | <baseset [0, 1]>, | |
2687 | <spanset+ 2:4>> |
|
2687 | <spanset+ 2:4>> | |
2688 | 0 |
|
2688 | 0 | |
2689 | 1 |
|
2689 | 1 | |
2690 | 2 |
|
2690 | 2 | |
2691 | 3 |
|
2691 | 3 | |
2692 |
|
2692 | |||
2693 | $ try --optimize '0:1|2|3:4|5|6' |
|
2693 | $ try --optimize '0:1|2|3:4|5|6' | |
2694 | (or |
|
2694 | (or | |
2695 | (list |
|
2695 | (list | |
2696 | (range |
|
2696 | (range | |
2697 | ('symbol', '0') |
|
2697 | ('symbol', '0') | |
2698 | ('symbol', '1')) |
|
2698 | ('symbol', '1')) | |
2699 | ('symbol', '2') |
|
2699 | ('symbol', '2') | |
2700 | (range |
|
2700 | (range | |
2701 | ('symbol', '3') |
|
2701 | ('symbol', '3') | |
2702 | ('symbol', '4')) |
|
2702 | ('symbol', '4')) | |
2703 | ('symbol', '5') |
|
2703 | ('symbol', '5') | |
2704 | ('symbol', '6'))) |
|
2704 | ('symbol', '6'))) | |
2705 | * optimized: |
|
2705 | * optimized: | |
2706 | (or |
|
2706 | (or | |
2707 | (list |
|
2707 | (list | |
2708 | (range |
|
2708 | (range | |
2709 | ('symbol', '0') |
|
2709 | ('symbol', '0') | |
2710 | ('symbol', '1') |
|
2710 | ('symbol', '1') | |
2711 | define) |
|
2711 | define) | |
2712 | ('symbol', '2') |
|
2712 | ('symbol', '2') | |
2713 | (range |
|
2713 | (range | |
2714 | ('symbol', '3') |
|
2714 | ('symbol', '3') | |
2715 | ('symbol', '4') |
|
2715 | ('symbol', '4') | |
2716 | define) |
|
2716 | define) | |
2717 | (func |
|
2717 | (func | |
2718 | ('symbol', '_list') |
|
2718 | ('symbol', '_list') | |
2719 | ('string', '5\x006') |
|
2719 | ('string', '5\x006') | |
2720 | define)) |
|
2720 | define)) | |
2721 | define) |
|
2721 | define) | |
2722 | * set: |
|
2722 | * set: | |
2723 | <addset |
|
2723 | <addset | |
2724 | <addset |
|
2724 | <addset | |
2725 | <spanset+ 0:2>, |
|
2725 | <spanset+ 0:2>, | |
2726 | <baseset [2]>>, |
|
2726 | <baseset [2]>>, | |
2727 | <addset |
|
2727 | <addset | |
2728 | <spanset+ 3:5>, |
|
2728 | <spanset+ 3:5>, | |
2729 | <baseset [5, 6]>>> |
|
2729 | <baseset [5, 6]>>> | |
2730 | 0 |
|
2730 | 0 | |
2731 | 1 |
|
2731 | 1 | |
2732 | 2 |
|
2732 | 2 | |
2733 | 3 |
|
2733 | 3 | |
2734 | 4 |
|
2734 | 4 | |
2735 | 5 |
|
2735 | 5 | |
2736 | 6 |
|
2736 | 6 | |
2737 |
|
2737 | |||
2738 | unoptimized `or` looks like this |
|
2738 | unoptimized `or` looks like this | |
2739 |
|
2739 | |||
2740 | $ try --no-optimized -p analyzed '0|1|2|3|4' |
|
2740 | $ try --no-optimized -p analyzed '0|1|2|3|4' | |
2741 | * analyzed: |
|
2741 | * analyzed: | |
2742 | (or |
|
2742 | (or | |
2743 | (list |
|
2743 | (list | |
2744 | ('symbol', '0') |
|
2744 | ('symbol', '0') | |
2745 | ('symbol', '1') |
|
2745 | ('symbol', '1') | |
2746 | ('symbol', '2') |
|
2746 | ('symbol', '2') | |
2747 | ('symbol', '3') |
|
2747 | ('symbol', '3') | |
2748 | ('symbol', '4')) |
|
2748 | ('symbol', '4')) | |
2749 | define) |
|
2749 | define) | |
2750 | * set: |
|
2750 | * set: | |
2751 | <addset |
|
2751 | <addset | |
2752 | <addset |
|
2752 | <addset | |
2753 | <baseset [0]>, |
|
2753 | <baseset [0]>, | |
2754 | <baseset [1]>>, |
|
2754 | <baseset [1]>>, | |
2755 | <addset |
|
2755 | <addset | |
2756 | <baseset [2]>, |
|
2756 | <baseset [2]>, | |
2757 | <addset |
|
2757 | <addset | |
2758 | <baseset [3]>, |
|
2758 | <baseset [3]>, | |
2759 | <baseset [4]>>>> |
|
2759 | <baseset [4]>>>> | |
2760 | 0 |
|
2760 | 0 | |
2761 | 1 |
|
2761 | 1 | |
2762 | 2 |
|
2762 | 2 | |
2763 | 3 |
|
2763 | 3 | |
2764 | 4 |
|
2764 | 4 | |
2765 |
|
2765 | |||
2766 | test that `_list` should be narrowed by provided `subset` |
|
2766 | test that `_list` should be narrowed by provided `subset` | |
2767 |
|
2767 | |||
2768 | $ log '0:2 and (null|1|2|3)' |
|
2768 | $ log '0:2 and (null|1|2|3)' | |
2769 | 1 |
|
2769 | 1 | |
2770 | 2 |
|
2770 | 2 | |
2771 |
|
2771 | |||
2772 | test that `_list` should remove duplicates |
|
2772 | test that `_list` should remove duplicates | |
2773 |
|
2773 | |||
2774 | $ log '0|1|2|1|2|-1|tip' |
|
2774 | $ log '0|1|2|1|2|-1|tip' | |
2775 | 0 |
|
2775 | 0 | |
2776 | 1 |
|
2776 | 1 | |
2777 | 2 |
|
2777 | 2 | |
2778 | 9 |
|
2778 | 9 | |
2779 |
|
2779 | |||
2780 | test unknown revision in `_list` |
|
2780 | test unknown revision in `_list` | |
2781 |
|
2781 | |||
2782 | $ log '0|unknown' |
|
2782 | $ log '0|unknown' | |
2783 | abort: unknown revision 'unknown'! |
|
2783 | abort: unknown revision 'unknown'! | |
2784 | [255] |
|
2784 | [255] | |
2785 |
|
2785 | |||
2786 | test integer range in `_list` |
|
2786 | test integer range in `_list` | |
2787 |
|
2787 | |||
2788 | $ log '-1|-10' |
|
2788 | $ log '-1|-10' | |
2789 | 9 |
|
2789 | 9 | |
2790 | 0 |
|
2790 | 0 | |
2791 |
|
2791 | |||
2792 | $ log '-10|-11' |
|
2792 | $ log '-10|-11' | |
2793 | abort: unknown revision '-11'! |
|
2793 | abort: unknown revision '-11'! | |
2794 | [255] |
|
2794 | [255] | |
2795 |
|
2795 | |||
2796 | $ log '9|10' |
|
2796 | $ log '9|10' | |
2797 | abort: unknown revision '10'! |
|
2797 | abort: unknown revision '10'! | |
2798 | [255] |
|
2798 | [255] | |
2799 |
|
2799 | |||
2800 | test '0000' != '0' in `_list` |
|
2800 | test '0000' != '0' in `_list` | |
2801 |
|
2801 | |||
2802 | $ log '0|0000' |
|
2802 | $ log '0|0000' | |
2803 | 0 |
|
2803 | 0 | |
2804 | -1 |
|
2804 | -1 | |
2805 |
|
2805 | |||
2806 | test ',' in `_list` |
|
2806 | test ',' in `_list` | |
2807 | $ log '0,1' |
|
2807 | $ log '0,1' | |
2808 | hg: parse error: can't use a list in this context |
|
2808 | hg: parse error: can't use a list in this context | |
2809 | (see hg help "revsets.x or y") |
|
2809 | (see hg help "revsets.x or y") | |
2810 | [255] |
|
2810 | [255] | |
2811 | $ try '0,1,2' |
|
2811 | $ try '0,1,2' | |
2812 | (list |
|
2812 | (list | |
2813 | ('symbol', '0') |
|
2813 | ('symbol', '0') | |
2814 | ('symbol', '1') |
|
2814 | ('symbol', '1') | |
2815 | ('symbol', '2')) |
|
2815 | ('symbol', '2')) | |
2816 | hg: parse error: can't use a list in this context |
|
2816 | hg: parse error: can't use a list in this context | |
2817 | (see hg help "revsets.x or y") |
|
2817 | (see hg help "revsets.x or y") | |
2818 | [255] |
|
2818 | [255] | |
2819 |
|
2819 | |||
2820 | test that chained `or` operations make balanced addsets |
|
2820 | test that chained `or` operations make balanced addsets | |
2821 |
|
2821 | |||
2822 | $ try '0:1|1:2|2:3|3:4|4:5' |
|
2822 | $ try '0:1|1:2|2:3|3:4|4:5' | |
2823 | (or |
|
2823 | (or | |
2824 | (list |
|
2824 | (list | |
2825 | (range |
|
2825 | (range | |
2826 | ('symbol', '0') |
|
2826 | ('symbol', '0') | |
2827 | ('symbol', '1')) |
|
2827 | ('symbol', '1')) | |
2828 | (range |
|
2828 | (range | |
2829 | ('symbol', '1') |
|
2829 | ('symbol', '1') | |
2830 | ('symbol', '2')) |
|
2830 | ('symbol', '2')) | |
2831 | (range |
|
2831 | (range | |
2832 | ('symbol', '2') |
|
2832 | ('symbol', '2') | |
2833 | ('symbol', '3')) |
|
2833 | ('symbol', '3')) | |
2834 | (range |
|
2834 | (range | |
2835 | ('symbol', '3') |
|
2835 | ('symbol', '3') | |
2836 | ('symbol', '4')) |
|
2836 | ('symbol', '4')) | |
2837 | (range |
|
2837 | (range | |
2838 | ('symbol', '4') |
|
2838 | ('symbol', '4') | |
2839 | ('symbol', '5')))) |
|
2839 | ('symbol', '5')))) | |
2840 | * set: |
|
2840 | * set: | |
2841 | <addset |
|
2841 | <addset | |
2842 | <addset |
|
2842 | <addset | |
2843 | <spanset+ 0:2>, |
|
2843 | <spanset+ 0:2>, | |
2844 | <spanset+ 1:3>>, |
|
2844 | <spanset+ 1:3>>, | |
2845 | <addset |
|
2845 | <addset | |
2846 | <spanset+ 2:4>, |
|
2846 | <spanset+ 2:4>, | |
2847 | <addset |
|
2847 | <addset | |
2848 | <spanset+ 3:5>, |
|
2848 | <spanset+ 3:5>, | |
2849 | <spanset+ 4:6>>>> |
|
2849 | <spanset+ 4:6>>>> | |
2850 | 0 |
|
2850 | 0 | |
2851 | 1 |
|
2851 | 1 | |
2852 | 2 |
|
2852 | 2 | |
2853 | 3 |
|
2853 | 3 | |
2854 | 4 |
|
2854 | 4 | |
2855 | 5 |
|
2855 | 5 | |
2856 |
|
2856 | |||
2857 | no crash by empty group "()" while optimizing `or` operations |
|
2857 | no crash by empty group "()" while optimizing `or` operations | |
2858 |
|
2858 | |||
2859 | $ try --optimize '0|()' |
|
2859 | $ try --optimize '0|()' | |
2860 | (or |
|
2860 | (or | |
2861 | (list |
|
2861 | (list | |
2862 | ('symbol', '0') |
|
2862 | ('symbol', '0') | |
2863 | (group |
|
2863 | (group | |
2864 | None))) |
|
2864 | None))) | |
2865 | * optimized: |
|
2865 | * optimized: | |
2866 | (or |
|
2866 | (or | |
2867 | (list |
|
2867 | (list | |
2868 | ('symbol', '0') |
|
2868 | ('symbol', '0') | |
2869 | None) |
|
2869 | None) | |
2870 | define) |
|
2870 | define) | |
2871 | hg: parse error: missing argument |
|
2871 | hg: parse error: missing argument | |
2872 | [255] |
|
2872 | [255] | |
2873 |
|
2873 | |||
2874 | test that chained `or` operations never eat up stack (issue4624) |
|
2874 | test that chained `or` operations never eat up stack (issue4624) | |
2875 | (uses `0:1` instead of `0` to avoid future optimization of trivial revisions) |
|
2875 | (uses `0:1` instead of `0` to avoid future optimization of trivial revisions) | |
2876 |
|
2876 | |||
2877 | $ hg log -T '{rev}\n' -r `python -c "print '+'.join(['0:1'] * 500)"` |
|
2877 | $ hg log -T '{rev}\n' -r `python -c "print '+'.join(['0:1'] * 500)"` | |
2878 | 0 |
|
2878 | 0 | |
2879 | 1 |
|
2879 | 1 | |
2880 |
|
2880 | |||
2881 | test that repeated `-r` options never eat up stack (issue4565) |
|
2881 | test that repeated `-r` options never eat up stack (issue4565) | |
2882 | (uses `-r 0::1` to avoid possible optimization at old-style parser) |
|
2882 | (uses `-r 0::1` to avoid possible optimization at old-style parser) | |
2883 |
|
2883 | |||
2884 | $ hg log -T '{rev}\n' `python -c "for i in xrange(500): print '-r 0::1 ',"` |
|
2884 | $ hg log -T '{rev}\n' `python -c "for i in xrange(500): print '-r 0::1 ',"` | |
2885 | 0 |
|
2885 | 0 | |
2886 | 1 |
|
2886 | 1 | |
2887 |
|
2887 | |||
2888 | check that conversion to only works |
|
2888 | check that conversion to only works | |
2889 | $ try --optimize '::3 - ::1' |
|
2889 | $ try --optimize '::3 - ::1' | |
2890 | (minus |
|
2890 | (minus | |
2891 | (dagrangepre |
|
2891 | (dagrangepre | |
2892 | ('symbol', '3')) |
|
2892 | ('symbol', '3')) | |
2893 | (dagrangepre |
|
2893 | (dagrangepre | |
2894 | ('symbol', '1'))) |
|
2894 | ('symbol', '1'))) | |
2895 | * optimized: |
|
2895 | * optimized: | |
2896 | (func |
|
2896 | (func | |
2897 | ('symbol', 'only') |
|
2897 | ('symbol', 'only') | |
2898 | (list |
|
2898 | (list | |
2899 | ('symbol', '3') |
|
2899 | ('symbol', '3') | |
2900 | ('symbol', '1')) |
|
2900 | ('symbol', '1')) | |
2901 | define) |
|
2901 | define) | |
2902 | * set: |
|
2902 | * set: | |
2903 | <baseset+ [3]> |
|
2903 | <baseset+ [3]> | |
2904 | 3 |
|
2904 | 3 | |
2905 | $ try --optimize 'ancestors(1) - ancestors(3)' |
|
2905 | $ try --optimize 'ancestors(1) - ancestors(3)' | |
2906 | (minus |
|
2906 | (minus | |
2907 | (func |
|
2907 | (func | |
2908 | ('symbol', 'ancestors') |
|
2908 | ('symbol', 'ancestors') | |
2909 | ('symbol', '1')) |
|
2909 | ('symbol', '1')) | |
2910 | (func |
|
2910 | (func | |
2911 | ('symbol', 'ancestors') |
|
2911 | ('symbol', 'ancestors') | |
2912 | ('symbol', '3'))) |
|
2912 | ('symbol', '3'))) | |
2913 | * optimized: |
|
2913 | * optimized: | |
2914 | (func |
|
2914 | (func | |
2915 | ('symbol', 'only') |
|
2915 | ('symbol', 'only') | |
2916 | (list |
|
2916 | (list | |
2917 | ('symbol', '1') |
|
2917 | ('symbol', '1') | |
2918 | ('symbol', '3')) |
|
2918 | ('symbol', '3')) | |
2919 | define) |
|
2919 | define) | |
2920 | * set: |
|
2920 | * set: | |
2921 | <baseset+ []> |
|
2921 | <baseset+ []> | |
2922 | $ try --optimize 'not ::2 and ::6' |
|
2922 | $ try --optimize 'not ::2 and ::6' | |
2923 | (and |
|
2923 | (and | |
2924 | (not |
|
2924 | (not | |
2925 | (dagrangepre |
|
2925 | (dagrangepre | |
2926 | ('symbol', '2'))) |
|
2926 | ('symbol', '2'))) | |
2927 | (dagrangepre |
|
2927 | (dagrangepre | |
2928 | ('symbol', '6'))) |
|
2928 | ('symbol', '6'))) | |
2929 | * optimized: |
|
2929 | * optimized: | |
2930 | (func |
|
2930 | (func | |
2931 | ('symbol', 'only') |
|
2931 | ('symbol', 'only') | |
2932 | (list |
|
2932 | (list | |
2933 | ('symbol', '6') |
|
2933 | ('symbol', '6') | |
2934 | ('symbol', '2')) |
|
2934 | ('symbol', '2')) | |
2935 | define) |
|
2935 | define) | |
2936 | * set: |
|
2936 | * set: | |
2937 | <baseset+ [3, 4, 5, 6]> |
|
2937 | <baseset+ [3, 4, 5, 6]> | |
2938 | 3 |
|
2938 | 3 | |
2939 | 4 |
|
2939 | 4 | |
2940 | 5 |
|
2940 | 5 | |
2941 | 6 |
|
2941 | 6 | |
2942 | $ try --optimize 'ancestors(6) and not ancestors(4)' |
|
2942 | $ try --optimize 'ancestors(6) and not ancestors(4)' | |
2943 | (and |
|
2943 | (and | |
2944 | (func |
|
2944 | (func | |
2945 | ('symbol', 'ancestors') |
|
2945 | ('symbol', 'ancestors') | |
2946 | ('symbol', '6')) |
|
2946 | ('symbol', '6')) | |
2947 | (not |
|
2947 | (not | |
2948 | (func |
|
2948 | (func | |
2949 | ('symbol', 'ancestors') |
|
2949 | ('symbol', 'ancestors') | |
2950 | ('symbol', '4')))) |
|
2950 | ('symbol', '4')))) | |
2951 | * optimized: |
|
2951 | * optimized: | |
2952 | (func |
|
2952 | (func | |
2953 | ('symbol', 'only') |
|
2953 | ('symbol', 'only') | |
2954 | (list |
|
2954 | (list | |
2955 | ('symbol', '6') |
|
2955 | ('symbol', '6') | |
2956 | ('symbol', '4')) |
|
2956 | ('symbol', '4')) | |
2957 | define) |
|
2957 | define) | |
2958 | * set: |
|
2958 | * set: | |
2959 | <baseset+ [3, 5, 6]> |
|
2959 | <baseset+ [3, 5, 6]> | |
2960 | 3 |
|
2960 | 3 | |
2961 | 5 |
|
2961 | 5 | |
2962 | 6 |
|
2962 | 6 | |
2963 |
|
2963 | |||
2964 | no crash by empty group "()" while optimizing to "only()" |
|
2964 | no crash by empty group "()" while optimizing to "only()" | |
2965 |
|
2965 | |||
2966 | $ try --optimize '::1 and ()' |
|
2966 | $ try --optimize '::1 and ()' | |
2967 | (and |
|
2967 | (and | |
2968 | (dagrangepre |
|
2968 | (dagrangepre | |
2969 | ('symbol', '1')) |
|
2969 | ('symbol', '1')) | |
2970 | (group |
|
2970 | (group | |
2971 | None)) |
|
2971 | None)) | |
2972 | * optimized: |
|
2972 | * optimized: | |
2973 | (and |
|
2973 | (and | |
2974 | None |
|
2974 | None | |
2975 | (func |
|
2975 | (func | |
2976 | ('symbol', 'ancestors') |
|
2976 | ('symbol', 'ancestors') | |
2977 | ('symbol', '1') |
|
2977 | ('symbol', '1') | |
2978 | define) |
|
2978 | define) | |
2979 | define) |
|
2979 | define) | |
2980 | hg: parse error: missing argument |
|
2980 | hg: parse error: missing argument | |
2981 | [255] |
|
2981 | [255] | |
2982 |
|
2982 | |||
|
2983 | optimization to only() works only if ancestors() takes only one argument | |||
|
2984 | ||||
|
2985 | $ hg debugrevspec -p optimized 'ancestors(6) - ancestors(4, 1)' | |||
|
2986 | * optimized: | |||
|
2987 | (difference | |||
|
2988 | (func | |||
|
2989 | ('symbol', 'ancestors') | |||
|
2990 | ('symbol', '6') | |||
|
2991 | define) | |||
|
2992 | (func | |||
|
2993 | ('symbol', 'ancestors') | |||
|
2994 | (list | |||
|
2995 | ('symbol', '4') | |||
|
2996 | ('symbol', '1')) | |||
|
2997 | any) | |||
|
2998 | define) | |||
|
2999 | hg: parse error: can't use a list in this context | |||
|
3000 | (see hg help "revsets.x or y") | |||
|
3001 | [255] | |||
|
3002 | $ hg debugrevspec -p optimized 'ancestors(6, 1) - ancestors(4)' | |||
|
3003 | * optimized: | |||
|
3004 | (difference | |||
|
3005 | (func | |||
|
3006 | ('symbol', 'ancestors') | |||
|
3007 | (list | |||
|
3008 | ('symbol', '6') | |||
|
3009 | ('symbol', '1')) | |||
|
3010 | define) | |||
|
3011 | (func | |||
|
3012 | ('symbol', 'ancestors') | |||
|
3013 | ('symbol', '4') | |||
|
3014 | any) | |||
|
3015 | define) | |||
|
3016 | hg: parse error: can't use a list in this context | |||
|
3017 | (see hg help "revsets.x or y") | |||
|
3018 | [255] | |||
|
3019 | ||||
|
3020 | optimization disabled if keyword arguments passed (because we're too lazy | |||
|
3021 | to support it) | |||
|
3022 | ||||
|
3023 | $ hg debugrevspec -p optimized 'ancestors(set=6) - ancestors(set=4)' | |||
|
3024 | * optimized: | |||
|
3025 | (difference | |||
|
3026 | (func | |||
|
3027 | ('symbol', 'ancestors') | |||
|
3028 | (keyvalue | |||
|
3029 | ('symbol', 'set') | |||
|
3030 | ('symbol', '6')) | |||
|
3031 | define) | |||
|
3032 | (func | |||
|
3033 | ('symbol', 'ancestors') | |||
|
3034 | (keyvalue | |||
|
3035 | ('symbol', 'set') | |||
|
3036 | ('symbol', '4')) | |||
|
3037 | any) | |||
|
3038 | define) | |||
|
3039 | hg: parse error: can't use a key-value pair in this context | |||
|
3040 | [255] | |||
|
3041 | ||||
2983 | invalid function call should not be optimized to only() |
|
3042 | invalid function call should not be optimized to only() | |
2984 |
|
3043 | |||
2985 | $ log '"ancestors"(6) and not ancestors(4)' |
|
3044 | $ log '"ancestors"(6) and not ancestors(4)' | |
2986 | hg: parse error: not a symbol |
|
3045 | hg: parse error: not a symbol | |
2987 | [255] |
|
3046 | [255] | |
2988 |
|
3047 | |||
2989 | $ log 'ancestors(6) and not "ancestors"(4)' |
|
3048 | $ log 'ancestors(6) and not "ancestors"(4)' | |
2990 | hg: parse error: not a symbol |
|
3049 | hg: parse error: not a symbol | |
2991 | [255] |
|
3050 | [255] | |
2992 |
|
3051 | |||
2993 | we can use patterns when searching for tags |
|
3052 | we can use patterns when searching for tags | |
2994 |
|
3053 | |||
2995 | $ log 'tag("1..*")' |
|
3054 | $ log 'tag("1..*")' | |
2996 | abort: tag '1..*' does not exist! |
|
3055 | abort: tag '1..*' does not exist! | |
2997 | [255] |
|
3056 | [255] | |
2998 | $ log 'tag("re:1..*")' |
|
3057 | $ log 'tag("re:1..*")' | |
2999 | 6 |
|
3058 | 6 | |
3000 | $ log 'tag("re:[0-9].[0-9]")' |
|
3059 | $ log 'tag("re:[0-9].[0-9]")' | |
3001 | 6 |
|
3060 | 6 | |
3002 | $ log 'tag("literal:1.0")' |
|
3061 | $ log 'tag("literal:1.0")' | |
3003 | 6 |
|
3062 | 6 | |
3004 | $ log 'tag("re:0..*")' |
|
3063 | $ log 'tag("re:0..*")' | |
3005 |
|
3064 | |||
3006 | $ log 'tag(unknown)' |
|
3065 | $ log 'tag(unknown)' | |
3007 | abort: tag 'unknown' does not exist! |
|
3066 | abort: tag 'unknown' does not exist! | |
3008 | [255] |
|
3067 | [255] | |
3009 | $ log 'tag("re:unknown")' |
|
3068 | $ log 'tag("re:unknown")' | |
3010 | $ log 'present(tag("unknown"))' |
|
3069 | $ log 'present(tag("unknown"))' | |
3011 | $ log 'present(tag("re:unknown"))' |
|
3070 | $ log 'present(tag("re:unknown"))' | |
3012 | $ log 'branch(unknown)' |
|
3071 | $ log 'branch(unknown)' | |
3013 | abort: unknown revision 'unknown'! |
|
3072 | abort: unknown revision 'unknown'! | |
3014 | [255] |
|
3073 | [255] | |
3015 | $ log 'branch("literal:unknown")' |
|
3074 | $ log 'branch("literal:unknown")' | |
3016 | abort: branch 'unknown' does not exist! |
|
3075 | abort: branch 'unknown' does not exist! | |
3017 | [255] |
|
3076 | [255] | |
3018 | $ log 'branch("re:unknown")' |
|
3077 | $ log 'branch("re:unknown")' | |
3019 | $ log 'present(branch("unknown"))' |
|
3078 | $ log 'present(branch("unknown"))' | |
3020 | $ log 'present(branch("re:unknown"))' |
|
3079 | $ log 'present(branch("re:unknown"))' | |
3021 | $ log 'user(bob)' |
|
3080 | $ log 'user(bob)' | |
3022 | 2 |
|
3081 | 2 | |
3023 |
|
3082 | |||
3024 | $ log '4::8' |
|
3083 | $ log '4::8' | |
3025 | 4 |
|
3084 | 4 | |
3026 | 8 |
|
3085 | 8 | |
3027 | $ log '4:8' |
|
3086 | $ log '4:8' | |
3028 | 4 |
|
3087 | 4 | |
3029 | 5 |
|
3088 | 5 | |
3030 | 6 |
|
3089 | 6 | |
3031 | 7 |
|
3090 | 7 | |
3032 | 8 |
|
3091 | 8 | |
3033 |
|
3092 | |||
3034 | $ log 'sort(!merge() & (modifies(b) | user(bob) | keyword(bug) | keyword(issue) & 1::9), "-date")' |
|
3093 | $ log 'sort(!merge() & (modifies(b) | user(bob) | keyword(bug) | keyword(issue) & 1::9), "-date")' | |
3035 | 4 |
|
3094 | 4 | |
3036 | 2 |
|
3095 | 2 | |
3037 | 5 |
|
3096 | 5 | |
3038 |
|
3097 | |||
3039 | $ log 'not 0 and 0:2' |
|
3098 | $ log 'not 0 and 0:2' | |
3040 | 1 |
|
3099 | 1 | |
3041 | 2 |
|
3100 | 2 | |
3042 | $ log 'not 1 and 0:2' |
|
3101 | $ log 'not 1 and 0:2' | |
3043 | 0 |
|
3102 | 0 | |
3044 | 2 |
|
3103 | 2 | |
3045 | $ log 'not 2 and 0:2' |
|
3104 | $ log 'not 2 and 0:2' | |
3046 | 0 |
|
3105 | 0 | |
3047 | 1 |
|
3106 | 1 | |
3048 | $ log '(1 and 2)::' |
|
3107 | $ log '(1 and 2)::' | |
3049 | $ log '(1 and 2):' |
|
3108 | $ log '(1 and 2):' | |
3050 | $ log '(1 and 2):3' |
|
3109 | $ log '(1 and 2):3' | |
3051 | $ log 'sort(head(), -rev)' |
|
3110 | $ log 'sort(head(), -rev)' | |
3052 | 9 |
|
3111 | 9 | |
3053 | 7 |
|
3112 | 7 | |
3054 | 6 |
|
3113 | 6 | |
3055 | 5 |
|
3114 | 5 | |
3056 | 4 |
|
3115 | 4 | |
3057 | 3 |
|
3116 | 3 | |
3058 | 2 |
|
3117 | 2 | |
3059 | 1 |
|
3118 | 1 | |
3060 | 0 |
|
3119 | 0 | |
3061 | $ log '4::8 - 8' |
|
3120 | $ log '4::8 - 8' | |
3062 | 4 |
|
3121 | 4 | |
3063 |
|
3122 | |||
3064 | matching() should preserve the order of the input set: |
|
3123 | matching() should preserve the order of the input set: | |
3065 |
|
3124 | |||
3066 | $ log '(2 or 3 or 1) and matching(1 or 2 or 3)' |
|
3125 | $ log '(2 or 3 or 1) and matching(1 or 2 or 3)' | |
3067 | 2 |
|
3126 | 2 | |
3068 | 3 |
|
3127 | 3 | |
3069 | 1 |
|
3128 | 1 | |
3070 |
|
3129 | |||
3071 | $ log 'named("unknown")' |
|
3130 | $ log 'named("unknown")' | |
3072 | abort: namespace 'unknown' does not exist! |
|
3131 | abort: namespace 'unknown' does not exist! | |
3073 | [255] |
|
3132 | [255] | |
3074 | $ log 'named("re:unknown")' |
|
3133 | $ log 'named("re:unknown")' | |
3075 | abort: no namespace exists that match 'unknown'! |
|
3134 | abort: no namespace exists that match 'unknown'! | |
3076 | [255] |
|
3135 | [255] | |
3077 | $ log 'present(named("unknown"))' |
|
3136 | $ log 'present(named("unknown"))' | |
3078 | $ log 'present(named("re:unknown"))' |
|
3137 | $ log 'present(named("re:unknown"))' | |
3079 |
|
3138 | |||
3080 | $ log 'tag()' |
|
3139 | $ log 'tag()' | |
3081 | 6 |
|
3140 | 6 | |
3082 | $ log 'named("tags")' |
|
3141 | $ log 'named("tags")' | |
3083 | 6 |
|
3142 | 6 | |
3084 |
|
3143 | |||
3085 | issue2437 |
|
3144 | issue2437 | |
3086 |
|
3145 | |||
3087 | $ log '3 and p1(5)' |
|
3146 | $ log '3 and p1(5)' | |
3088 | 3 |
|
3147 | 3 | |
3089 | $ log '4 and p2(6)' |
|
3148 | $ log '4 and p2(6)' | |
3090 | 4 |
|
3149 | 4 | |
3091 | $ log '1 and parents(:2)' |
|
3150 | $ log '1 and parents(:2)' | |
3092 | 1 |
|
3151 | 1 | |
3093 | $ log '2 and children(1:)' |
|
3152 | $ log '2 and children(1:)' | |
3094 | 2 |
|
3153 | 2 | |
3095 | $ log 'roots(all()) or roots(all())' |
|
3154 | $ log 'roots(all()) or roots(all())' | |
3096 | 0 |
|
3155 | 0 | |
3097 | $ hg debugrevspec 'roots(all()) or roots(all())' |
|
3156 | $ hg debugrevspec 'roots(all()) or roots(all())' | |
3098 | 0 |
|
3157 | 0 | |
3099 | $ log 'heads(branch(Γ©)) or heads(branch(Γ©))' |
|
3158 | $ log 'heads(branch(Γ©)) or heads(branch(Γ©))' | |
3100 | 9 |
|
3159 | 9 | |
3101 | $ log 'ancestors(8) and (heads(branch("-a-b-c-")) or heads(branch(Γ©)))' |
|
3160 | $ log 'ancestors(8) and (heads(branch("-a-b-c-")) or heads(branch(Γ©)))' | |
3102 | 4 |
|
3161 | 4 | |
3103 |
|
3162 | |||
3104 | issue2654: report a parse error if the revset was not completely parsed |
|
3163 | issue2654: report a parse error if the revset was not completely parsed | |
3105 |
|
3164 | |||
3106 | $ log '1 OR 2' |
|
3165 | $ log '1 OR 2' | |
3107 | hg: parse error at 2: invalid token |
|
3166 | hg: parse error at 2: invalid token | |
3108 | [255] |
|
3167 | [255] | |
3109 |
|
3168 | |||
3110 | or operator should preserve ordering: |
|
3169 | or operator should preserve ordering: | |
3111 | $ log 'reverse(2::4) or tip' |
|
3170 | $ log 'reverse(2::4) or tip' | |
3112 | 4 |
|
3171 | 4 | |
3113 | 2 |
|
3172 | 2 | |
3114 | 9 |
|
3173 | 9 | |
3115 |
|
3174 | |||
3116 | parentrevspec |
|
3175 | parentrevspec | |
3117 |
|
3176 | |||
3118 | $ log 'merge()^0' |
|
3177 | $ log 'merge()^0' | |
3119 | 6 |
|
3178 | 6 | |
3120 | $ log 'merge()^' |
|
3179 | $ log 'merge()^' | |
3121 | 5 |
|
3180 | 5 | |
3122 | $ log 'merge()^1' |
|
3181 | $ log 'merge()^1' | |
3123 | 5 |
|
3182 | 5 | |
3124 | $ log 'merge()^2' |
|
3183 | $ log 'merge()^2' | |
3125 | 4 |
|
3184 | 4 | |
3126 | $ log '(not merge())^2' |
|
3185 | $ log '(not merge())^2' | |
3127 | $ log 'merge()^^' |
|
3186 | $ log 'merge()^^' | |
3128 | 3 |
|
3187 | 3 | |
3129 | $ log 'merge()^1^' |
|
3188 | $ log 'merge()^1^' | |
3130 | 3 |
|
3189 | 3 | |
3131 | $ log 'merge()^^^' |
|
3190 | $ log 'merge()^^^' | |
3132 | 1 |
|
3191 | 1 | |
3133 |
|
3192 | |||
3134 | $ hg debugrevspec -s '(merge() | 0)~-1' |
|
3193 | $ hg debugrevspec -s '(merge() | 0)~-1' | |
3135 | * set: |
|
3194 | * set: | |
3136 | <baseset+ [1, 7]> |
|
3195 | <baseset+ [1, 7]> | |
3137 | 1 |
|
3196 | 1 | |
3138 | 7 |
|
3197 | 7 | |
3139 | $ log 'merge()~-1' |
|
3198 | $ log 'merge()~-1' | |
3140 | 7 |
|
3199 | 7 | |
3141 | $ log 'tip~-1' |
|
3200 | $ log 'tip~-1' | |
3142 | $ log '(tip | merge())~-1' |
|
3201 | $ log '(tip | merge())~-1' | |
3143 | 7 |
|
3202 | 7 | |
3144 | $ log 'merge()~0' |
|
3203 | $ log 'merge()~0' | |
3145 | 6 |
|
3204 | 6 | |
3146 | $ log 'merge()~1' |
|
3205 | $ log 'merge()~1' | |
3147 | 5 |
|
3206 | 5 | |
3148 | $ log 'merge()~2' |
|
3207 | $ log 'merge()~2' | |
3149 | 3 |
|
3208 | 3 | |
3150 | $ log 'merge()~2^1' |
|
3209 | $ log 'merge()~2^1' | |
3151 | 1 |
|
3210 | 1 | |
3152 | $ log 'merge()~3' |
|
3211 | $ log 'merge()~3' | |
3153 | 1 |
|
3212 | 1 | |
3154 |
|
3213 | |||
3155 | $ log '(-3:tip)^' |
|
3214 | $ log '(-3:tip)^' | |
3156 | 4 |
|
3215 | 4 | |
3157 | 6 |
|
3216 | 6 | |
3158 | 8 |
|
3217 | 8 | |
3159 |
|
3218 | |||
3160 | $ log 'tip^foo' |
|
3219 | $ log 'tip^foo' | |
3161 | hg: parse error: ^ expects a number 0, 1, or 2 |
|
3220 | hg: parse error: ^ expects a number 0, 1, or 2 | |
3162 | [255] |
|
3221 | [255] | |
3163 |
|
3222 | |||
3164 | $ log 'branchpoint()~-1' |
|
3223 | $ log 'branchpoint()~-1' | |
3165 | abort: revision in set has more than one child! |
|
3224 | abort: revision in set has more than one child! | |
3166 | [255] |
|
3225 | [255] | |
3167 |
|
3226 | |||
3168 | Bogus function gets suggestions |
|
3227 | Bogus function gets suggestions | |
3169 | $ log 'add()' |
|
3228 | $ log 'add()' | |
3170 | hg: parse error: unknown identifier: add |
|
3229 | hg: parse error: unknown identifier: add | |
3171 | (did you mean adds?) |
|
3230 | (did you mean adds?) | |
3172 | [255] |
|
3231 | [255] | |
3173 | $ log 'added()' |
|
3232 | $ log 'added()' | |
3174 | hg: parse error: unknown identifier: added |
|
3233 | hg: parse error: unknown identifier: added | |
3175 | (did you mean adds?) |
|
3234 | (did you mean adds?) | |
3176 | [255] |
|
3235 | [255] | |
3177 | $ log 'remo()' |
|
3236 | $ log 'remo()' | |
3178 | hg: parse error: unknown identifier: remo |
|
3237 | hg: parse error: unknown identifier: remo | |
3179 | (did you mean one of remote, removes?) |
|
3238 | (did you mean one of remote, removes?) | |
3180 | [255] |
|
3239 | [255] | |
3181 | $ log 'babar()' |
|
3240 | $ log 'babar()' | |
3182 | hg: parse error: unknown identifier: babar |
|
3241 | hg: parse error: unknown identifier: babar | |
3183 | [255] |
|
3242 | [255] | |
3184 |
|
3243 | |||
3185 | Bogus function with a similar internal name doesn't suggest the internal name |
|
3244 | Bogus function with a similar internal name doesn't suggest the internal name | |
3186 | $ log 'matches()' |
|
3245 | $ log 'matches()' | |
3187 | hg: parse error: unknown identifier: matches |
|
3246 | hg: parse error: unknown identifier: matches | |
3188 | (did you mean matching?) |
|
3247 | (did you mean matching?) | |
3189 | [255] |
|
3248 | [255] | |
3190 |
|
3249 | |||
3191 | Undocumented functions aren't suggested as similar either |
|
3250 | Undocumented functions aren't suggested as similar either | |
3192 | $ log 'tagged2()' |
|
3251 | $ log 'tagged2()' | |
3193 | hg: parse error: unknown identifier: tagged2 |
|
3252 | hg: parse error: unknown identifier: tagged2 | |
3194 | [255] |
|
3253 | [255] | |
3195 |
|
3254 | |||
3196 | multiple revspecs |
|
3255 | multiple revspecs | |
3197 |
|
3256 | |||
3198 | $ hg log -r 'tip~1:tip' -r 'tip~2:tip~1' --template '{rev}\n' |
|
3257 | $ hg log -r 'tip~1:tip' -r 'tip~2:tip~1' --template '{rev}\n' | |
3199 | 8 |
|
3258 | 8 | |
3200 | 9 |
|
3259 | 9 | |
3201 | 4 |
|
3260 | 4 | |
3202 | 5 |
|
3261 | 5 | |
3203 | 6 |
|
3262 | 6 | |
3204 | 7 |
|
3263 | 7 | |
3205 |
|
3264 | |||
3206 | test usage in revpair (with "+") |
|
3265 | test usage in revpair (with "+") | |
3207 |
|
3266 | |||
3208 | (real pair) |
|
3267 | (real pair) | |
3209 |
|
3268 | |||
3210 | $ hg diff -r 'tip^^' -r 'tip' |
|
3269 | $ hg diff -r 'tip^^' -r 'tip' | |
3211 | diff -r 2326846efdab -r 24286f4ae135 .hgtags |
|
3270 | diff -r 2326846efdab -r 24286f4ae135 .hgtags | |
3212 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
3271 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
3213 | +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000 |
|
3272 | +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000 | |
3214 | @@ -0,0 +1,1 @@ |
|
3273 | @@ -0,0 +1,1 @@ | |
3215 | +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0 |
|
3274 | +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0 | |
3216 | $ hg diff -r 'tip^^::tip' |
|
3275 | $ hg diff -r 'tip^^::tip' | |
3217 | diff -r 2326846efdab -r 24286f4ae135 .hgtags |
|
3276 | diff -r 2326846efdab -r 24286f4ae135 .hgtags | |
3218 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
3277 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
3219 | +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000 |
|
3278 | +++ b/.hgtags Thu Jan 01 00:00:00 1970 +0000 | |
3220 | @@ -0,0 +1,1 @@ |
|
3279 | @@ -0,0 +1,1 @@ | |
3221 | +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0 |
|
3280 | +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0 | |
3222 |
|
3281 | |||
3223 | (single rev) |
|
3282 | (single rev) | |
3224 |
|
3283 | |||
3225 | $ hg diff -r 'tip^' -r 'tip^' |
|
3284 | $ hg diff -r 'tip^' -r 'tip^' | |
3226 | $ hg diff -r 'tip^:tip^' |
|
3285 | $ hg diff -r 'tip^:tip^' | |
3227 |
|
3286 | |||
3228 | (single rev that does not looks like a range) |
|
3287 | (single rev that does not looks like a range) | |
3229 |
|
3288 | |||
3230 | $ hg diff -r 'tip^::tip^ or tip^' |
|
3289 | $ hg diff -r 'tip^::tip^ or tip^' | |
3231 | diff -r d5d0dcbdc4d9 .hgtags |
|
3290 | diff -r d5d0dcbdc4d9 .hgtags | |
3232 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
3291 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
3233 | +++ b/.hgtags * (glob) |
|
3292 | +++ b/.hgtags * (glob) | |
3234 | @@ -0,0 +1,1 @@ |
|
3293 | @@ -0,0 +1,1 @@ | |
3235 | +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0 |
|
3294 | +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0 | |
3236 | $ hg diff -r 'tip^ or tip^' |
|
3295 | $ hg diff -r 'tip^ or tip^' | |
3237 | diff -r d5d0dcbdc4d9 .hgtags |
|
3296 | diff -r d5d0dcbdc4d9 .hgtags | |
3238 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
3297 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
3239 | +++ b/.hgtags * (glob) |
|
3298 | +++ b/.hgtags * (glob) | |
3240 | @@ -0,0 +1,1 @@ |
|
3299 | @@ -0,0 +1,1 @@ | |
3241 | +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0 |
|
3300 | +e0cc66ef77e8b6f711815af4e001a6594fde3ba5 1.0 | |
3242 |
|
3301 | |||
3243 | (no rev) |
|
3302 | (no rev) | |
3244 |
|
3303 | |||
3245 | $ hg diff -r 'author("babar") or author("celeste")' |
|
3304 | $ hg diff -r 'author("babar") or author("celeste")' | |
3246 | abort: empty revision range |
|
3305 | abort: empty revision range | |
3247 | [255] |
|
3306 | [255] | |
3248 |
|
3307 | |||
3249 | aliases: |
|
3308 | aliases: | |
3250 |
|
3309 | |||
3251 | $ echo '[revsetalias]' >> .hg/hgrc |
|
3310 | $ echo '[revsetalias]' >> .hg/hgrc | |
3252 | $ echo 'm = merge()' >> .hg/hgrc |
|
3311 | $ echo 'm = merge()' >> .hg/hgrc | |
3253 | (revset aliases can override builtin revsets) |
|
3312 | (revset aliases can override builtin revsets) | |
3254 | $ echo 'p2($1) = p1($1)' >> .hg/hgrc |
|
3313 | $ echo 'p2($1) = p1($1)' >> .hg/hgrc | |
3255 | $ echo 'sincem = descendants(m)' >> .hg/hgrc |
|
3314 | $ echo 'sincem = descendants(m)' >> .hg/hgrc | |
3256 | $ echo 'd($1) = reverse(sort($1, date))' >> .hg/hgrc |
|
3315 | $ echo 'd($1) = reverse(sort($1, date))' >> .hg/hgrc | |
3257 | $ echo 'rs(ARG1, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc |
|
3316 | $ echo 'rs(ARG1, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc | |
3258 | $ echo 'rs4(ARG1, ARGA, ARGB, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc |
|
3317 | $ echo 'rs4(ARG1, ARGA, ARGB, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc | |
3259 |
|
3318 | |||
3260 | $ try m |
|
3319 | $ try m | |
3261 | ('symbol', 'm') |
|
3320 | ('symbol', 'm') | |
3262 | * expanded: |
|
3321 | * expanded: | |
3263 | (func |
|
3322 | (func | |
3264 | ('symbol', 'merge') |
|
3323 | ('symbol', 'merge') | |
3265 | None) |
|
3324 | None) | |
3266 | * set: |
|
3325 | * set: | |
3267 | <filteredset |
|
3326 | <filteredset | |
3268 | <fullreposet+ 0:10>, |
|
3327 | <fullreposet+ 0:10>, | |
3269 | <merge>> |
|
3328 | <merge>> | |
3270 | 6 |
|
3329 | 6 | |
3271 |
|
3330 | |||
3272 | $ HGPLAIN=1 |
|
3331 | $ HGPLAIN=1 | |
3273 | $ export HGPLAIN |
|
3332 | $ export HGPLAIN | |
3274 | $ try m |
|
3333 | $ try m | |
3275 | ('symbol', 'm') |
|
3334 | ('symbol', 'm') | |
3276 | abort: unknown revision 'm'! |
|
3335 | abort: unknown revision 'm'! | |
3277 | [255] |
|
3336 | [255] | |
3278 |
|
3337 | |||
3279 | $ HGPLAINEXCEPT=revsetalias |
|
3338 | $ HGPLAINEXCEPT=revsetalias | |
3280 | $ export HGPLAINEXCEPT |
|
3339 | $ export HGPLAINEXCEPT | |
3281 | $ try m |
|
3340 | $ try m | |
3282 | ('symbol', 'm') |
|
3341 | ('symbol', 'm') | |
3283 | * expanded: |
|
3342 | * expanded: | |
3284 | (func |
|
3343 | (func | |
3285 | ('symbol', 'merge') |
|
3344 | ('symbol', 'merge') | |
3286 | None) |
|
3345 | None) | |
3287 | * set: |
|
3346 | * set: | |
3288 | <filteredset |
|
3347 | <filteredset | |
3289 | <fullreposet+ 0:10>, |
|
3348 | <fullreposet+ 0:10>, | |
3290 | <merge>> |
|
3349 | <merge>> | |
3291 | 6 |
|
3350 | 6 | |
3292 |
|
3351 | |||
3293 | $ unset HGPLAIN |
|
3352 | $ unset HGPLAIN | |
3294 | $ unset HGPLAINEXCEPT |
|
3353 | $ unset HGPLAINEXCEPT | |
3295 |
|
3354 | |||
3296 | $ try 'p2(.)' |
|
3355 | $ try 'p2(.)' | |
3297 | (func |
|
3356 | (func | |
3298 | ('symbol', 'p2') |
|
3357 | ('symbol', 'p2') | |
3299 | ('symbol', '.')) |
|
3358 | ('symbol', '.')) | |
3300 | * expanded: |
|
3359 | * expanded: | |
3301 | (func |
|
3360 | (func | |
3302 | ('symbol', 'p1') |
|
3361 | ('symbol', 'p1') | |
3303 | ('symbol', '.')) |
|
3362 | ('symbol', '.')) | |
3304 | * set: |
|
3363 | * set: | |
3305 | <baseset+ [8]> |
|
3364 | <baseset+ [8]> | |
3306 | 8 |
|
3365 | 8 | |
3307 |
|
3366 | |||
3308 | $ HGPLAIN=1 |
|
3367 | $ HGPLAIN=1 | |
3309 | $ export HGPLAIN |
|
3368 | $ export HGPLAIN | |
3310 | $ try 'p2(.)' |
|
3369 | $ try 'p2(.)' | |
3311 | (func |
|
3370 | (func | |
3312 | ('symbol', 'p2') |
|
3371 | ('symbol', 'p2') | |
3313 | ('symbol', '.')) |
|
3372 | ('symbol', '.')) | |
3314 | * set: |
|
3373 | * set: | |
3315 | <baseset+ []> |
|
3374 | <baseset+ []> | |
3316 |
|
3375 | |||
3317 | $ HGPLAINEXCEPT=revsetalias |
|
3376 | $ HGPLAINEXCEPT=revsetalias | |
3318 | $ export HGPLAINEXCEPT |
|
3377 | $ export HGPLAINEXCEPT | |
3319 | $ try 'p2(.)' |
|
3378 | $ try 'p2(.)' | |
3320 | (func |
|
3379 | (func | |
3321 | ('symbol', 'p2') |
|
3380 | ('symbol', 'p2') | |
3322 | ('symbol', '.')) |
|
3381 | ('symbol', '.')) | |
3323 | * expanded: |
|
3382 | * expanded: | |
3324 | (func |
|
3383 | (func | |
3325 | ('symbol', 'p1') |
|
3384 | ('symbol', 'p1') | |
3326 | ('symbol', '.')) |
|
3385 | ('symbol', '.')) | |
3327 | * set: |
|
3386 | * set: | |
3328 | <baseset+ [8]> |
|
3387 | <baseset+ [8]> | |
3329 | 8 |
|
3388 | 8 | |
3330 |
|
3389 | |||
3331 | $ unset HGPLAIN |
|
3390 | $ unset HGPLAIN | |
3332 | $ unset HGPLAINEXCEPT |
|
3391 | $ unset HGPLAINEXCEPT | |
3333 |
|
3392 | |||
3334 | test alias recursion |
|
3393 | test alias recursion | |
3335 |
|
3394 | |||
3336 | $ try sincem |
|
3395 | $ try sincem | |
3337 | ('symbol', 'sincem') |
|
3396 | ('symbol', 'sincem') | |
3338 | * expanded: |
|
3397 | * expanded: | |
3339 | (func |
|
3398 | (func | |
3340 | ('symbol', 'descendants') |
|
3399 | ('symbol', 'descendants') | |
3341 | (func |
|
3400 | (func | |
3342 | ('symbol', 'merge') |
|
3401 | ('symbol', 'merge') | |
3343 | None)) |
|
3402 | None)) | |
3344 | * set: |
|
3403 | * set: | |
3345 | <addset+ |
|
3404 | <addset+ | |
3346 | <filteredset |
|
3405 | <filteredset | |
3347 | <fullreposet+ 0:10>, |
|
3406 | <fullreposet+ 0:10>, | |
3348 | <merge>>, |
|
3407 | <merge>>, | |
3349 | <generatorset+>> |
|
3408 | <generatorset+>> | |
3350 | 6 |
|
3409 | 6 | |
3351 | 7 |
|
3410 | 7 | |
3352 |
|
3411 | |||
3353 | test infinite recursion |
|
3412 | test infinite recursion | |
3354 |
|
3413 | |||
3355 | $ echo 'recurse1 = recurse2' >> .hg/hgrc |
|
3414 | $ echo 'recurse1 = recurse2' >> .hg/hgrc | |
3356 | $ echo 'recurse2 = recurse1' >> .hg/hgrc |
|
3415 | $ echo 'recurse2 = recurse1' >> .hg/hgrc | |
3357 | $ try recurse1 |
|
3416 | $ try recurse1 | |
3358 | ('symbol', 'recurse1') |
|
3417 | ('symbol', 'recurse1') | |
3359 | hg: parse error: infinite expansion of revset alias "recurse1" detected |
|
3418 | hg: parse error: infinite expansion of revset alias "recurse1" detected | |
3360 | [255] |
|
3419 | [255] | |
3361 |
|
3420 | |||
3362 | $ echo 'level1($1, $2) = $1 or $2' >> .hg/hgrc |
|
3421 | $ echo 'level1($1, $2) = $1 or $2' >> .hg/hgrc | |
3363 | $ echo 'level2($1, $2) = level1($2, $1)' >> .hg/hgrc |
|
3422 | $ echo 'level2($1, $2) = level1($2, $1)' >> .hg/hgrc | |
3364 | $ try "level2(level1(1, 2), 3)" |
|
3423 | $ try "level2(level1(1, 2), 3)" | |
3365 | (func |
|
3424 | (func | |
3366 | ('symbol', 'level2') |
|
3425 | ('symbol', 'level2') | |
3367 | (list |
|
3426 | (list | |
3368 | (func |
|
3427 | (func | |
3369 | ('symbol', 'level1') |
|
3428 | ('symbol', 'level1') | |
3370 | (list |
|
3429 | (list | |
3371 | ('symbol', '1') |
|
3430 | ('symbol', '1') | |
3372 | ('symbol', '2'))) |
|
3431 | ('symbol', '2'))) | |
3373 | ('symbol', '3'))) |
|
3432 | ('symbol', '3'))) | |
3374 | * expanded: |
|
3433 | * expanded: | |
3375 | (or |
|
3434 | (or | |
3376 | (list |
|
3435 | (list | |
3377 | ('symbol', '3') |
|
3436 | ('symbol', '3') | |
3378 | (or |
|
3437 | (or | |
3379 | (list |
|
3438 | (list | |
3380 | ('symbol', '1') |
|
3439 | ('symbol', '1') | |
3381 | ('symbol', '2'))))) |
|
3440 | ('symbol', '2'))))) | |
3382 | * set: |
|
3441 | * set: | |
3383 | <addset |
|
3442 | <addset | |
3384 | <baseset [3]>, |
|
3443 | <baseset [3]>, | |
3385 | <baseset [1, 2]>> |
|
3444 | <baseset [1, 2]>> | |
3386 | 3 |
|
3445 | 3 | |
3387 | 1 |
|
3446 | 1 | |
3388 | 2 |
|
3447 | 2 | |
3389 |
|
3448 | |||
3390 | test nesting and variable passing |
|
3449 | test nesting and variable passing | |
3391 |
|
3450 | |||
3392 | $ echo 'nested($1) = nested2($1)' >> .hg/hgrc |
|
3451 | $ echo 'nested($1) = nested2($1)' >> .hg/hgrc | |
3393 | $ echo 'nested2($1) = nested3($1)' >> .hg/hgrc |
|
3452 | $ echo 'nested2($1) = nested3($1)' >> .hg/hgrc | |
3394 | $ echo 'nested3($1) = max($1)' >> .hg/hgrc |
|
3453 | $ echo 'nested3($1) = max($1)' >> .hg/hgrc | |
3395 | $ try 'nested(2:5)' |
|
3454 | $ try 'nested(2:5)' | |
3396 | (func |
|
3455 | (func | |
3397 | ('symbol', 'nested') |
|
3456 | ('symbol', 'nested') | |
3398 | (range |
|
3457 | (range | |
3399 | ('symbol', '2') |
|
3458 | ('symbol', '2') | |
3400 | ('symbol', '5'))) |
|
3459 | ('symbol', '5'))) | |
3401 | * expanded: |
|
3460 | * expanded: | |
3402 | (func |
|
3461 | (func | |
3403 | ('symbol', 'max') |
|
3462 | ('symbol', 'max') | |
3404 | (range |
|
3463 | (range | |
3405 | ('symbol', '2') |
|
3464 | ('symbol', '2') | |
3406 | ('symbol', '5'))) |
|
3465 | ('symbol', '5'))) | |
3407 | * set: |
|
3466 | * set: | |
3408 | <baseset |
|
3467 | <baseset | |
3409 | <max |
|
3468 | <max | |
3410 | <fullreposet+ 0:10>, |
|
3469 | <fullreposet+ 0:10>, | |
3411 | <spanset+ 2:6>>> |
|
3470 | <spanset+ 2:6>>> | |
3412 | 5 |
|
3471 | 5 | |
3413 |
|
3472 | |||
3414 | test chained `or` operations are flattened at parsing phase |
|
3473 | test chained `or` operations are flattened at parsing phase | |
3415 |
|
3474 | |||
3416 | $ echo 'chainedorops($1, $2, $3) = $1|$2|$3' >> .hg/hgrc |
|
3475 | $ echo 'chainedorops($1, $2, $3) = $1|$2|$3' >> .hg/hgrc | |
3417 | $ try 'chainedorops(0:1, 1:2, 2:3)' |
|
3476 | $ try 'chainedorops(0:1, 1:2, 2:3)' | |
3418 | (func |
|
3477 | (func | |
3419 | ('symbol', 'chainedorops') |
|
3478 | ('symbol', 'chainedorops') | |
3420 | (list |
|
3479 | (list | |
3421 | (range |
|
3480 | (range | |
3422 | ('symbol', '0') |
|
3481 | ('symbol', '0') | |
3423 | ('symbol', '1')) |
|
3482 | ('symbol', '1')) | |
3424 | (range |
|
3483 | (range | |
3425 | ('symbol', '1') |
|
3484 | ('symbol', '1') | |
3426 | ('symbol', '2')) |
|
3485 | ('symbol', '2')) | |
3427 | (range |
|
3486 | (range | |
3428 | ('symbol', '2') |
|
3487 | ('symbol', '2') | |
3429 | ('symbol', '3')))) |
|
3488 | ('symbol', '3')))) | |
3430 | * expanded: |
|
3489 | * expanded: | |
3431 | (or |
|
3490 | (or | |
3432 | (list |
|
3491 | (list | |
3433 | (range |
|
3492 | (range | |
3434 | ('symbol', '0') |
|
3493 | ('symbol', '0') | |
3435 | ('symbol', '1')) |
|
3494 | ('symbol', '1')) | |
3436 | (range |
|
3495 | (range | |
3437 | ('symbol', '1') |
|
3496 | ('symbol', '1') | |
3438 | ('symbol', '2')) |
|
3497 | ('symbol', '2')) | |
3439 | (range |
|
3498 | (range | |
3440 | ('symbol', '2') |
|
3499 | ('symbol', '2') | |
3441 | ('symbol', '3')))) |
|
3500 | ('symbol', '3')))) | |
3442 | * set: |
|
3501 | * set: | |
3443 | <addset |
|
3502 | <addset | |
3444 | <spanset+ 0:2>, |
|
3503 | <spanset+ 0:2>, | |
3445 | <addset |
|
3504 | <addset | |
3446 | <spanset+ 1:3>, |
|
3505 | <spanset+ 1:3>, | |
3447 | <spanset+ 2:4>>> |
|
3506 | <spanset+ 2:4>>> | |
3448 | 0 |
|
3507 | 0 | |
3449 | 1 |
|
3508 | 1 | |
3450 | 2 |
|
3509 | 2 | |
3451 | 3 |
|
3510 | 3 | |
3452 |
|
3511 | |||
3453 | test variable isolation, variable placeholders are rewritten as string |
|
3512 | test variable isolation, variable placeholders are rewritten as string | |
3454 | then parsed and matched again as string. Check they do not leak too |
|
3513 | then parsed and matched again as string. Check they do not leak too | |
3455 | far away. |
|
3514 | far away. | |
3456 |
|
3515 | |||
3457 | $ echo 'injectparamasstring = max("$1")' >> .hg/hgrc |
|
3516 | $ echo 'injectparamasstring = max("$1")' >> .hg/hgrc | |
3458 | $ echo 'callinjection($1) = descendants(injectparamasstring)' >> .hg/hgrc |
|
3517 | $ echo 'callinjection($1) = descendants(injectparamasstring)' >> .hg/hgrc | |
3459 | $ try 'callinjection(2:5)' |
|
3518 | $ try 'callinjection(2:5)' | |
3460 | (func |
|
3519 | (func | |
3461 | ('symbol', 'callinjection') |
|
3520 | ('symbol', 'callinjection') | |
3462 | (range |
|
3521 | (range | |
3463 | ('symbol', '2') |
|
3522 | ('symbol', '2') | |
3464 | ('symbol', '5'))) |
|
3523 | ('symbol', '5'))) | |
3465 | * expanded: |
|
3524 | * expanded: | |
3466 | (func |
|
3525 | (func | |
3467 | ('symbol', 'descendants') |
|
3526 | ('symbol', 'descendants') | |
3468 | (func |
|
3527 | (func | |
3469 | ('symbol', 'max') |
|
3528 | ('symbol', 'max') | |
3470 | ('string', '$1'))) |
|
3529 | ('string', '$1'))) | |
3471 | abort: unknown revision '$1'! |
|
3530 | abort: unknown revision '$1'! | |
3472 | [255] |
|
3531 | [255] | |
3473 |
|
3532 | |||
3474 | test scope of alias expansion: 'universe' is expanded prior to 'shadowall(0)', |
|
3533 | test scope of alias expansion: 'universe' is expanded prior to 'shadowall(0)', | |
3475 | but 'all()' should never be substituted to '0()'. |
|
3534 | but 'all()' should never be substituted to '0()'. | |
3476 |
|
3535 | |||
3477 | $ echo 'universe = all()' >> .hg/hgrc |
|
3536 | $ echo 'universe = all()' >> .hg/hgrc | |
3478 | $ echo 'shadowall(all) = all and universe' >> .hg/hgrc |
|
3537 | $ echo 'shadowall(all) = all and universe' >> .hg/hgrc | |
3479 | $ try 'shadowall(0)' |
|
3538 | $ try 'shadowall(0)' | |
3480 | (func |
|
3539 | (func | |
3481 | ('symbol', 'shadowall') |
|
3540 | ('symbol', 'shadowall') | |
3482 | ('symbol', '0')) |
|
3541 | ('symbol', '0')) | |
3483 | * expanded: |
|
3542 | * expanded: | |
3484 | (and |
|
3543 | (and | |
3485 | ('symbol', '0') |
|
3544 | ('symbol', '0') | |
3486 | (func |
|
3545 | (func | |
3487 | ('symbol', 'all') |
|
3546 | ('symbol', 'all') | |
3488 | None)) |
|
3547 | None)) | |
3489 | * set: |
|
3548 | * set: | |
3490 | <filteredset |
|
3549 | <filteredset | |
3491 | <baseset [0]>, |
|
3550 | <baseset [0]>, | |
3492 | <spanset+ 0:10>> |
|
3551 | <spanset+ 0:10>> | |
3493 | 0 |
|
3552 | 0 | |
3494 |
|
3553 | |||
3495 | test unknown reference: |
|
3554 | test unknown reference: | |
3496 |
|
3555 | |||
3497 | $ try "unknownref(0)" --config 'revsetalias.unknownref($1)=$1:$2' |
|
3556 | $ try "unknownref(0)" --config 'revsetalias.unknownref($1)=$1:$2' | |
3498 | (func |
|
3557 | (func | |
3499 | ('symbol', 'unknownref') |
|
3558 | ('symbol', 'unknownref') | |
3500 | ('symbol', '0')) |
|
3559 | ('symbol', '0')) | |
3501 | abort: bad definition of revset alias "unknownref": invalid symbol '$2' |
|
3560 | abort: bad definition of revset alias "unknownref": invalid symbol '$2' | |
3502 | [255] |
|
3561 | [255] | |
3503 |
|
3562 | |||
3504 | $ hg debugrevspec --debug --config revsetalias.anotherbadone='branch(' "tip" |
|
3563 | $ hg debugrevspec --debug --config revsetalias.anotherbadone='branch(' "tip" | |
3505 | ('symbol', 'tip') |
|
3564 | ('symbol', 'tip') | |
3506 | warning: bad definition of revset alias "anotherbadone": at 7: not a prefix: end |
|
3565 | warning: bad definition of revset alias "anotherbadone": at 7: not a prefix: end | |
3507 | * set: |
|
3566 | * set: | |
3508 | <baseset [9]> |
|
3567 | <baseset [9]> | |
3509 | 9 |
|
3568 | 9 | |
3510 |
|
3569 | |||
3511 | $ try 'tip' |
|
3570 | $ try 'tip' | |
3512 | ('symbol', 'tip') |
|
3571 | ('symbol', 'tip') | |
3513 | * set: |
|
3572 | * set: | |
3514 | <baseset [9]> |
|
3573 | <baseset [9]> | |
3515 | 9 |
|
3574 | 9 | |
3516 |
|
3575 | |||
3517 | $ hg debugrevspec --debug --config revsetalias.'bad name'='tip' "tip" |
|
3576 | $ hg debugrevspec --debug --config revsetalias.'bad name'='tip' "tip" | |
3518 | ('symbol', 'tip') |
|
3577 | ('symbol', 'tip') | |
3519 | warning: bad declaration of revset alias "bad name": at 4: invalid token |
|
3578 | warning: bad declaration of revset alias "bad name": at 4: invalid token | |
3520 | * set: |
|
3579 | * set: | |
3521 | <baseset [9]> |
|
3580 | <baseset [9]> | |
3522 | 9 |
|
3581 | 9 | |
3523 | $ echo 'strictreplacing($1, $10) = $10 or desc("$1")' >> .hg/hgrc |
|
3582 | $ echo 'strictreplacing($1, $10) = $10 or desc("$1")' >> .hg/hgrc | |
3524 | $ try 'strictreplacing("foo", tip)' |
|
3583 | $ try 'strictreplacing("foo", tip)' | |
3525 | (func |
|
3584 | (func | |
3526 | ('symbol', 'strictreplacing') |
|
3585 | ('symbol', 'strictreplacing') | |
3527 | (list |
|
3586 | (list | |
3528 | ('string', 'foo') |
|
3587 | ('string', 'foo') | |
3529 | ('symbol', 'tip'))) |
|
3588 | ('symbol', 'tip'))) | |
3530 | * expanded: |
|
3589 | * expanded: | |
3531 | (or |
|
3590 | (or | |
3532 | (list |
|
3591 | (list | |
3533 | ('symbol', 'tip') |
|
3592 | ('symbol', 'tip') | |
3534 | (func |
|
3593 | (func | |
3535 | ('symbol', 'desc') |
|
3594 | ('symbol', 'desc') | |
3536 | ('string', '$1')))) |
|
3595 | ('string', '$1')))) | |
3537 | * set: |
|
3596 | * set: | |
3538 | <addset |
|
3597 | <addset | |
3539 | <baseset [9]>, |
|
3598 | <baseset [9]>, | |
3540 | <filteredset |
|
3599 | <filteredset | |
3541 | <fullreposet+ 0:10>, |
|
3600 | <fullreposet+ 0:10>, | |
3542 | <desc '$1'>>> |
|
3601 | <desc '$1'>>> | |
3543 | 9 |
|
3602 | 9 | |
3544 |
|
3603 | |||
3545 | $ try 'd(2:5)' |
|
3604 | $ try 'd(2:5)' | |
3546 | (func |
|
3605 | (func | |
3547 | ('symbol', 'd') |
|
3606 | ('symbol', 'd') | |
3548 | (range |
|
3607 | (range | |
3549 | ('symbol', '2') |
|
3608 | ('symbol', '2') | |
3550 | ('symbol', '5'))) |
|
3609 | ('symbol', '5'))) | |
3551 | * expanded: |
|
3610 | * expanded: | |
3552 | (func |
|
3611 | (func | |
3553 | ('symbol', 'reverse') |
|
3612 | ('symbol', 'reverse') | |
3554 | (func |
|
3613 | (func | |
3555 | ('symbol', 'sort') |
|
3614 | ('symbol', 'sort') | |
3556 | (list |
|
3615 | (list | |
3557 | (range |
|
3616 | (range | |
3558 | ('symbol', '2') |
|
3617 | ('symbol', '2') | |
3559 | ('symbol', '5')) |
|
3618 | ('symbol', '5')) | |
3560 | ('symbol', 'date')))) |
|
3619 | ('symbol', 'date')))) | |
3561 | * set: |
|
3620 | * set: | |
3562 | <baseset [4, 5, 3, 2]> |
|
3621 | <baseset [4, 5, 3, 2]> | |
3563 | 4 |
|
3622 | 4 | |
3564 | 5 |
|
3623 | 5 | |
3565 | 3 |
|
3624 | 3 | |
3566 | 2 |
|
3625 | 2 | |
3567 | $ try 'rs(2 or 3, date)' |
|
3626 | $ try 'rs(2 or 3, date)' | |
3568 | (func |
|
3627 | (func | |
3569 | ('symbol', 'rs') |
|
3628 | ('symbol', 'rs') | |
3570 | (list |
|
3629 | (list | |
3571 | (or |
|
3630 | (or | |
3572 | (list |
|
3631 | (list | |
3573 | ('symbol', '2') |
|
3632 | ('symbol', '2') | |
3574 | ('symbol', '3'))) |
|
3633 | ('symbol', '3'))) | |
3575 | ('symbol', 'date'))) |
|
3634 | ('symbol', 'date'))) | |
3576 | * expanded: |
|
3635 | * expanded: | |
3577 | (func |
|
3636 | (func | |
3578 | ('symbol', 'reverse') |
|
3637 | ('symbol', 'reverse') | |
3579 | (func |
|
3638 | (func | |
3580 | ('symbol', 'sort') |
|
3639 | ('symbol', 'sort') | |
3581 | (list |
|
3640 | (list | |
3582 | (or |
|
3641 | (or | |
3583 | (list |
|
3642 | (list | |
3584 | ('symbol', '2') |
|
3643 | ('symbol', '2') | |
3585 | ('symbol', '3'))) |
|
3644 | ('symbol', '3'))) | |
3586 | ('symbol', 'date')))) |
|
3645 | ('symbol', 'date')))) | |
3587 | * set: |
|
3646 | * set: | |
3588 | <baseset [3, 2]> |
|
3647 | <baseset [3, 2]> | |
3589 | 3 |
|
3648 | 3 | |
3590 | 2 |
|
3649 | 2 | |
3591 | $ try 'rs()' |
|
3650 | $ try 'rs()' | |
3592 | (func |
|
3651 | (func | |
3593 | ('symbol', 'rs') |
|
3652 | ('symbol', 'rs') | |
3594 | None) |
|
3653 | None) | |
3595 | hg: parse error: invalid number of arguments: 0 |
|
3654 | hg: parse error: invalid number of arguments: 0 | |
3596 | [255] |
|
3655 | [255] | |
3597 | $ try 'rs(2)' |
|
3656 | $ try 'rs(2)' | |
3598 | (func |
|
3657 | (func | |
3599 | ('symbol', 'rs') |
|
3658 | ('symbol', 'rs') | |
3600 | ('symbol', '2')) |
|
3659 | ('symbol', '2')) | |
3601 | hg: parse error: invalid number of arguments: 1 |
|
3660 | hg: parse error: invalid number of arguments: 1 | |
3602 | [255] |
|
3661 | [255] | |
3603 | $ try 'rs(2, data, 7)' |
|
3662 | $ try 'rs(2, data, 7)' | |
3604 | (func |
|
3663 | (func | |
3605 | ('symbol', 'rs') |
|
3664 | ('symbol', 'rs') | |
3606 | (list |
|
3665 | (list | |
3607 | ('symbol', '2') |
|
3666 | ('symbol', '2') | |
3608 | ('symbol', 'data') |
|
3667 | ('symbol', 'data') | |
3609 | ('symbol', '7'))) |
|
3668 | ('symbol', '7'))) | |
3610 | hg: parse error: invalid number of arguments: 3 |
|
3669 | hg: parse error: invalid number of arguments: 3 | |
3611 | [255] |
|
3670 | [255] | |
3612 | $ try 'rs4(2 or 3, x, x, date)' |
|
3671 | $ try 'rs4(2 or 3, x, x, date)' | |
3613 | (func |
|
3672 | (func | |
3614 | ('symbol', 'rs4') |
|
3673 | ('symbol', 'rs4') | |
3615 | (list |
|
3674 | (list | |
3616 | (or |
|
3675 | (or | |
3617 | (list |
|
3676 | (list | |
3618 | ('symbol', '2') |
|
3677 | ('symbol', '2') | |
3619 | ('symbol', '3'))) |
|
3678 | ('symbol', '3'))) | |
3620 | ('symbol', 'x') |
|
3679 | ('symbol', 'x') | |
3621 | ('symbol', 'x') |
|
3680 | ('symbol', 'x') | |
3622 | ('symbol', 'date'))) |
|
3681 | ('symbol', 'date'))) | |
3623 | * expanded: |
|
3682 | * expanded: | |
3624 | (func |
|
3683 | (func | |
3625 | ('symbol', 'reverse') |
|
3684 | ('symbol', 'reverse') | |
3626 | (func |
|
3685 | (func | |
3627 | ('symbol', 'sort') |
|
3686 | ('symbol', 'sort') | |
3628 | (list |
|
3687 | (list | |
3629 | (or |
|
3688 | (or | |
3630 | (list |
|
3689 | (list | |
3631 | ('symbol', '2') |
|
3690 | ('symbol', '2') | |
3632 | ('symbol', '3'))) |
|
3691 | ('symbol', '3'))) | |
3633 | ('symbol', 'date')))) |
|
3692 | ('symbol', 'date')))) | |
3634 | * set: |
|
3693 | * set: | |
3635 | <baseset [3, 2]> |
|
3694 | <baseset [3, 2]> | |
3636 | 3 |
|
3695 | 3 | |
3637 | 2 |
|
3696 | 2 | |
3638 |
|
3697 | |||
3639 | issue4553: check that revset aliases override existing hash prefix |
|
3698 | issue4553: check that revset aliases override existing hash prefix | |
3640 |
|
3699 | |||
3641 | $ hg log -qr e |
|
3700 | $ hg log -qr e | |
3642 | 6:e0cc66ef77e8 |
|
3701 | 6:e0cc66ef77e8 | |
3643 |
|
3702 | |||
3644 | $ hg log -qr e --config revsetalias.e="all()" |
|
3703 | $ hg log -qr e --config revsetalias.e="all()" | |
3645 | 0:2785f51eece5 |
|
3704 | 0:2785f51eece5 | |
3646 | 1:d75937da8da0 |
|
3705 | 1:d75937da8da0 | |
3647 | 2:5ed5505e9f1c |
|
3706 | 2:5ed5505e9f1c | |
3648 | 3:8528aa5637f2 |
|
3707 | 3:8528aa5637f2 | |
3649 | 4:2326846efdab |
|
3708 | 4:2326846efdab | |
3650 | 5:904fa392b941 |
|
3709 | 5:904fa392b941 | |
3651 | 6:e0cc66ef77e8 |
|
3710 | 6:e0cc66ef77e8 | |
3652 | 7:013af1973af4 |
|
3711 | 7:013af1973af4 | |
3653 | 8:d5d0dcbdc4d9 |
|
3712 | 8:d5d0dcbdc4d9 | |
3654 | 9:24286f4ae135 |
|
3713 | 9:24286f4ae135 | |
3655 |
|
3714 | |||
3656 | $ hg log -qr e: --config revsetalias.e="0" |
|
3715 | $ hg log -qr e: --config revsetalias.e="0" | |
3657 | 0:2785f51eece5 |
|
3716 | 0:2785f51eece5 | |
3658 | 1:d75937da8da0 |
|
3717 | 1:d75937da8da0 | |
3659 | 2:5ed5505e9f1c |
|
3718 | 2:5ed5505e9f1c | |
3660 | 3:8528aa5637f2 |
|
3719 | 3:8528aa5637f2 | |
3661 | 4:2326846efdab |
|
3720 | 4:2326846efdab | |
3662 | 5:904fa392b941 |
|
3721 | 5:904fa392b941 | |
3663 | 6:e0cc66ef77e8 |
|
3722 | 6:e0cc66ef77e8 | |
3664 | 7:013af1973af4 |
|
3723 | 7:013af1973af4 | |
3665 | 8:d5d0dcbdc4d9 |
|
3724 | 8:d5d0dcbdc4d9 | |
3666 | 9:24286f4ae135 |
|
3725 | 9:24286f4ae135 | |
3667 |
|
3726 | |||
3668 | $ hg log -qr :e --config revsetalias.e="9" |
|
3727 | $ hg log -qr :e --config revsetalias.e="9" | |
3669 | 0:2785f51eece5 |
|
3728 | 0:2785f51eece5 | |
3670 | 1:d75937da8da0 |
|
3729 | 1:d75937da8da0 | |
3671 | 2:5ed5505e9f1c |
|
3730 | 2:5ed5505e9f1c | |
3672 | 3:8528aa5637f2 |
|
3731 | 3:8528aa5637f2 | |
3673 | 4:2326846efdab |
|
3732 | 4:2326846efdab | |
3674 | 5:904fa392b941 |
|
3733 | 5:904fa392b941 | |
3675 | 6:e0cc66ef77e8 |
|
3734 | 6:e0cc66ef77e8 | |
3676 | 7:013af1973af4 |
|
3735 | 7:013af1973af4 | |
3677 | 8:d5d0dcbdc4d9 |
|
3736 | 8:d5d0dcbdc4d9 | |
3678 | 9:24286f4ae135 |
|
3737 | 9:24286f4ae135 | |
3679 |
|
3738 | |||
3680 | $ hg log -qr e: |
|
3739 | $ hg log -qr e: | |
3681 | 6:e0cc66ef77e8 |
|
3740 | 6:e0cc66ef77e8 | |
3682 | 7:013af1973af4 |
|
3741 | 7:013af1973af4 | |
3683 | 8:d5d0dcbdc4d9 |
|
3742 | 8:d5d0dcbdc4d9 | |
3684 | 9:24286f4ae135 |
|
3743 | 9:24286f4ae135 | |
3685 |
|
3744 | |||
3686 | $ hg log -qr :e |
|
3745 | $ hg log -qr :e | |
3687 | 0:2785f51eece5 |
|
3746 | 0:2785f51eece5 | |
3688 | 1:d75937da8da0 |
|
3747 | 1:d75937da8da0 | |
3689 | 2:5ed5505e9f1c |
|
3748 | 2:5ed5505e9f1c | |
3690 | 3:8528aa5637f2 |
|
3749 | 3:8528aa5637f2 | |
3691 | 4:2326846efdab |
|
3750 | 4:2326846efdab | |
3692 | 5:904fa392b941 |
|
3751 | 5:904fa392b941 | |
3693 | 6:e0cc66ef77e8 |
|
3752 | 6:e0cc66ef77e8 | |
3694 |
|
3753 | |||
3695 | issue2549 - correct optimizations |
|
3754 | issue2549 - correct optimizations | |
3696 |
|
3755 | |||
3697 | $ try 'limit(1 or 2 or 3, 2) and not 2' |
|
3756 | $ try 'limit(1 or 2 or 3, 2) and not 2' | |
3698 | (and |
|
3757 | (and | |
3699 | (func |
|
3758 | (func | |
3700 | ('symbol', 'limit') |
|
3759 | ('symbol', 'limit') | |
3701 | (list |
|
3760 | (list | |
3702 | (or |
|
3761 | (or | |
3703 | (list |
|
3762 | (list | |
3704 | ('symbol', '1') |
|
3763 | ('symbol', '1') | |
3705 | ('symbol', '2') |
|
3764 | ('symbol', '2') | |
3706 | ('symbol', '3'))) |
|
3765 | ('symbol', '3'))) | |
3707 | ('symbol', '2'))) |
|
3766 | ('symbol', '2'))) | |
3708 | (not |
|
3767 | (not | |
3709 | ('symbol', '2'))) |
|
3768 | ('symbol', '2'))) | |
3710 | * set: |
|
3769 | * set: | |
3711 | <filteredset |
|
3770 | <filteredset | |
3712 | <baseset [1, 2]>, |
|
3771 | <baseset [1, 2]>, | |
3713 | <not |
|
3772 | <not | |
3714 | <baseset [2]>>> |
|
3773 | <baseset [2]>>> | |
3715 | 1 |
|
3774 | 1 | |
3716 | $ try 'max(1 or 2) and not 2' |
|
3775 | $ try 'max(1 or 2) and not 2' | |
3717 | (and |
|
3776 | (and | |
3718 | (func |
|
3777 | (func | |
3719 | ('symbol', 'max') |
|
3778 | ('symbol', 'max') | |
3720 | (or |
|
3779 | (or | |
3721 | (list |
|
3780 | (list | |
3722 | ('symbol', '1') |
|
3781 | ('symbol', '1') | |
3723 | ('symbol', '2')))) |
|
3782 | ('symbol', '2')))) | |
3724 | (not |
|
3783 | (not | |
3725 | ('symbol', '2'))) |
|
3784 | ('symbol', '2'))) | |
3726 | * set: |
|
3785 | * set: | |
3727 | <filteredset |
|
3786 | <filteredset | |
3728 | <baseset |
|
3787 | <baseset | |
3729 | <max |
|
3788 | <max | |
3730 | <fullreposet+ 0:10>, |
|
3789 | <fullreposet+ 0:10>, | |
3731 | <baseset [1, 2]>>>, |
|
3790 | <baseset [1, 2]>>>, | |
3732 | <not |
|
3791 | <not | |
3733 | <baseset [2]>>> |
|
3792 | <baseset [2]>>> | |
3734 | $ try 'min(1 or 2) and not 1' |
|
3793 | $ try 'min(1 or 2) and not 1' | |
3735 | (and |
|
3794 | (and | |
3736 | (func |
|
3795 | (func | |
3737 | ('symbol', 'min') |
|
3796 | ('symbol', 'min') | |
3738 | (or |
|
3797 | (or | |
3739 | (list |
|
3798 | (list | |
3740 | ('symbol', '1') |
|
3799 | ('symbol', '1') | |
3741 | ('symbol', '2')))) |
|
3800 | ('symbol', '2')))) | |
3742 | (not |
|
3801 | (not | |
3743 | ('symbol', '1'))) |
|
3802 | ('symbol', '1'))) | |
3744 | * set: |
|
3803 | * set: | |
3745 | <filteredset |
|
3804 | <filteredset | |
3746 | <baseset |
|
3805 | <baseset | |
3747 | <min |
|
3806 | <min | |
3748 | <fullreposet+ 0:10>, |
|
3807 | <fullreposet+ 0:10>, | |
3749 | <baseset [1, 2]>>>, |
|
3808 | <baseset [1, 2]>>>, | |
3750 | <not |
|
3809 | <not | |
3751 | <baseset [1]>>> |
|
3810 | <baseset [1]>>> | |
3752 | $ try 'last(1 or 2, 1) and not 2' |
|
3811 | $ try 'last(1 or 2, 1) and not 2' | |
3753 | (and |
|
3812 | (and | |
3754 | (func |
|
3813 | (func | |
3755 | ('symbol', 'last') |
|
3814 | ('symbol', 'last') | |
3756 | (list |
|
3815 | (list | |
3757 | (or |
|
3816 | (or | |
3758 | (list |
|
3817 | (list | |
3759 | ('symbol', '1') |
|
3818 | ('symbol', '1') | |
3760 | ('symbol', '2'))) |
|
3819 | ('symbol', '2'))) | |
3761 | ('symbol', '1'))) |
|
3820 | ('symbol', '1'))) | |
3762 | (not |
|
3821 | (not | |
3763 | ('symbol', '2'))) |
|
3822 | ('symbol', '2'))) | |
3764 | * set: |
|
3823 | * set: | |
3765 | <filteredset |
|
3824 | <filteredset | |
3766 | <baseset [2]>, |
|
3825 | <baseset [2]>, | |
3767 | <not |
|
3826 | <not | |
3768 | <baseset [2]>>> |
|
3827 | <baseset [2]>>> | |
3769 |
|
3828 | |||
3770 | issue4289 - ordering of built-ins |
|
3829 | issue4289 - ordering of built-ins | |
3771 | $ hg log -M -q -r 3:2 |
|
3830 | $ hg log -M -q -r 3:2 | |
3772 | 3:8528aa5637f2 |
|
3831 | 3:8528aa5637f2 | |
3773 | 2:5ed5505e9f1c |
|
3832 | 2:5ed5505e9f1c | |
3774 |
|
3833 | |||
3775 | test revsets started with 40-chars hash (issue3669) |
|
3834 | test revsets started with 40-chars hash (issue3669) | |
3776 |
|
3835 | |||
3777 | $ ISSUE3669_TIP=`hg tip --template '{node}'` |
|
3836 | $ ISSUE3669_TIP=`hg tip --template '{node}'` | |
3778 | $ hg log -r "${ISSUE3669_TIP}" --template '{rev}\n' |
|
3837 | $ hg log -r "${ISSUE3669_TIP}" --template '{rev}\n' | |
3779 | 9 |
|
3838 | 9 | |
3780 | $ hg log -r "${ISSUE3669_TIP}^" --template '{rev}\n' |
|
3839 | $ hg log -r "${ISSUE3669_TIP}^" --template '{rev}\n' | |
3781 | 8 |
|
3840 | 8 | |
3782 |
|
3841 | |||
3783 | test or-ed indirect predicates (issue3775) |
|
3842 | test or-ed indirect predicates (issue3775) | |
3784 |
|
3843 | |||
3785 | $ log '6 or 6^1' | sort |
|
3844 | $ log '6 or 6^1' | sort | |
3786 | 5 |
|
3845 | 5 | |
3787 | 6 |
|
3846 | 6 | |
3788 | $ log '6^1 or 6' | sort |
|
3847 | $ log '6^1 or 6' | sort | |
3789 | 5 |
|
3848 | 5 | |
3790 | 6 |
|
3849 | 6 | |
3791 | $ log '4 or 4~1' | sort |
|
3850 | $ log '4 or 4~1' | sort | |
3792 | 2 |
|
3851 | 2 | |
3793 | 4 |
|
3852 | 4 | |
3794 | $ log '4~1 or 4' | sort |
|
3853 | $ log '4~1 or 4' | sort | |
3795 | 2 |
|
3854 | 2 | |
3796 | 4 |
|
3855 | 4 | |
3797 | $ log '(0 or 2):(4 or 6) or 0 or 6' | sort |
|
3856 | $ log '(0 or 2):(4 or 6) or 0 or 6' | sort | |
3798 | 0 |
|
3857 | 0 | |
3799 | 1 |
|
3858 | 1 | |
3800 | 2 |
|
3859 | 2 | |
3801 | 3 |
|
3860 | 3 | |
3802 | 4 |
|
3861 | 4 | |
3803 | 5 |
|
3862 | 5 | |
3804 | 6 |
|
3863 | 6 | |
3805 | $ log '0 or 6 or (0 or 2):(4 or 6)' | sort |
|
3864 | $ log '0 or 6 or (0 or 2):(4 or 6)' | sort | |
3806 | 0 |
|
3865 | 0 | |
3807 | 1 |
|
3866 | 1 | |
3808 | 2 |
|
3867 | 2 | |
3809 | 3 |
|
3868 | 3 | |
3810 | 4 |
|
3869 | 4 | |
3811 | 5 |
|
3870 | 5 | |
3812 | 6 |
|
3871 | 6 | |
3813 |
|
3872 | |||
3814 | tests for 'remote()' predicate: |
|
3873 | tests for 'remote()' predicate: | |
3815 | #. (csets in remote) (id) (remote) |
|
3874 | #. (csets in remote) (id) (remote) | |
3816 | 1. less than local current branch "default" |
|
3875 | 1. less than local current branch "default" | |
3817 | 2. same with local specified "default" |
|
3876 | 2. same with local specified "default" | |
3818 | 3. more than local specified specified |
|
3877 | 3. more than local specified specified | |
3819 |
|
3878 | |||
3820 | $ hg clone --quiet -U . ../remote3 |
|
3879 | $ hg clone --quiet -U . ../remote3 | |
3821 | $ cd ../remote3 |
|
3880 | $ cd ../remote3 | |
3822 | $ hg update -q 7 |
|
3881 | $ hg update -q 7 | |
3823 | $ echo r > r |
|
3882 | $ echo r > r | |
3824 | $ hg ci -Aqm 10 |
|
3883 | $ hg ci -Aqm 10 | |
3825 | $ log 'remote()' |
|
3884 | $ log 'remote()' | |
3826 | 7 |
|
3885 | 7 | |
3827 | $ log 'remote("a-b-c-")' |
|
3886 | $ log 'remote("a-b-c-")' | |
3828 | 2 |
|
3887 | 2 | |
3829 | $ cd ../repo |
|
3888 | $ cd ../repo | |
3830 | $ log 'remote(".a.b.c.", "../remote3")' |
|
3889 | $ log 'remote(".a.b.c.", "../remote3")' | |
3831 |
|
3890 | |||
3832 | tests for concatenation of strings/symbols by "##" |
|
3891 | tests for concatenation of strings/symbols by "##" | |
3833 |
|
3892 | |||
3834 | $ try "278 ## '5f5' ## 1ee ## 'ce5'" |
|
3893 | $ try "278 ## '5f5' ## 1ee ## 'ce5'" | |
3835 | (_concat |
|
3894 | (_concat | |
3836 | (_concat |
|
3895 | (_concat | |
3837 | (_concat |
|
3896 | (_concat | |
3838 | ('symbol', '278') |
|
3897 | ('symbol', '278') | |
3839 | ('string', '5f5')) |
|
3898 | ('string', '5f5')) | |
3840 | ('symbol', '1ee')) |
|
3899 | ('symbol', '1ee')) | |
3841 | ('string', 'ce5')) |
|
3900 | ('string', 'ce5')) | |
3842 | * concatenated: |
|
3901 | * concatenated: | |
3843 | ('string', '2785f51eece5') |
|
3902 | ('string', '2785f51eece5') | |
3844 | * set: |
|
3903 | * set: | |
3845 | <baseset [0]> |
|
3904 | <baseset [0]> | |
3846 | 0 |
|
3905 | 0 | |
3847 |
|
3906 | |||
3848 | $ echo 'cat4($1, $2, $3, $4) = $1 ## $2 ## $3 ## $4' >> .hg/hgrc |
|
3907 | $ echo 'cat4($1, $2, $3, $4) = $1 ## $2 ## $3 ## $4' >> .hg/hgrc | |
3849 | $ try "cat4(278, '5f5', 1ee, 'ce5')" |
|
3908 | $ try "cat4(278, '5f5', 1ee, 'ce5')" | |
3850 | (func |
|
3909 | (func | |
3851 | ('symbol', 'cat4') |
|
3910 | ('symbol', 'cat4') | |
3852 | (list |
|
3911 | (list | |
3853 | ('symbol', '278') |
|
3912 | ('symbol', '278') | |
3854 | ('string', '5f5') |
|
3913 | ('string', '5f5') | |
3855 | ('symbol', '1ee') |
|
3914 | ('symbol', '1ee') | |
3856 | ('string', 'ce5'))) |
|
3915 | ('string', 'ce5'))) | |
3857 | * expanded: |
|
3916 | * expanded: | |
3858 | (_concat |
|
3917 | (_concat | |
3859 | (_concat |
|
3918 | (_concat | |
3860 | (_concat |
|
3919 | (_concat | |
3861 | ('symbol', '278') |
|
3920 | ('symbol', '278') | |
3862 | ('string', '5f5')) |
|
3921 | ('string', '5f5')) | |
3863 | ('symbol', '1ee')) |
|
3922 | ('symbol', '1ee')) | |
3864 | ('string', 'ce5')) |
|
3923 | ('string', 'ce5')) | |
3865 | * concatenated: |
|
3924 | * concatenated: | |
3866 | ('string', '2785f51eece5') |
|
3925 | ('string', '2785f51eece5') | |
3867 | * set: |
|
3926 | * set: | |
3868 | <baseset [0]> |
|
3927 | <baseset [0]> | |
3869 | 0 |
|
3928 | 0 | |
3870 |
|
3929 | |||
3871 | (check concatenation in alias nesting) |
|
3930 | (check concatenation in alias nesting) | |
3872 |
|
3931 | |||
3873 | $ echo 'cat2($1, $2) = $1 ## $2' >> .hg/hgrc |
|
3932 | $ echo 'cat2($1, $2) = $1 ## $2' >> .hg/hgrc | |
3874 | $ echo 'cat2x2($1, $2, $3, $4) = cat2($1 ## $2, $3 ## $4)' >> .hg/hgrc |
|
3933 | $ echo 'cat2x2($1, $2, $3, $4) = cat2($1 ## $2, $3 ## $4)' >> .hg/hgrc | |
3875 | $ log "cat2x2(278, '5f5', 1ee, 'ce5')" |
|
3934 | $ log "cat2x2(278, '5f5', 1ee, 'ce5')" | |
3876 | 0 |
|
3935 | 0 | |
3877 |
|
3936 | |||
3878 | (check operator priority) |
|
3937 | (check operator priority) | |
3879 |
|
3938 | |||
3880 | $ echo 'cat2n2($1, $2, $3, $4) = $1 ## $2 or $3 ## $4~2' >> .hg/hgrc |
|
3939 | $ echo 'cat2n2($1, $2, $3, $4) = $1 ## $2 or $3 ## $4~2' >> .hg/hgrc | |
3881 | $ log "cat2n2(2785f5, 1eece5, 24286f, 4ae135)" |
|
3940 | $ log "cat2n2(2785f5, 1eece5, 24286f, 4ae135)" | |
3882 | 0 |
|
3941 | 0 | |
3883 | 4 |
|
3942 | 4 | |
3884 |
|
3943 | |||
3885 | $ cd .. |
|
3944 | $ cd .. | |
3886 |
|
3945 | |||
3887 | prepare repository that has "default" branches of multiple roots |
|
3946 | prepare repository that has "default" branches of multiple roots | |
3888 |
|
3947 | |||
3889 | $ hg init namedbranch |
|
3948 | $ hg init namedbranch | |
3890 | $ cd namedbranch |
|
3949 | $ cd namedbranch | |
3891 |
|
3950 | |||
3892 | $ echo default0 >> a |
|
3951 | $ echo default0 >> a | |
3893 | $ hg ci -Aqm0 |
|
3952 | $ hg ci -Aqm0 | |
3894 | $ echo default1 >> a |
|
3953 | $ echo default1 >> a | |
3895 | $ hg ci -m1 |
|
3954 | $ hg ci -m1 | |
3896 |
|
3955 | |||
3897 | $ hg branch -q stable |
|
3956 | $ hg branch -q stable | |
3898 | $ echo stable2 >> a |
|
3957 | $ echo stable2 >> a | |
3899 | $ hg ci -m2 |
|
3958 | $ hg ci -m2 | |
3900 | $ echo stable3 >> a |
|
3959 | $ echo stable3 >> a | |
3901 | $ hg ci -m3 |
|
3960 | $ hg ci -m3 | |
3902 |
|
3961 | |||
3903 | $ hg update -q null |
|
3962 | $ hg update -q null | |
3904 | $ echo default4 >> a |
|
3963 | $ echo default4 >> a | |
3905 | $ hg ci -Aqm4 |
|
3964 | $ hg ci -Aqm4 | |
3906 | $ echo default5 >> a |
|
3965 | $ echo default5 >> a | |
3907 | $ hg ci -m5 |
|
3966 | $ hg ci -m5 | |
3908 |
|
3967 | |||
3909 | "null" revision belongs to "default" branch (issue4683) |
|
3968 | "null" revision belongs to "default" branch (issue4683) | |
3910 |
|
3969 | |||
3911 | $ log 'branch(null)' |
|
3970 | $ log 'branch(null)' | |
3912 | 0 |
|
3971 | 0 | |
3913 | 1 |
|
3972 | 1 | |
3914 | 4 |
|
3973 | 4 | |
3915 | 5 |
|
3974 | 5 | |
3916 |
|
3975 | |||
3917 | "null" revision belongs to "default" branch, but it shouldn't appear in set |
|
3976 | "null" revision belongs to "default" branch, but it shouldn't appear in set | |
3918 | unless explicitly specified (issue4682) |
|
3977 | unless explicitly specified (issue4682) | |
3919 |
|
3978 | |||
3920 | $ log 'children(branch(default))' |
|
3979 | $ log 'children(branch(default))' | |
3921 | 1 |
|
3980 | 1 | |
3922 | 2 |
|
3981 | 2 | |
3923 | 5 |
|
3982 | 5 | |
3924 |
|
3983 | |||
3925 | $ cd .. |
|
3984 | $ cd .. | |
3926 |
|
3985 | |||
3927 | test author/desc/keyword in problematic encoding |
|
3986 | test author/desc/keyword in problematic encoding | |
3928 | # unicode: cp932: |
|
3987 | # unicode: cp932: | |
3929 | # u30A2 0x83 0x41(= 'A') |
|
3988 | # u30A2 0x83 0x41(= 'A') | |
3930 | # u30C2 0x83 0x61(= 'a') |
|
3989 | # u30C2 0x83 0x61(= 'a') | |
3931 |
|
3990 | |||
3932 | $ hg init problematicencoding |
|
3991 | $ hg init problematicencoding | |
3933 | $ cd problematicencoding |
|
3992 | $ cd problematicencoding | |
3934 |
|
3993 | |||
3935 | $ python > setup.sh <<EOF |
|
3994 | $ python > setup.sh <<EOF | |
3936 | > print u''' |
|
3995 | > print u''' | |
3937 | > echo a > text |
|
3996 | > echo a > text | |
3938 | > hg add text |
|
3997 | > hg add text | |
3939 | > hg --encoding utf-8 commit -u '\u30A2' -m none |
|
3998 | > hg --encoding utf-8 commit -u '\u30A2' -m none | |
3940 | > echo b > text |
|
3999 | > echo b > text | |
3941 | > hg --encoding utf-8 commit -u '\u30C2' -m none |
|
4000 | > hg --encoding utf-8 commit -u '\u30C2' -m none | |
3942 | > echo c > text |
|
4001 | > echo c > text | |
3943 | > hg --encoding utf-8 commit -u none -m '\u30A2' |
|
4002 | > hg --encoding utf-8 commit -u none -m '\u30A2' | |
3944 | > echo d > text |
|
4003 | > echo d > text | |
3945 | > hg --encoding utf-8 commit -u none -m '\u30C2' |
|
4004 | > hg --encoding utf-8 commit -u none -m '\u30C2' | |
3946 | > '''.encode('utf-8') |
|
4005 | > '''.encode('utf-8') | |
3947 | > EOF |
|
4006 | > EOF | |
3948 | $ sh < setup.sh |
|
4007 | $ sh < setup.sh | |
3949 |
|
4008 | |||
3950 | test in problematic encoding |
|
4009 | test in problematic encoding | |
3951 | $ python > test.sh <<EOF |
|
4010 | $ python > test.sh <<EOF | |
3952 | > print u''' |
|
4011 | > print u''' | |
3953 | > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30A2)' |
|
4012 | > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30A2)' | |
3954 | > echo ==== |
|
4013 | > echo ==== | |
3955 | > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30C2)' |
|
4014 | > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30C2)' | |
3956 | > echo ==== |
|
4015 | > echo ==== | |
3957 | > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30A2)' |
|
4016 | > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30A2)' | |
3958 | > echo ==== |
|
4017 | > echo ==== | |
3959 | > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30C2)' |
|
4018 | > hg --encoding cp932 log --template '{rev}\\n' -r 'desc(\u30C2)' | |
3960 | > echo ==== |
|
4019 | > echo ==== | |
3961 | > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30A2)' |
|
4020 | > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30A2)' | |
3962 | > echo ==== |
|
4021 | > echo ==== | |
3963 | > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30C2)' |
|
4022 | > hg --encoding cp932 log --template '{rev}\\n' -r 'keyword(\u30C2)' | |
3964 | > '''.encode('cp932') |
|
4023 | > '''.encode('cp932') | |
3965 | > EOF |
|
4024 | > EOF | |
3966 | $ sh < test.sh |
|
4025 | $ sh < test.sh | |
3967 | 0 |
|
4026 | 0 | |
3968 | ==== |
|
4027 | ==== | |
3969 | 1 |
|
4028 | 1 | |
3970 | ==== |
|
4029 | ==== | |
3971 | 2 |
|
4030 | 2 | |
3972 | ==== |
|
4031 | ==== | |
3973 | 3 |
|
4032 | 3 | |
3974 | ==== |
|
4033 | ==== | |
3975 | 0 |
|
4034 | 0 | |
3976 | 2 |
|
4035 | 2 | |
3977 | ==== |
|
4036 | ==== | |
3978 | 1 |
|
4037 | 1 | |
3979 | 3 |
|
4038 | 3 | |
3980 |
|
4039 | |||
3981 | test error message of bad revset |
|
4040 | test error message of bad revset | |
3982 | $ hg log -r 'foo\\' |
|
4041 | $ hg log -r 'foo\\' | |
3983 | hg: parse error at 3: syntax error in revset 'foo\\' |
|
4042 | hg: parse error at 3: syntax error in revset 'foo\\' | |
3984 | [255] |
|
4043 | [255] | |
3985 |
|
4044 | |||
3986 | $ cd .. |
|
4045 | $ cd .. | |
3987 |
|
4046 | |||
3988 | Test that revset predicate of extension isn't loaded at failure of |
|
4047 | Test that revset predicate of extension isn't loaded at failure of | |
3989 | loading it |
|
4048 | loading it | |
3990 |
|
4049 | |||
3991 | $ cd repo |
|
4050 | $ cd repo | |
3992 |
|
4051 | |||
3993 | $ cat <<EOF > $TESTTMP/custompredicate.py |
|
4052 | $ cat <<EOF > $TESTTMP/custompredicate.py | |
3994 | > from mercurial import error, registrar, revset |
|
4053 | > from mercurial import error, registrar, revset | |
3995 | > |
|
4054 | > | |
3996 | > revsetpredicate = registrar.revsetpredicate() |
|
4055 | > revsetpredicate = registrar.revsetpredicate() | |
3997 | > |
|
4056 | > | |
3998 | > @revsetpredicate('custom1()') |
|
4057 | > @revsetpredicate('custom1()') | |
3999 | > def custom1(repo, subset, x): |
|
4058 | > def custom1(repo, subset, x): | |
4000 | > return revset.baseset([1]) |
|
4059 | > return revset.baseset([1]) | |
4001 | > |
|
4060 | > | |
4002 | > raise error.Abort('intentional failure of loading extension') |
|
4061 | > raise error.Abort('intentional failure of loading extension') | |
4003 | > EOF |
|
4062 | > EOF | |
4004 | $ cat <<EOF > .hg/hgrc |
|
4063 | $ cat <<EOF > .hg/hgrc | |
4005 | > [extensions] |
|
4064 | > [extensions] | |
4006 | > custompredicate = $TESTTMP/custompredicate.py |
|
4065 | > custompredicate = $TESTTMP/custompredicate.py | |
4007 | > EOF |
|
4066 | > EOF | |
4008 |
|
4067 | |||
4009 | $ hg debugrevspec "custom1()" |
|
4068 | $ hg debugrevspec "custom1()" | |
4010 | *** failed to import extension custompredicate from $TESTTMP/custompredicate.py: intentional failure of loading extension |
|
4069 | *** failed to import extension custompredicate from $TESTTMP/custompredicate.py: intentional failure of loading extension | |
4011 | hg: parse error: unknown identifier: custom1 |
|
4070 | hg: parse error: unknown identifier: custom1 | |
4012 | [255] |
|
4071 | [255] | |
4013 |
|
4072 | |||
4014 | $ cd .. |
|
4073 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now