comparison mercurial/revset.py @ 12401:4cdaf1adafc8

backout most of 4f8067c94729
author Matt Mackall <mpm@selenic.com>
date Fri, 24 Sep 2010 12:46:54 -0500
parents 4f8067c94729
children 78a97859b90d
comparison
equal deleted inserted replaced
12400:40852b4b910c 12401:4cdaf1adafc8
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)