[PATCH] revset: changed mfunc and getset to work with old style revset methods

Lucas Moscovicz lmoscovicz at fb.com
Wed Feb 19 14:40:46 CST 2014


# HG changeset patch
# User Lucas Moscovicz <lmoscovicz at fb.com>
# Date 1392767686 28800
#      Tue Feb 18 15:54:46 2014 -0800
# Node ID c95fce949172ed8daababc858b1980046fb581da
# Parent  c29948fed40a2d9755ecaa01ec05bfa542f65670
revset: changed mfunc and getset to work with old style revset methods

Now extensions shouldn't break when adding new revsets.

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -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()
@@ -1919,7 +1922,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):


More information about the Mercurial-devel mailing list