##// END OF EJS Templates
revset: fix order of nested '_(|int|hex)list' expression (BC)...
Yuya Nishihara -
r29935:e34cd85d default
parent child Browse files
Show More
@@ -2253,9 +2253,7 b' def wdir(repo, subset, x):'
2253 return baseset([node.wdirrev])
2253 return baseset([node.wdirrev])
2254 return baseset()
2254 return baseset()
2255
2255
2256 # for internal use
2256 def _orderedlist(repo, subset, x):
2257 @predicate('_list', safe=True)
2258 def _list(repo, subset, x):
2259 s = getstring(x, "internal error")
2257 s = getstring(x, "internal error")
2260 if not s:
2258 if not s:
2261 return baseset()
2259 return baseset()
@@ -2284,8 +2282,15 b' def _list(repo, subset, x):'
2284 return baseset(ls)
2282 return baseset(ls)
2285
2283
2286 # for internal use
2284 # for internal use
2287 @predicate('_intlist', safe=True)
2285 @predicate('_list', safe=True, takeorder=True)
2288 def _intlist(repo, subset, x):
2286 def _list(repo, subset, x, order):
2287 if order == followorder:
2288 # slow path to take the subset order
2289 return subset & _orderedlist(repo, fullreposet(repo), x)
2290 else:
2291 return _orderedlist(repo, subset, x)
2292
2293 def _orderedintlist(repo, subset, x):
2289 s = getstring(x, "internal error")
2294 s = getstring(x, "internal error")
2290 if not s:
2295 if not s:
2291 return baseset()
2296 return baseset()
@@ -2294,8 +2299,15 b' def _intlist(repo, subset, x):'
2294 return baseset([r for r in ls if r in s])
2299 return baseset([r for r in ls if r in s])
2295
2300
2296 # for internal use
2301 # for internal use
2297 @predicate('_hexlist', safe=True)
2302 @predicate('_intlist', safe=True, takeorder=True)
2298 def _hexlist(repo, subset, x):
2303 def _intlist(repo, subset, x, order):
2304 if order == followorder:
2305 # slow path to take the subset order
2306 return subset & _orderedintlist(repo, fullreposet(repo), x)
2307 else:
2308 return _orderedintlist(repo, subset, x)
2309
2310 def _orderedhexlist(repo, subset, x):
2299 s = getstring(x, "internal error")
2311 s = getstring(x, "internal error")
2300 if not s:
2312 if not s:
2301 return baseset()
2313 return baseset()
@@ -2304,6 +2316,15 b' def _hexlist(repo, subset, x):'
2304 s = subset
2316 s = subset
2305 return baseset([r for r in ls if r in s])
2317 return baseset([r for r in ls if r in s])
2306
2318
2319 # for internal use
2320 @predicate('_hexlist', safe=True, takeorder=True)
2321 def _hexlist(repo, subset, x, order):
2322 if order == followorder:
2323 # slow path to take the subset order
2324 return subset & _orderedhexlist(repo, fullreposet(repo), x)
2325 else:
2326 return _orderedhexlist(repo, subset, x)
2327
2307 methods = {
2328 methods = {
2308 "range": rangeset,
2329 "range": rangeset,
2309 "dagrange": dagrange,
2330 "dagrange": dagrange,
@@ -1281,11 +1281,12 b' ordering defined by it.'
1281 follow)
1281 follow)
1282 define)
1282 define)
1283 * set:
1283 * set:
1284 <baseset [0, 1, 2]>
1284 <filteredset
1285 0
1285 <spanset- 0:2>,
1286 <baseset [0, 1, 2]>>
1287 2
1286 1
1288 1
1287 2
1289 0
1288 BROKEN: should be '2 1 0'
1289
1290
1290 'A + B' should take the ordering of the left expression:
1291 'A + B' should take the ordering of the left expression:
1291
1292
@@ -1350,7 +1351,7 b' ordering defined by it.'
1350 * set:
1351 * set:
1351 <filteredset
1352 <filteredset
1352 <spanset- 0:2>,
1353 <spanset- 0:2>,
1353 <baseset [0, 1, 2]>>
1354 <baseset+ [0, 1, 2]>>
1354 2
1355 2
1355 1
1356 1
1356 0
1357 0
@@ -1405,11 +1406,12 b' ordering defined by it.'
1405 follow)
1406 follow)
1406 define)
1407 define)
1407 * set:
1408 * set:
1408 <baseset [0, 1, 2]>
1409 <filteredset
1409 0
1410 <spanset- 0:2>,
1411 <baseset [0, 1, 2]>>
1412 2
1410 1
1413 1
1411 2
1414 0
1412 BROKEN: should be '2 1 0'
1413
1415
1414 $ trylist --optimize --bin '%ln & 2:0' `hg log -T '{node} ' -r0+2+1`
1416 $ trylist --optimize --bin '%ln & 2:0' `hg log -T '{node} ' -r0+2+1`
1415 (and
1417 (and
@@ -1436,6 +1438,53 b' ordering defined by it.'
1436 2
1438 2
1437 1
1439 1
1438
1440
1441 '_list' should not go through the slow follow-order path if order doesn't
1442 matter:
1443
1444 $ try -p optimized '2:0 & not (0 + 1)'
1445 * optimized:
1446 (difference
1447 (range
1448 ('symbol', '2')
1449 ('symbol', '0')
1450 define)
1451 (func
1452 ('symbol', '_list')
1453 ('string', '0\x001')
1454 any)
1455 define)
1456 * set:
1457 <filteredset
1458 <spanset- 0:2>,
1459 <not
1460 <baseset [0, 1]>>>
1461 2
1462
1463 $ try -p optimized '2:0 & not (0:2 & (0 + 1))'
1464 * optimized:
1465 (difference
1466 (range
1467 ('symbol', '2')
1468 ('symbol', '0')
1469 define)
1470 (and
1471 (range
1472 ('symbol', '0')
1473 ('symbol', '2')
1474 any)
1475 (func
1476 ('symbol', '_list')
1477 ('string', '0\x001')
1478 any)
1479 any)
1480 define)
1481 * set:
1482 <filteredset
1483 <spanset- 0:2>,
1484 <not
1485 <baseset [0, 1]>>>
1486 2
1487
1439 'present()' should do nothing other than suppressing an error:
1488 'present()' should do nothing other than suppressing an error:
1440
1489
1441 $ try --optimize '2:0 & present(0 + 1 + 2)'
1490 $ try --optimize '2:0 & present(0 + 1 + 2)'
@@ -1662,9 +1711,10 b' ordering defined by it.'
1662 <spanset- 0:2>>
1711 <spanset- 0:2>>
1663 1
1712 1
1664
1713
1665 'A & B' can be rewritten as 'B & A' by weight, but the ordering rule should
1714 'A & B' can be rewritten as 'B & A' by weight, but that's fine as long as
1666 be determined before the optimization (i.e. 'B' should take the ordering of
1715 the ordering rule is determined before the rewrite; in this example,
1667 'A'):
1716 'B' follows the order of the initial set, which is the same order as 'A'
1717 since 'A' also follows the order:
1668
1718
1669 $ try --optimize 'contains("glob:*") & (2 + 0 + 1)'
1719 $ try --optimize 'contains("glob:*") & (2 + 0 + 1)'
1670 (and
1720 (and
@@ -1690,12 +1740,14 b' ordering defined by it.'
1690 define)
1740 define)
1691 * set:
1741 * set:
1692 <filteredset
1742 <filteredset
1693 <baseset [2, 0, 1]>,
1743 <baseset+ [0, 1, 2]>,
1694 <contains 'glob:*'>>
1744 <contains 'glob:*'>>
1695 2
1696 0
1745 0
1697 1
1746 1
1698 BROKEN: should be '0 1 2'
1747 2
1748
1749 and in this example, 'A & B' is rewritten as 'B & A', but 'A' overrides
1750 the order appropriately:
1699
1751
1700 $ try --optimize 'reverse(contains("glob:*")) & (0 + 2 + 1)'
1752 $ try --optimize 'reverse(contains("glob:*")) & (0 + 2 + 1)'
1701 (and
1753 (and
@@ -1726,12 +1778,11 b' ordering defined by it.'
1726 define)
1778 define)
1727 * set:
1779 * set:
1728 <filteredset
1780 <filteredset
1729 <baseset [1, 2, 0]>,
1781 <baseset- [0, 1, 2]>,
1730 <contains 'glob:*'>>
1782 <contains 'glob:*'>>
1783 2
1731 1
1784 1
1732 2
1733 0
1785 0
1734 BROKEN: should be '2 1 0'
1735
1786
1736 test sort revset
1787 test sort revset
1737 --------------------------------------------
1788 --------------------------------------------
General Comments 0
You need to be logged in to leave comments. Login now