Show More
@@ -191,6 +191,11 b' def rangeset(repo, subset, x, y):' | |||||
191 | s = set(subset) |
|
191 | s = set(subset) | |
192 | return [x for x in r if x in s] |
|
192 | return [x for x in r if x in s] | |
193 |
|
193 | |||
|
194 | def dagrange(repo, subset, x, y): | |||
|
195 | return andset(repo, subset, | |||
|
196 | ('func', ('symbol', 'descendants'), x), | |||
|
197 | ('func', ('symbol', 'ancestors'), y)) | |||
|
198 | ||||
194 | def andset(repo, subset, x, y): |
|
199 | def andset(repo, subset, x, y): | |
195 | return getset(repo, getset(repo, subset, x), y) |
|
200 | return getset(repo, getset(repo, subset, x), y) | |
196 |
|
201 | |||
@@ -1309,6 +1314,7 b' symbols = {' | |||||
1309 |
|
1314 | |||
1310 | methods = { |
|
1315 | methods = { | |
1311 | "range": rangeset, |
|
1316 | "range": rangeset, | |
|
1317 | "dagrange": dagrange, | |||
1312 | "string": stringset, |
|
1318 | "string": stringset, | |
1313 | "symbol": symbolset, |
|
1319 | "symbol": symbolset, | |
1314 | "and": andset, |
|
1320 | "and": andset, | |
@@ -1332,9 +1338,6 b' def optimize(x, small):' | |||||
1332 | op = x[0] |
|
1338 | op = x[0] | |
1333 | if op == 'minus': |
|
1339 | if op == 'minus': | |
1334 | return optimize(('and', x[1], ('not', x[2])), small) |
|
1340 | return optimize(('and', x[1], ('not', x[2])), small) | |
1335 | elif op == 'dagrange': |
|
|||
1336 | return optimize(('and', ('func', ('symbol', 'descendants'), x[1]), |
|
|||
1337 | ('func', ('symbol', 'ancestors'), x[2])), small) |
|
|||
1338 | elif op == 'dagrangepre': |
|
1341 | elif op == 'dagrangepre': | |
1339 | return optimize(('func', ('symbol', 'ancestors'), x[1]), small) |
|
1342 | return optimize(('func', ('symbol', 'ancestors'), x[1]), small) | |
1340 | elif op == 'dagrangepost': |
|
1343 | elif op == 'dagrangepost': | |
@@ -1369,7 +1372,7 b' def optimize(x, small):' | |||||
1369 | return o[0], (op, o[1]) |
|
1372 | return o[0], (op, o[1]) | |
1370 | elif op == 'group': |
|
1373 | elif op == 'group': | |
1371 | return optimize(x[1], small) |
|
1374 | return optimize(x[1], small) | |
1372 | elif op in 'range list parent ancestorspec': |
|
1375 | elif op in 'dagrange range list parent ancestorspec': | |
1373 | if op == 'parent': |
|
1376 | if op == 'parent': | |
1374 | # x^:y means (x^) : y, not x ^ (:y) |
|
1377 | # x^:y means (x^) : y, not x ^ (:y) | |
1375 | post = ('parentpost', x[1]) |
|
1378 | post = ('parentpost', x[1]) |
General Comments 0
You need to be logged in to leave comments.
Login now