revset: changed mfunc and getset to work with old style revset methods
authorLucas Moscovicz <lmoscovicz@fb.com>
Tue, 18 Feb 2014 15:54:46 -0800
changeset 20527 bde426f18e0a
parent 20526 9ad6dae67845
child 20528 1a9ebc83a74c
revset: changed mfunc and getset to work with old style revset methods Now extensions shouldn't break when adding new revsets.
mercurial/revset.py
--- a/mercurial/revset.py	Mon Feb 03 10:15:15 2014 -0800
+++ b/mercurial/revset.py	Tue Feb 18 15:54:46 2014 -0800
@@ -195,7 +195,10 @@
 def getset(repo, subset, x):
     if not x:
         raise error.ParseError(_("missing argument"))
-    return methods[x[0]](repo, subset, *x[1:])
+    s = methods[x[0]](repo, subset, *x[1:])
+    if util.safehasattr(s, 'set'):
+        return s
+    return baseset(s)
 
 def _getrevsource(repo, r):
     extra = repo[r].extra()
@@ -1949,7 +1952,9 @@
         tree = findaliases(ui, tree)
     weight, tree = optimize(tree, True)
     def mfunc(repo, subset):
-        return getset(repo, subset, tree)
+        if util.safehasattr(subset, 'set'):
+            return getset(repo, subset, tree)
+        return getset(repo, baseset(subset), tree)
     return mfunc
 
 def formatspec(expr, *args):