mercurial/revset.py
changeset 28217 d2ac8b57a75d
parent 28139 5476a7a039c0
child 28271 5c454ab69558
--- a/mercurial/revset.py	Tue Feb 23 21:38:36 2016 +0000
+++ b/mercurial/revset.py	Wed Feb 24 10:41:15 2016 -0800
@@ -436,6 +436,9 @@
 def andset(repo, subset, x, y):
     return getset(repo, getset(repo, subset, x), y)
 
+def differenceset(repo, subset, x, y):
+    return getset(repo, subset, x) - getset(repo, subset, y)
+
 def orset(repo, subset, *xs):
     assert xs
     if len(xs) == 1:
@@ -2147,6 +2150,7 @@
     "and": andset,
     "or": orset,
     "not": notset,
+    "difference": differenceset,
     "list": listset,
     "keyvalue": keyvaluepair,
     "func": func,
@@ -2207,6 +2211,9 @@
         if isonly(tb, ta):
             return w, ('func', ('symbol', 'only'), ('list', tb[2], ta[1][2]))
 
+        if tb is not None and tb[0] == 'not':
+            return wa, ('difference', ta, tb[1])
+
         if wa > wb:
             return w, (op, tb, ta)
         return w, (op, ta, tb)