##// END OF EJS Templates
revset: unnest isonly() closure from optimize()...
Yuya Nishihara -
r29116:0c9b05da default
parent child Browse files
Show More
@@ -2072,6 +2072,16 b' methods = {'
2072 2072 "parentpost": p1,
2073 2073 }
2074 2074
2075 def _isonly(revs, bases):
2076 return (
2077 revs is not None
2078 and revs[0] == 'func'
2079 and getstring(revs[1], _('not a symbol')) == 'ancestors'
2080 and bases is not None
2081 and bases[0] == 'not'
2082 and bases[1][0] == 'func'
2083 and getstring(bases[1][1], _('not a symbol')) == 'ancestors')
2084
2075 2085 def optimize(x, small):
2076 2086 if x is None:
2077 2087 return 0, x
@@ -2106,22 +2116,12 b' def optimize(x, small):'
2106 2116 elif op == 'and':
2107 2117 wa, ta = optimize(x[1], True)
2108 2118 wb, tb = optimize(x[2], True)
2119 w = min(wa, wb)
2109 2120
2110 2121 # (::x and not ::y)/(not ::y and ::x) have a fast path
2111 def isonly(revs, bases):
2112 return (
2113 revs is not None
2114 and revs[0] == 'func'
2115 and getstring(revs[1], _('not a symbol')) == 'ancestors'
2116 and bases is not None
2117 and bases[0] == 'not'
2118 and bases[1][0] == 'func'
2119 and getstring(bases[1][1], _('not a symbol')) == 'ancestors')
2120
2121 w = min(wa, wb)
2122 if isonly(ta, tb):
2122 if _isonly(ta, tb):
2123 2123 return w, ('func', ('symbol', 'only'), ('list', ta[2], tb[1][2]))
2124 if isonly(tb, ta):
2124 if _isonly(tb, ta):
2125 2125 return w, ('func', ('symbol', 'only'), ('list', tb[2], ta[1][2]))
2126 2126
2127 2127 if tb is not None and tb[0] == 'not':
General Comments 0
You need to be logged in to leave comments. Login now