diff mercurial/revset.py @ 11467:6b836d5c8c9e stable

revset: make negate work for sort specs
author Matt Mackall <mpm@selenic.com>
date Wed, 30 Jun 2010 17:44:36 -0500
parents 88abbb046e66
children ebaf117c2642
line wrap: on
line diff
--- a/mercurial/revset.py	Wed Jun 30 17:34:20 2010 -0500
+++ b/mercurial/revset.py	Wed Jun 30 17:44:36 2010 -0500
@@ -111,10 +111,6 @@
 
 # operator methods
 
-def negate(repo, subset, x):
-    return getset(repo, subset,
-                  ('string', '-' + getstring(x, _("can't negate that"))))
-
 def stringset(repo, subset, x):
     x = repo[x].rev()
     if x == -1 and len(subset) == len(repo):
@@ -482,7 +478,6 @@
 }
 
 methods = {
-    "negate": negate,
     "range": rangeset,
     "string": stringset,
     "symbol": symbolset,
@@ -515,6 +510,9 @@
         return optimize(('range', ('string', '0'), x[1]), small)
     elif op == 'rangepost':
         return optimize(('range', x[1], ('string', 'tip')), small)
+    elif op == 'negate':
+        return optimize(('string',
+                         '-' + getstring(x[1], _("can't negate that"))), small)
     elif op in 'string symbol negate':
         return smallbonus, x # single revisions are small
     elif op == 'and' or op == 'dagrange':