From patchwork Sat Feb 27 14:38:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [6,of,7] revset: add inspection data to limit() and last() functions From: Yuya Nishihara X-Patchwork-Id: 13435 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Sat, 27 Feb 2016 23:38:20 +0900 # HG changeset patch # User Yuya Nishihara # Date 1455626631 -32400 # Tue Feb 16 21:43:51 2016 +0900 # Node ID ca5471aaa2a27b79e8a99406a66d661612505bc4 # Parent 4ee1fb5324e180c94b3ff704f1ba078edb98563c revset: add inspection data to limit() and last() functions We are likely to be interested in how these functions calculate a result set. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -1317,7 +1317,8 @@ def limit(repo, subset, x): break elif y in subset: result.append(y) - return baseset(result) + return baseset(result, datarepr=('', + lim, ofs, subset, os)) @predicate('last(set, [n])', safe=True) def last(repo, subset, x): @@ -1343,7 +1344,7 @@ def last(repo, subset, x): break elif y in subset: result.append(y) - return baseset(result) + return baseset(result, datarepr=('', lim, subset, os)) @predicate('max(set)', safe=True) def maxrev(repo, subset, x): diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -1984,11 +1984,48 @@ issue4553: check that revset aliases ove issue2549 - correct optimizations - \$ log 'limit(1 or 2 or 3, 2) and not 2' + \$ try 'limit(1 or 2 or 3, 2) and not 2' + (and + (func + ('symbol', 'limit') + (list + (or + ('symbol', '1') + ('symbol', '2') + ('symbol', '3')) + ('symbol', '2'))) + (not + ('symbol', '2'))) + * set: + , + >>, + >> 1 \$ log 'max(1 or 2) and not 2' \$ log 'min(1 or 2) and not 1' - \$ log 'last(1 or 2, 1) and not 2' + \$ try 'last(1 or 2, 1) and not 2' + (and + (func + ('symbol', 'last') + (list + (or + ('symbol', '1') + ('symbol', '2')) + ('symbol', '1'))) + (not + ('symbol', '2'))) + * set: + , + >>, + >> issue4289 - ordering of built-ins \$ hg log -M -q -r 3:2