Show More
@@ -397,15 +397,18 b' def andset(repo, subset, x, y):' | |||||
397 | def differenceset(repo, subset, x, y): |
|
397 | def differenceset(repo, subset, x, y): | |
398 | return getset(repo, subset, x) - getset(repo, subset, y) |
|
398 | return getset(repo, subset, x) - getset(repo, subset, y) | |
399 |
|
399 | |||
400 |
def orset(repo, subset, |
|
400 | def _orsetlist(repo, subset, xs): | |
401 | assert xs |
|
401 | assert xs | |
402 | if len(xs) == 1: |
|
402 | if len(xs) == 1: | |
403 | return getset(repo, subset, xs[0]) |
|
403 | return getset(repo, subset, xs[0]) | |
404 | p = len(xs) // 2 |
|
404 | p = len(xs) // 2 | |
405 |
a = orset(repo, subset, |
|
405 | a = _orsetlist(repo, subset, xs[:p]) | |
406 |
b = orset(repo, subset, |
|
406 | b = _orsetlist(repo, subset, xs[p:]) | |
407 | return a + b |
|
407 | return a + b | |
408 |
|
408 | |||
|
409 | def orset(repo, subset, x): | |||
|
410 | return _orsetlist(repo, subset, getlist(x)) | |||
|
411 | ||||
409 | def notset(repo, subset, x): |
|
412 | def notset(repo, subset, x): | |
410 | return subset - getset(repo, subset, x) |
|
413 | return subset - getset(repo, subset, x) | |
411 |
|
414 | |||
@@ -2339,6 +2342,10 b' def _fixops(x):' | |||||
2339 | return _fixops(('range', post, x[2][1])) |
|
2342 | return _fixops(('range', post, x[2][1])) | |
2340 | elif x[2][0] == 'rangeall': |
|
2343 | elif x[2][0] == 'rangeall': | |
2341 | return _fixops(('rangepost', post)) |
|
2344 | return _fixops(('rangepost', post)) | |
|
2345 | elif op == 'or': | |||
|
2346 | # make number of arguments deterministic: | |||
|
2347 | # x + y + z -> (or x y z) -> (or (list x y z)) | |||
|
2348 | return (op, _fixops(('list',) + x[1:])) | |||
2342 |
|
2349 | |||
2343 | return (op,) + tuple(_fixops(y) for y in x[1:]) |
|
2350 | return (op,) + tuple(_fixops(y) for y in x[1:]) | |
2344 |
|
2351 | |||
@@ -2374,7 +2381,7 b' def _analyze(x):' | |||||
2374 | tb = _analyze(x[2]) |
|
2381 | tb = _analyze(x[2]) | |
2375 | return (op, ta, tb) |
|
2382 | return (op, ta, tb) | |
2376 | elif op == 'or': |
|
2383 | elif op == 'or': | |
2377 |
return (op, |
|
2384 | return (op, _analyze(x[1])) | |
2378 | elif op == 'not': |
|
2385 | elif op == 'not': | |
2379 | return (op, _analyze(x[1])) |
|
2386 | return (op, _analyze(x[1])) | |
2380 | elif op == 'parentpost': |
|
2387 | elif op == 'parentpost': | |
@@ -2445,7 +2452,7 b' def _optimize(x, small):' | |||||
2445 | ws.append(w) |
|
2452 | ws.append(w) | |
2446 | ts.append(t) |
|
2453 | ts.append(t) | |
2447 | del ss[:] |
|
2454 | del ss[:] | |
2448 |
for y in x[1 |
|
2455 | for y in getlist(x[1]): | |
2449 | w, t = _optimize(y, False) |
|
2456 | w, t = _optimize(y, False) | |
2450 | if t is not None and (t[0] == 'string' or t[0] == 'symbol'): |
|
2457 | if t is not None and (t[0] == 'string' or t[0] == 'symbol'): | |
2451 | ss.append((w, t)) |
|
2458 | ss.append((w, t)) | |
@@ -2459,7 +2466,7 b' def _optimize(x, small):' | |||||
2459 | # we can't reorder trees by weight because it would change the order. |
|
2466 | # we can't reorder trees by weight because it would change the order. | |
2460 | # ("sort(a + b)" == "sort(b + a)", but "a + b" != "b + a") |
|
2467 | # ("sort(a + b)" == "sort(b + a)", but "a + b" != "b + a") | |
2461 | # ts = tuple(t for w, t in sorted(zip(ws, ts), key=lambda wt: wt[0])) |
|
2468 | # ts = tuple(t for w, t in sorted(zip(ws, ts), key=lambda wt: wt[0])) | |
2462 | return max(ws), (op,) + tuple(ts) |
|
2469 | return max(ws), (op, ('list',) + tuple(ts)) | |
2463 | elif op == 'not': |
|
2470 | elif op == 'not': | |
2464 | # Optimize not public() to _notpublic() because we have a fast version |
|
2471 | # Optimize not public() to _notpublic() because we have a fast version | |
2465 | if x[1] == ('func', ('symbol', 'public'), None): |
|
2472 | if x[1] == ('func', ('symbol', 'public'), None): | |
@@ -2613,7 +2620,7 b' def matchany(ui, specs, repo=None):' | |||||
2613 | if len(specs) == 1: |
|
2620 | if len(specs) == 1: | |
2614 | tree = parse(specs[0], lookup) |
|
2621 | tree = parse(specs[0], lookup) | |
2615 | else: |
|
2622 | else: | |
2616 | tree = ('or',) + tuple(parse(s, lookup) for s in specs) |
|
2623 | tree = ('or', ('list',) + tuple(parse(s, lookup) for s in specs)) | |
2617 |
|
2624 | |||
2618 | if ui: |
|
2625 | if ui: | |
2619 | tree = expandaliases(ui, tree) |
|
2626 | tree = expandaliases(ui, tree) |
@@ -1455,12 +1455,13 b' glog always reorders nodes which explain' | |||||
1455 | (group |
|
1455 | (group | |
1456 | (group |
|
1456 | (group | |
1457 | (or |
|
1457 | (or | |
1458 |
( |
|
1458 | (list | |
1459 | ('symbol', 'user') |
|
1459 | (func | |
1460 |
('s |
|
1460 | ('symbol', 'user') | |
1461 | (func |
|
1461 | ('string', 'test')) | |
1462 | ('symbol', 'user') |
|
1462 | (func | |
1463 |
('s |
|
1463 | ('symbol', 'user') | |
|
1464 | ('string', 'not-a-user')))))) | |||
1464 | $ testlog -b not-a-branch |
|
1465 | $ testlog -b not-a-branch | |
1465 | abort: unknown revision 'not-a-branch'! |
|
1466 | abort: unknown revision 'not-a-branch'! | |
1466 | abort: unknown revision 'not-a-branch'! |
|
1467 | abort: unknown revision 'not-a-branch'! | |
@@ -1470,26 +1471,28 b' glog always reorders nodes which explain' | |||||
1470 | (group |
|
1471 | (group | |
1471 | (group |
|
1472 | (group | |
1472 | (or |
|
1473 | (or | |
1473 |
( |
|
1474 | (list | |
1474 | ('symbol', 'branch') |
|
1475 | (func | |
1475 |
('s |
|
1476 | ('symbol', 'branch') | |
1476 | (func |
|
1477 | ('string', 'default')) | |
1477 | ('symbol', 'branch') |
|
1478 | (func | |
1478 |
('s |
|
1479 | ('symbol', 'branch') | |
1479 | (func |
|
1480 | ('string', 'branch')) | |
1480 | ('symbol', 'branch') |
|
1481 | (func | |
1481 |
('s |
|
1482 | ('symbol', 'branch') | |
|
1483 | ('string', 'branch')))))) | |||
1482 | $ testlog -k expand -k merge |
|
1484 | $ testlog -k expand -k merge | |
1483 | [] |
|
1485 | [] | |
1484 | (group |
|
1486 | (group | |
1485 | (group |
|
1487 | (group | |
1486 | (or |
|
1488 | (or | |
1487 |
( |
|
1489 | (list | |
1488 | ('symbol', 'keyword') |
|
1490 | (func | |
1489 |
('s |
|
1491 | ('symbol', 'keyword') | |
1490 | (func |
|
1492 | ('string', 'expand')) | |
1491 | ('symbol', 'keyword') |
|
1493 | (func | |
1492 |
('s |
|
1494 | ('symbol', 'keyword') | |
|
1495 | ('string', 'merge')))))) | |||
1493 | $ testlog --only-merges |
|
1496 | $ testlog --only-merges | |
1494 | [] |
|
1497 | [] | |
1495 | (group |
|
1498 | (group | |
@@ -1520,17 +1523,19 b' glog always reorders nodes which explain' | |||||
1520 | (not |
|
1523 | (not | |
1521 | (group |
|
1524 | (group | |
1522 | (or |
|
1525 | (or | |
1523 |
( |
|
1526 | (list | |
1524 |
( |
|
1527 | ('string', '31') | |
1525 |
( |
|
1528 | (func | |
1526 |
('s |
|
1529 | ('symbol', 'ancestors') | |
|
1530 | ('string', '31')))))) | |||
1527 | (not |
|
1531 | (not | |
1528 | (group |
|
1532 | (group | |
1529 | (or |
|
1533 | (or | |
1530 |
( |
|
1534 | (list | |
1531 |
( |
|
1535 | ('string', '32') | |
1532 |
( |
|
1536 | (func | |
1533 |
('s |
|
1537 | ('symbol', 'ancestors') | |
|
1538 | ('string', '32'))))))))) | |||
1534 |
|
1539 | |||
1535 | Dedicated repo for --follow and paths filtering. The g is crafted to |
|
1540 | Dedicated repo for --follow and paths filtering. The g is crafted to | |
1536 | have 2 filelog topological heads in a linear changeset graph. |
|
1541 | have 2 filelog topological heads in a linear changeset graph. | |
@@ -1587,12 +1592,13 b' have 2 filelog topological heads in a li' | |||||
1587 | (group |
|
1592 | (group | |
1588 | (group |
|
1593 | (group | |
1589 | (or |
|
1594 | (or | |
1590 |
( |
|
1595 | (list | |
1591 | ('symbol', 'filelog') |
|
1596 | (func | |
1592 |
('s |
|
1597 | ('symbol', 'filelog') | |
1593 | (func |
|
1598 | ('string', 'a')) | |
1594 | ('symbol', 'filelog') |
|
1599 | (func | |
1595 |
('s |
|
1600 | ('symbol', 'filelog') | |
|
1601 | ('string', 'b')))))) | |||
1596 |
|
1602 | |||
1597 | Test falling back to slow path for non-existing files |
|
1603 | Test falling back to slow path for non-existing files | |
1598 |
|
1604 | |||
@@ -1744,12 +1750,13 b' Test --follow and multiple files' | |||||
1744 | (group |
|
1750 | (group | |
1745 | (group |
|
1751 | (group | |
1746 | (or |
|
1752 | (or | |
1747 |
( |
|
1753 | (list | |
1748 | ('symbol', 'follow') |
|
1754 | (func | |
1749 |
('s |
|
1755 | ('symbol', 'follow') | |
1750 | (func |
|
1756 | ('string', 'g')) | |
1751 | ('symbol', 'follow') |
|
1757 | (func | |
1752 |
('s |
|
1758 | ('symbol', 'follow') | |
|
1759 | ('string', 'e')))))) | |||
1753 | $ cat log.nodes |
|
1760 | $ cat log.nodes | |
1754 | nodetag 4 |
|
1761 | nodetag 4 | |
1755 | nodetag 3 |
|
1762 | nodetag 3 |
@@ -187,9 +187,10 b' trivial' | |||||
187 | 6 |
|
187 | 6 | |
188 | $ try '0|1|2' |
|
188 | $ try '0|1|2' | |
189 | (or |
|
189 | (or | |
190 | ('symbol', '0') |
|
190 | (list | |
191 |
('symbol', ' |
|
191 | ('symbol', '0') | |
192 |
('symbol', ' |
|
192 | ('symbol', '1') | |
|
193 | ('symbol', '2'))) | |||
193 | * set: |
|
194 | * set: | |
194 | <baseset [0, 1, 2]> |
|
195 | <baseset [0, 1, 2]> | |
195 | 0 |
|
196 | 0 | |
@@ -339,10 +340,11 b' quoting needed' | |||||
339 | $ log '1&2' |
|
340 | $ log '1&2' | |
340 | $ try '1&2|3' # precedence - and is higher |
|
341 | $ try '1&2|3' # precedence - and is higher | |
341 | (or |
|
342 | (or | |
342 | (and |
|
343 | (list | |
343 | ('symbol', '1') |
|
344 | (and | |
344 |
('symbol', ' |
|
345 | ('symbol', '1') | |
345 |
('symbol', ' |
|
346 | ('symbol', '2')) | |
|
347 | ('symbol', '3'))) | |||
346 | * set: |
|
348 | * set: | |
347 | <addset |
|
349 | <addset | |
348 | <baseset []>, |
|
350 | <baseset []>, | |
@@ -350,10 +352,11 b' quoting needed' | |||||
350 | 3 |
|
352 | 3 | |
351 | $ try '1|2&3' |
|
353 | $ try '1|2&3' | |
352 | (or |
|
354 | (or | |
353 | ('symbol', '1') |
|
355 | (list | |
354 | (and |
|
356 | ('symbol', '1') | |
355 | ('symbol', '2') |
|
357 | (and | |
356 |
('symbol', ' |
|
358 | ('symbol', '2') | |
|
359 | ('symbol', '3')))) | |||
357 | * set: |
|
360 | * set: | |
358 | <addset |
|
361 | <addset | |
359 | <baseset [1]>, |
|
362 | <baseset [1]>, | |
@@ -369,11 +372,13 b' quoting needed' | |||||
369 | <baseset []> |
|
372 | <baseset []> | |
370 | $ try '1|(2|3)' |
|
373 | $ try '1|(2|3)' | |
371 | (or |
|
374 | (or | |
372 | ('symbol', '1') |
|
375 | (list | |
373 | (group |
|
376 | ('symbol', '1') | |
374 |
( |
|
377 | (group | |
375 | ('symbol', '2') |
|
378 | (or | |
376 | ('symbol', '3')))) |
|
379 | (list | |
|
380 | ('symbol', '2') | |||
|
381 | ('symbol', '3')))))) | |||
377 | * set: |
|
382 | * set: | |
378 | <addset |
|
383 | <addset | |
379 | <baseset [1]>, |
|
384 | <baseset [1]>, | |
@@ -465,8 +470,9 b' keyword arguments' | |||||
465 | (keyvalue |
|
470 | (keyvalue | |
466 | ('symbol', 'foo') |
|
471 | ('symbol', 'foo') | |
467 | (or |
|
472 | (or | |
468 | ('symbol', 'bar') |
|
473 | (list | |
469 |
('symbol', 'ba |
|
474 | ('symbol', 'bar') | |
|
475 | ('symbol', 'baz')))) | |||
470 | hg: parse error: can't use a key-value pair in this context |
|
476 | hg: parse error: can't use a key-value pair in this context | |
471 | [255] |
|
477 | [255] | |
472 |
|
478 | |||
@@ -528,14 +534,16 b' parsed tree at stages:' | |||||
528 | (minus |
|
534 | (minus | |
529 | (group |
|
535 | (group | |
530 | (or |
|
536 | (or | |
531 | ('symbol', '0') |
|
537 | (list | |
532 |
('symbol', ' |
|
538 | ('symbol', '0') | |
|
539 | ('symbol', '1')))) | |||
533 | ('symbol', '1')) |
|
540 | ('symbol', '1')) | |
534 | * analyzed: |
|
541 | * analyzed: | |
535 | (and |
|
542 | (and | |
536 | (or |
|
543 | (or | |
537 | ('symbol', '0') |
|
544 | (list | |
538 |
('symbol', ' |
|
545 | ('symbol', '0') | |
|
546 | ('symbol', '1'))) | |||
539 | (not |
|
547 | (not | |
540 | ('symbol', '1'))) |
|
548 | ('symbol', '1'))) | |
541 | * optimized: |
|
549 | * optimized: | |
@@ -1242,9 +1250,10 b' ordering defined by it.' | |||||
1242 | ('symbol', '0')) |
|
1250 | ('symbol', '0')) | |
1243 | (group |
|
1251 | (group | |
1244 | (or |
|
1252 | (or | |
1245 | ('symbol', '0') |
|
1253 | (list | |
1246 |
('symbol', ' |
|
1254 | ('symbol', '0') | |
1247 |
('symbol', ' |
|
1255 | ('symbol', '1') | |
|
1256 | ('symbol', '2'))))) | |||
1248 | * optimized: |
|
1257 | * optimized: | |
1249 | (and |
|
1258 | (and | |
1250 | (range |
|
1259 | (range | |
@@ -1269,20 +1278,22 b' ordering defined by it.' | |||||
1269 | ('symbol', '0')) |
|
1278 | ('symbol', '0')) | |
1270 | (group |
|
1279 | (group | |
1271 | (or |
|
1280 | (or | |
1272 |
( |
|
1281 | (list | |
1273 | ('symbol', '0') |
|
1282 | (range | |
1274 |
('symbol', ' |
|
1283 | ('symbol', '0') | |
1275 |
('symbol', ' |
|
1284 | ('symbol', '1')) | |
|
1285 | ('symbol', '2'))))) | |||
1276 | * optimized: |
|
1286 | * optimized: | |
1277 | (and |
|
1287 | (and | |
1278 | (range |
|
1288 | (range | |
1279 | ('symbol', '2') |
|
1289 | ('symbol', '2') | |
1280 | ('symbol', '0')) |
|
1290 | ('symbol', '0')) | |
1281 | (or |
|
1291 | (or | |
1282 |
( |
|
1292 | (list | |
1283 | ('symbol', '0') |
|
1293 | (range | |
1284 |
('symbol', ' |
|
1294 | ('symbol', '0') | |
1285 |
('symbol', ' |
|
1295 | ('symbol', '1')) | |
|
1296 | ('symbol', '2')))) | |||
1286 | * set: |
|
1297 | * set: | |
1287 | <addset |
|
1298 | <addset | |
1288 | <filteredset |
|
1299 | <filteredset | |
@@ -1402,9 +1413,10 b' ordering defined by it.' | |||||
1402 | (func |
|
1413 | (func | |
1403 | ('symbol', 'present') |
|
1414 | ('symbol', 'present') | |
1404 | (or |
|
1415 | (or | |
1405 | ('symbol', '0') |
|
1416 | (list | |
1406 |
('symbol', ' |
|
1417 | ('symbol', '0') | |
1407 |
('symbol', ' |
|
1418 | ('symbol', '1') | |
|
1419 | ('symbol', '2'))))) | |||
1408 | * optimized: |
|
1420 | * optimized: | |
1409 | (and |
|
1421 | (and | |
1410 | (range |
|
1422 | (range | |
@@ -1499,9 +1511,10 b' ordering defined by it.' | |||||
1499 | (func |
|
1511 | (func | |
1500 | ('symbol', 'first') |
|
1512 | ('symbol', 'first') | |
1501 | (or |
|
1513 | (or | |
1502 | ('symbol', '1') |
|
1514 | (list | |
1503 |
('symbol', ' |
|
1515 | ('symbol', '1') | |
1504 |
('symbol', ' |
|
1516 | ('symbol', '0') | |
|
1517 | ('symbol', '2'))))) | |||
1505 | * optimized: |
|
1518 | * optimized: | |
1506 | (and |
|
1519 | (and | |
1507 | (range |
|
1520 | (range | |
@@ -1528,9 +1541,10 b' ordering defined by it.' | |||||
1528 | (func |
|
1541 | (func | |
1529 | ('symbol', 'last') |
|
1542 | ('symbol', 'last') | |
1530 | (or |
|
1543 | (or | |
1531 |
( |
|
1544 | (list | |
1532 |
('symbol', ' |
|
1545 | ('symbol', '0') | |
1533 |
('symbol', ' |
|
1546 | ('symbol', '2') | |
|
1547 | ('symbol', '1')))))) | |||
1534 | * optimized: |
|
1548 | * optimized: | |
1535 | (difference |
|
1549 | (difference | |
1536 | (range |
|
1550 | (range | |
@@ -1562,14 +1576,16 b' ordering defined by it.' | |||||
1562 | (range |
|
1576 | (range | |
1563 | (group |
|
1577 | (group | |
1564 | (or |
|
1578 | (or | |
1565 |
( |
|
1579 | (list | |
1566 |
('symbol', ' |
|
1580 | ('symbol', '1') | |
1567 |
('symbol', ' |
|
1581 | ('symbol', '0') | |
|
1582 | ('symbol', '2')))) | |||
1568 | (group |
|
1583 | (group | |
1569 | (or |
|
1584 | (or | |
1570 |
( |
|
1585 | (list | |
1571 |
('symbol', ' |
|
1586 | ('symbol', '0') | |
1572 |
('symbol', ' |
|
1587 | ('symbol', '2') | |
|
1588 | ('symbol', '1')))))) | |||
1573 | * optimized: |
|
1589 | * optimized: | |
1574 | (and |
|
1590 | (and | |
1575 | (range |
|
1591 | (range | |
@@ -1599,9 +1615,10 b' ordering defined by it.' | |||||
1599 | ('string', 'glob:*')) |
|
1615 | ('string', 'glob:*')) | |
1600 | (group |
|
1616 | (group | |
1601 | (or |
|
1617 | (or | |
1602 | ('symbol', '2') |
|
1618 | (list | |
1603 |
('symbol', ' |
|
1619 | ('symbol', '2') | |
1604 |
('symbol', ' |
|
1620 | ('symbol', '0') | |
|
1621 | ('symbol', '1'))))) | |||
1605 | * optimized: |
|
1622 | * optimized: | |
1606 | (and |
|
1623 | (and | |
1607 | (func |
|
1624 | (func | |
@@ -1628,9 +1645,10 b' ordering defined by it.' | |||||
1628 | ('string', 'glob:*'))) |
|
1645 | ('string', 'glob:*'))) | |
1629 | (group |
|
1646 | (group | |
1630 | (or |
|
1647 | (or | |
1631 | ('symbol', '0') |
|
1648 | (list | |
1632 |
('symbol', ' |
|
1649 | ('symbol', '0') | |
1633 |
('symbol', ' |
|
1650 | ('symbol', '2') | |
|
1651 | ('symbol', '1'))))) | |||
1634 | * optimized: |
|
1652 | * optimized: | |
1635 | (and |
|
1653 | (and | |
1636 | (func |
|
1654 | (func | |
@@ -1975,14 +1993,15 b' test that `or` operation skips duplicate' | |||||
1975 |
|
1993 | |||
1976 | $ try 'reverse(1::5) or ancestors(4)' |
|
1994 | $ try 'reverse(1::5) or ancestors(4)' | |
1977 | (or |
|
1995 | (or | |
1978 | (func |
|
1996 | (list | |
1979 | ('symbol', 'reverse') |
|
1997 | (func | |
1980 | (dagrange |
|
1998 | ('symbol', 'reverse') | |
1981 | ('symbol', '1') |
|
1999 | (dagrange | |
1982 |
('symbol', ' |
|
2000 | ('symbol', '1') | |
1983 | (func |
|
2001 | ('symbol', '5'))) | |
1984 | ('symbol', 'ancestors') |
|
2002 | (func | |
1985 |
('symbol', ' |
|
2003 | ('symbol', 'ancestors') | |
|
2004 | ('symbol', '4')))) | |||
1986 | * set: |
|
2005 | * set: | |
1987 | <addset |
|
2006 | <addset | |
1988 | <baseset- [1, 3, 5]>, |
|
2007 | <baseset- [1, 3, 5]>, | |
@@ -1997,14 +2016,15 b' test that `or` operation skips duplicate' | |||||
1997 | (func |
|
2016 | (func | |
1998 | ('symbol', 'sort') |
|
2017 | ('symbol', 'sort') | |
1999 | (or |
|
2018 | (or | |
2000 |
( |
|
2019 | (list | |
2001 | ('symbol', 'ancestors') |
|
2020 | (func | |
2002 |
('symbol', ' |
|
2021 | ('symbol', 'ancestors') | |
2003 | (func |
|
2022 | ('symbol', '4')) | |
2004 | ('symbol', 'reverse') |
|
2023 | (func | |
2005 | (dagrange |
|
2024 | ('symbol', 'reverse') | |
2006 | ('symbol', '1') |
|
2025 | (dagrange | |
2007 |
('symbol', ' |
|
2026 | ('symbol', '1') | |
|
2027 | ('symbol', '5')))))) | |||
2008 | * set: |
|
2028 | * set: | |
2009 | <addset+ |
|
2029 | <addset+ | |
2010 | <generatorset+>, |
|
2030 | <generatorset+>, | |
@@ -2020,14 +2040,15 b' test optimization of trivial `or` operat' | |||||
2020 |
|
2040 | |||
2021 | $ try --optimize '0|(1)|"2"|-2|tip|null' |
|
2041 | $ try --optimize '0|(1)|"2"|-2|tip|null' | |
2022 | (or |
|
2042 | (or | |
2023 | ('symbol', '0') |
|
2043 | (list | |
2024 | (group |
|
2044 | ('symbol', '0') | |
2025 | ('symbol', '1')) |
|
2045 | (group | |
2026 |
('s |
|
2046 | ('symbol', '1')) | |
2027 | (negate |
|
2047 | ('string', '2') | |
2028 | ('symbol', '2')) |
|
2048 | (negate | |
2029 |
('symbol', ' |
|
2049 | ('symbol', '2')) | |
2030 |
('symbol', ' |
|
2050 | ('symbol', 'tip') | |
|
2051 | ('symbol', 'null'))) | |||
2031 | * optimized: |
|
2052 | * optimized: | |
2032 | (func |
|
2053 | (func | |
2033 | ('symbol', '_list') |
|
2054 | ('symbol', '_list') | |
@@ -2043,19 +2064,21 b' test optimization of trivial `or` operat' | |||||
2043 |
|
2064 | |||
2044 | $ try --optimize '0|1|2:3' |
|
2065 | $ try --optimize '0|1|2:3' | |
2045 | (or |
|
2066 | (or | |
2046 | ('symbol', '0') |
|
2067 | (list | |
2047 |
('symbol', ' |
|
2068 | ('symbol', '0') | |
2048 | (range |
|
2069 | ('symbol', '1') | |
2049 | ('symbol', '2') |
|
2070 | (range | |
2050 |
('symbol', ' |
|
2071 | ('symbol', '2') | |
|
2072 | ('symbol', '3')))) | |||
2051 | * optimized: |
|
2073 | * optimized: | |
2052 | (or |
|
2074 | (or | |
2053 | (func |
|
2075 | (list | |
2054 | ('symbol', '_list') |
|
2076 | (func | |
2055 | ('string', '0\x001')) |
|
2077 | ('symbol', '_list') | |
2056 | (range |
|
2078 | ('string', '0\x001')) | |
2057 | ('symbol', '2') |
|
2079 | (range | |
2058 |
('symbol', ' |
|
2080 | ('symbol', '2') | |
|
2081 | ('symbol', '3')))) | |||
2059 | * set: |
|
2082 | * set: | |
2060 | <addset |
|
2083 | <addset | |
2061 | <baseset [0, 1]>, |
|
2084 | <baseset [0, 1]>, | |
@@ -2067,27 +2090,29 b' test optimization of trivial `or` operat' | |||||
2067 |
|
2090 | |||
2068 | $ try --optimize '0:1|2|3:4|5|6' |
|
2091 | $ try --optimize '0:1|2|3:4|5|6' | |
2069 | (or |
|
2092 | (or | |
2070 | (range |
|
2093 | (list | |
2071 | ('symbol', '0') |
|
2094 | (range | |
2072 |
('symbol', ' |
|
2095 | ('symbol', '0') | |
2073 |
('symbol', ' |
|
2096 | ('symbol', '1')) | |
2074 | (range |
|
2097 | ('symbol', '2') | |
2075 | ('symbol', '3') |
|
2098 | (range | |
2076 |
('symbol', ' |
|
2099 | ('symbol', '3') | |
2077 |
('symbol', ' |
|
2100 | ('symbol', '4')) | |
2078 |
('symbol', ' |
|
2101 | ('symbol', '5') | |
|
2102 | ('symbol', '6'))) | |||
2079 | * optimized: |
|
2103 | * optimized: | |
2080 | (or |
|
2104 | (or | |
2081 | (range |
|
2105 | (list | |
2082 | ('symbol', '0') |
|
2106 | (range | |
2083 |
('symbol', ' |
|
2107 | ('symbol', '0') | |
2084 |
('symbol', ' |
|
2108 | ('symbol', '1')) | |
2085 | (range |
|
2109 | ('symbol', '2') | |
2086 | ('symbol', '3') |
|
2110 | (range | |
2087 |
('symbol', ' |
|
2111 | ('symbol', '3') | |
2088 | (func |
|
2112 | ('symbol', '4')) | |
2089 | ('symbol', '_list') |
|
2113 | (func | |
2090 | ('string', '5\x006'))) |
|
2114 | ('symbol', '_list') | |
|
2115 | ('string', '5\x006')))) | |||
2091 | * set: |
|
2116 | * set: | |
2092 | <addset |
|
2117 | <addset | |
2093 | <addset |
|
2118 | <addset | |
@@ -2109,11 +2134,12 b' unoptimized `or` looks like this' | |||||
2109 | $ try --no-optimized -p analyzed '0|1|2|3|4' |
|
2134 | $ try --no-optimized -p analyzed '0|1|2|3|4' | |
2110 | * analyzed: |
|
2135 | * analyzed: | |
2111 | (or |
|
2136 | (or | |
2112 | ('symbol', '0') |
|
2137 | (list | |
2113 |
('symbol', ' |
|
2138 | ('symbol', '0') | |
2114 |
('symbol', ' |
|
2139 | ('symbol', '1') | |
2115 |
('symbol', ' |
|
2140 | ('symbol', '2') | |
2116 |
('symbol', ' |
|
2141 | ('symbol', '3') | |
|
2142 | ('symbol', '4'))) | |||
2117 | * set: |
|
2143 | * set: | |
2118 | <addset |
|
2144 | <addset | |
2119 | <addset |
|
2145 | <addset | |
@@ -2188,21 +2214,22 b' test that chained `or` operations make b' | |||||
2188 |
|
2214 | |||
2189 | $ try '0:1|1:2|2:3|3:4|4:5' |
|
2215 | $ try '0:1|1:2|2:3|3:4|4:5' | |
2190 | (or |
|
2216 | (or | |
2191 | (range |
|
2217 | (list | |
2192 | ('symbol', '0') |
|
2218 | (range | |
2193 |
('symbol', ' |
|
2219 | ('symbol', '0') | |
2194 | (range |
|
2220 | ('symbol', '1')) | |
2195 | ('symbol', '1') |
|
2221 | (range | |
2196 |
('symbol', ' |
|
2222 | ('symbol', '1') | |
2197 | (range |
|
2223 | ('symbol', '2')) | |
2198 | ('symbol', '2') |
|
2224 | (range | |
2199 |
('symbol', ' |
|
2225 | ('symbol', '2') | |
2200 | (range |
|
2226 | ('symbol', '3')) | |
2201 | ('symbol', '3') |
|
2227 | (range | |
2202 |
('symbol', ' |
|
2228 | ('symbol', '3') | |
2203 | (range |
|
2229 | ('symbol', '4')) | |
2204 | ('symbol', '4') |
|
2230 | (range | |
2205 |
('symbol', ' |
|
2231 | ('symbol', '4') | |
|
2232 | ('symbol', '5')))) | |||
2206 | * set: |
|
2233 | * set: | |
2207 | <addset |
|
2234 | <addset | |
2208 | <addset |
|
2235 | <addset | |
@@ -2224,13 +2251,15 b' no crash by empty group "()" while optim' | |||||
2224 |
|
2251 | |||
2225 | $ try --optimize '0|()' |
|
2252 | $ try --optimize '0|()' | |
2226 | (or |
|
2253 | (or | |
2227 | ('symbol', '0') |
|
2254 | (list | |
2228 | (group |
|
2255 | ('symbol', '0') | |
2229 | None)) |
|
2256 | (group | |
|
2257 | None))) | |||
2230 | * optimized: |
|
2258 | * optimized: | |
2231 | (or |
|
2259 | (or | |
2232 | ('symbol', '0') |
|
2260 | (list | |
2233 | None) |
|
2261 | ('symbol', '0') | |
|
2262 | None)) | |||
2234 | hg: parse error: missing argument |
|
2263 | hg: parse error: missing argument | |
2235 | [255] |
|
2264 | [255] | |
2236 |
|
2265 | |||
@@ -2715,10 +2744,12 b' test infinite recursion' | |||||
2715 | ('symbol', '3'))) |
|
2744 | ('symbol', '3'))) | |
2716 | * expanded: |
|
2745 | * expanded: | |
2717 | (or |
|
2746 | (or | |
2718 | ('symbol', '3') |
|
2747 | (list | |
2719 | (or |
|
2748 | ('symbol', '3') | |
2720 | ('symbol', '1') |
|
2749 | (or | |
2721 | ('symbol', '2'))) |
|
2750 | (list | |
|
2751 | ('symbol', '1') | |||
|
2752 | ('symbol', '2'))))) | |||
2722 | * set: |
|
2753 | * set: | |
2723 | <addset |
|
2754 | <addset | |
2724 | <baseset [3]>, |
|
2755 | <baseset [3]>, | |
@@ -2769,15 +2800,16 b' test chained `or` operations are flatten' | |||||
2769 | ('symbol', '3')))) |
|
2800 | ('symbol', '3')))) | |
2770 | * expanded: |
|
2801 | * expanded: | |
2771 | (or |
|
2802 | (or | |
2772 | (range |
|
2803 | (list | |
2773 | ('symbol', '0') |
|
2804 | (range | |
2774 |
('symbol', ' |
|
2805 | ('symbol', '0') | |
2775 | (range |
|
2806 | ('symbol', '1')) | |
2776 | ('symbol', '1') |
|
2807 | (range | |
2777 |
('symbol', ' |
|
2808 | ('symbol', '1') | |
2778 | (range |
|
2809 | ('symbol', '2')) | |
2779 | ('symbol', '2') |
|
2810 | (range | |
2780 |
('symbol', ' |
|
2811 | ('symbol', '2') | |
|
2812 | ('symbol', '3')))) | |||
2781 | * set: |
|
2813 | * set: | |
2782 | <addset |
|
2814 | <addset | |
2783 | <spanset+ 0:1>, |
|
2815 | <spanset+ 0:1>, | |
@@ -2868,10 +2900,11 b' test unknown reference:' | |||||
2868 | ('symbol', 'tip'))) |
|
2900 | ('symbol', 'tip'))) | |
2869 | * expanded: |
|
2901 | * expanded: | |
2870 | (or |
|
2902 | (or | |
2871 | ('symbol', 'tip') |
|
2903 | (list | |
2872 | (func |
|
2904 | ('symbol', 'tip') | |
2873 | ('symbol', 'desc') |
|
2905 | (func | |
2874 |
('s |
|
2906 | ('symbol', 'desc') | |
|
2907 | ('string', '$1')))) | |||
2875 | * set: |
|
2908 | * set: | |
2876 | <addset |
|
2909 | <addset | |
2877 | <baseset [9]>, |
|
2910 | <baseset [9]>, | |
@@ -2907,8 +2940,9 b' test unknown reference:' | |||||
2907 | ('symbol', 'rs') |
|
2940 | ('symbol', 'rs') | |
2908 | (list |
|
2941 | (list | |
2909 | (or |
|
2942 | (or | |
2910 | ('symbol', '2') |
|
2943 | (list | |
2911 |
('symbol', ' |
|
2944 | ('symbol', '2') | |
|
2945 | ('symbol', '3'))) | |||
2912 | ('symbol', 'date'))) |
|
2946 | ('symbol', 'date'))) | |
2913 | * expanded: |
|
2947 | * expanded: | |
2914 | (func |
|
2948 | (func | |
@@ -2917,8 +2951,9 b' test unknown reference:' | |||||
2917 | ('symbol', 'sort') |
|
2951 | ('symbol', 'sort') | |
2918 | (list |
|
2952 | (list | |
2919 | (or |
|
2953 | (or | |
2920 |
( |
|
2954 | (list | |
2921 |
('symbol', ' |
|
2955 | ('symbol', '2') | |
|
2956 | ('symbol', '3'))) | |||
2922 | ('symbol', 'date')))) |
|
2957 | ('symbol', 'date')))) | |
2923 | * set: |
|
2958 | * set: | |
2924 | <baseset [3, 2]> |
|
2959 | <baseset [3, 2]> | |
@@ -2950,8 +2985,9 b' test unknown reference:' | |||||
2950 | ('symbol', 'rs4') |
|
2985 | ('symbol', 'rs4') | |
2951 | (list |
|
2986 | (list | |
2952 | (or |
|
2987 | (or | |
2953 | ('symbol', '2') |
|
2988 | (list | |
2954 |
('symbol', ' |
|
2989 | ('symbol', '2') | |
|
2990 | ('symbol', '3'))) | |||
2955 | ('symbol', 'x') |
|
2991 | ('symbol', 'x') | |
2956 | ('symbol', 'x') |
|
2992 | ('symbol', 'x') | |
2957 | ('symbol', 'date'))) |
|
2993 | ('symbol', 'date'))) | |
@@ -2962,8 +2998,9 b' test unknown reference:' | |||||
2962 | ('symbol', 'sort') |
|
2998 | ('symbol', 'sort') | |
2963 | (list |
|
2999 | (list | |
2964 | (or |
|
3000 | (or | |
2965 |
( |
|
3001 | (list | |
2966 |
('symbol', ' |
|
3002 | ('symbol', '2') | |
|
3003 | ('symbol', '3'))) | |||
2967 | ('symbol', 'date')))) |
|
3004 | ('symbol', 'date')))) | |
2968 | * set: |
|
3005 | * set: | |
2969 | <baseset [3, 2]> |
|
3006 | <baseset [3, 2]> | |
@@ -3034,9 +3071,10 b' issue2549 - correct optimizations' | |||||
3034 | ('symbol', 'limit') |
|
3071 | ('symbol', 'limit') | |
3035 | (list |
|
3072 | (list | |
3036 | (or |
|
3073 | (or | |
3037 |
( |
|
3074 | (list | |
3038 |
('symbol', ' |
|
3075 | ('symbol', '1') | |
3039 |
('symbol', ' |
|
3076 | ('symbol', '2') | |
|
3077 | ('symbol', '3'))) | |||
3040 | ('symbol', '2'))) |
|
3078 | ('symbol', '2'))) | |
3041 | (not |
|
3079 | (not | |
3042 | ('symbol', '2'))) |
|
3080 | ('symbol', '2'))) | |
@@ -3054,8 +3092,9 b' issue2549 - correct optimizations' | |||||
3054 | (func |
|
3092 | (func | |
3055 | ('symbol', 'max') |
|
3093 | ('symbol', 'max') | |
3056 | (or |
|
3094 | (or | |
3057 | ('symbol', '1') |
|
3095 | (list | |
3058 |
('symbol', ' |
|
3096 | ('symbol', '1') | |
|
3097 | ('symbol', '2')))) | |||
3059 | (not |
|
3098 | (not | |
3060 | ('symbol', '2'))) |
|
3099 | ('symbol', '2'))) | |
3061 | * set: |
|
3100 | * set: | |
@@ -3071,8 +3110,9 b' issue2549 - correct optimizations' | |||||
3071 | (func |
|
3110 | (func | |
3072 | ('symbol', 'min') |
|
3111 | ('symbol', 'min') | |
3073 | (or |
|
3112 | (or | |
3074 | ('symbol', '1') |
|
3113 | (list | |
3075 |
('symbol', ' |
|
3114 | ('symbol', '1') | |
|
3115 | ('symbol', '2')))) | |||
3076 | (not |
|
3116 | (not | |
3077 | ('symbol', '1'))) |
|
3117 | ('symbol', '1'))) | |
3078 | * set: |
|
3118 | * set: | |
@@ -3089,8 +3129,9 b' issue2549 - correct optimizations' | |||||
3089 | ('symbol', 'last') |
|
3129 | ('symbol', 'last') | |
3090 | (list |
|
3130 | (list | |
3091 | (or |
|
3131 | (or | |
3092 |
( |
|
3132 | (list | |
3093 |
('symbol', ' |
|
3133 | ('symbol', '1') | |
|
3134 | ('symbol', '2'))) | |||
3094 | ('symbol', '1'))) |
|
3135 | ('symbol', '1'))) | |
3095 | (not |
|
3136 | (not | |
3096 | ('symbol', '2'))) |
|
3137 | ('symbol', '2'))) |
General Comments 0
You need to be logged in to leave comments.
Login now