From patchwork Wed Feb 19 20:40:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: revset: changed mfunc and getset to work with old style revset methods From: Lucas Moscovicz X-Patchwork-Id: 3700 Message-Id: To: mercurial-devel@selenic.com Date: Wed, 19 Feb 2014 12:40:46 -0800 # HG changeset patch # User Lucas Moscovicz # 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):