changeset 20527:bde426f18e0a

revset: changed mfunc and getset to work with old style revset methods Now extensions shouldn't break when adding new revsets.
author Lucas Moscovicz <lmoscovicz@fb.com>
date Tue, 18 Feb 2014 15:54:46 -0800
parents 9ad6dae67845
children 1a9ebc83a74c
files mercurial/revset.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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):