equal
deleted
inserted
replaced
85 yield ('end', None, pos) |
85 yield ('end', None, pos) |
86 |
86 |
87 # helpers |
87 # helpers |
88 |
88 |
89 def getstring(x, err): |
89 def getstring(x, err): |
90 if x and x[0] in ('string', 'symbol'): |
90 if x and (x[0] == 'string' or x[0] == 'symbol'): |
91 return x[1] |
91 return x[1] |
92 raise error.ParseError(err) |
92 raise error.ParseError(err) |
93 |
93 |
94 def getlist(x): |
94 def getlist(x): |
95 if not x: |
95 if not x: |
535 elif op == 'negate': |
535 elif op == 'negate': |
536 return optimize(('string', |
536 return optimize(('string', |
537 '-' + getstring(x[1], _("can't negate that"))), small) |
537 '-' + getstring(x[1], _("can't negate that"))), small) |
538 elif op in 'string symbol negate': |
538 elif op in 'string symbol negate': |
539 return smallbonus, x # single revisions are small |
539 return smallbonus, x # single revisions are small |
540 elif op in ('and', 'dagrange'): |
540 elif op == 'and' or op == 'dagrange': |
541 wa, ta = optimize(x[1], True) |
541 wa, ta = optimize(x[1], True) |
542 wb, tb = optimize(x[2], True) |
542 wb, tb = optimize(x[2], True) |
543 w = min(wa, wb) |
543 w = min(wa, wb) |
544 if wa > wb: |
544 if wa > wb: |
545 return w, (op, tb, ta) |
545 return w, (op, tb, ta) |