Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 12387:4f8067c94729
cleanup: use x in (a, b) instead of x == a or x == b
author | Brodie Rao <brodie@bitheap.org> |
---|---|
date | Thu, 23 Sep 2010 00:02:31 -0500 |
parents | b913232d13c1 |
children | 4cdaf1adafc8 |
comparison
equal
deleted
inserted
replaced
12386:8eedf53547b8 | 12387:4f8067c94729 |
---|---|
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] == 'string' or x[0] == 'symbol'): | 90 if x and x[0] in ('string', '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 == 'and' or op == 'dagrange': | 540 elif op in ('and', '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) |