Show More
@@ -436,6 +436,9 b' def dagrange(repo, subset, x, y):' | |||||
436 | def andset(repo, subset, x, y): |
|
436 | def andset(repo, subset, x, y): | |
437 | return getset(repo, getset(repo, subset, x), y) |
|
437 | return getset(repo, getset(repo, subset, x), y) | |
438 |
|
438 | |||
|
439 | def differenceset(repo, subset, x, y): | |||
|
440 | return getset(repo, subset, x) - getset(repo, subset, y) | |||
|
441 | ||||
439 | def orset(repo, subset, *xs): |
|
442 | def orset(repo, subset, *xs): | |
440 | assert xs |
|
443 | assert xs | |
441 | if len(xs) == 1: |
|
444 | if len(xs) == 1: | |
@@ -2147,6 +2150,7 b' methods = {' | |||||
2147 | "and": andset, |
|
2150 | "and": andset, | |
2148 | "or": orset, |
|
2151 | "or": orset, | |
2149 | "not": notset, |
|
2152 | "not": notset, | |
|
2153 | "difference": differenceset, | |||
2150 | "list": listset, |
|
2154 | "list": listset, | |
2151 | "keyvalue": keyvaluepair, |
|
2155 | "keyvalue": keyvaluepair, | |
2152 | "func": func, |
|
2156 | "func": func, | |
@@ -2207,6 +2211,9 b' def optimize(x, small):' | |||||
2207 | if isonly(tb, ta): |
|
2211 | if isonly(tb, ta): | |
2208 | return w, ('func', ('symbol', 'only'), ('list', tb[2], ta[1][2])) |
|
2212 | return w, ('func', ('symbol', 'only'), ('list', tb[2], ta[1][2])) | |
2209 |
|
2213 | |||
|
2214 | if tb is not None and tb[0] == 'not': | |||
|
2215 | return wa, ('difference', ta, tb[1]) | |||
|
2216 | ||||
2210 | if wa > wb: |
|
2217 | if wa > wb: | |
2211 | return w, (op, tb, ta) |
|
2218 | return w, (op, tb, ta) | |
2212 | return w, (op, ta, tb) |
|
2219 | return w, (op, ta, tb) |
@@ -693,12 +693,11 b" Test opreand of '%' is optimized recursi" | |||||
693 | * optimized: |
|
693 | * optimized: | |
694 | (func |
|
694 | (func | |
695 | ('symbol', 'only') |
|
695 | ('symbol', 'only') | |
696 | (and |
|
696 | (difference | |
697 | (range |
|
697 | (range | |
698 | ('symbol', '8') |
|
698 | ('symbol', '8') | |
699 | ('symbol', '9')) |
|
699 | ('symbol', '9')) | |
700 | (not |
|
700 | ('symbol', '8'))) | |
701 | ('symbol', '8')))) |
|
|||
702 | * set: |
|
701 | * set: | |
703 | <baseset+ [8, 9]> |
|
702 | <baseset+ [8, 9]> | |
704 | 8 |
|
703 | 8 |
General Comments 0
You need to be logged in to leave comments.
Login now