##// END OF EJS Templates
revset: make negate work for sort specs
Matt Mackall -
r11467:6b836d5c stable
parent child Browse files
Show More
@@ -111,10 +111,6 b' def getset(repo, subset, x):'
111
111
112 # operator methods
112 # operator methods
113
113
114 def negate(repo, subset, x):
115 return getset(repo, subset,
116 ('string', '-' + getstring(x, _("can't negate that"))))
117
118 def stringset(repo, subset, x):
114 def stringset(repo, subset, x):
119 x = repo[x].rev()
115 x = repo[x].rev()
120 if x == -1 and len(subset) == len(repo):
116 if x == -1 and len(subset) == len(repo):
@@ -482,7 +478,6 b' symbols = {'
482 }
478 }
483
479
484 methods = {
480 methods = {
485 "negate": negate,
486 "range": rangeset,
481 "range": rangeset,
487 "string": stringset,
482 "string": stringset,
488 "symbol": symbolset,
483 "symbol": symbolset,
@@ -515,6 +510,9 b' def optimize(x, small):'
515 return optimize(('range', ('string', '0'), x[1]), small)
510 return optimize(('range', ('string', '0'), x[1]), small)
516 elif op == 'rangepost':
511 elif op == 'rangepost':
517 return optimize(('range', x[1], ('string', 'tip')), small)
512 return optimize(('range', x[1], ('string', 'tip')), small)
513 elif op == 'negate':
514 return optimize(('string',
515 '-' + getstring(x[1], _("can't negate that"))), small)
518 elif op in 'string symbol negate':
516 elif op in 'string symbol negate':
519 return smallbonus, x # single revisions are small
517 return smallbonus, x # single revisions are small
520 elif op == 'and' or op == 'dagrange':
518 elif op == 'and' or op == 'dagrange':
@@ -133,3 +133,4 b" log 'not 2 and 0:2'"
133 log '(1 and 2)::'
133 log '(1 and 2)::'
134 log '(1 and 2):'
134 log '(1 and 2):'
135 log '(1 and 2):3'
135 log '(1 and 2):3'
136 log 'sort(head(), -rev)'
@@ -210,3 +210,13 b' 1'
210 % log '(1 and 2)::'
210 % log '(1 and 2)::'
211 % log '(1 and 2):'
211 % log '(1 and 2):'
212 % log '(1 and 2):3'
212 % log '(1 and 2):3'
213 % log 'sort(head(), -rev)'
214 9
215 7
216 6
217 5
218 4
219 3
220 2
221 1
222 0
General Comments 0
You need to be logged in to leave comments. Login now