[PATCH 2 of 5] revset: always the `min` method of smartset in `min` revset
pierre-yves.david at ens-lyon.org
pierre-yves.david at ens-lyon.org
Fri Mar 21 13:28:05 CDT 2014
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1395425975 25200
# Fri Mar 21 11:19:35 2014 -0700
# Node ID 8ef733ec8279648ae80867ec085bd3bab9898629
# Parent ad232d545933fc511feaeceb85ba43c4cb1d5415
revset: always the `min` method of smartset in `min` revset
This is a bit simpler and make is easier to test that smart set have the proper
method defined.
diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -1085,14 +1085,13 @@ def branchpoint(repo, subset, x):
def minrev(repo, subset, x):
"""``min(set)``
Changeset with lowest revision number in set.
"""
os = getset(repo, spanset(repo), x)
- if os:
- m = os.min()
- if m in subset:
- return baseset([m])
+ m = os.min()
+ if m is not None and m in subset:
+ return baseset([m])
return baseset([])
def _missingancestors(repo, subset, x):
# i18n: "_missingancestors" is a keyword
revs, bases = getargs(x, 2, 2,
diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -353,14 +353,36 @@ ancestor can accept 0 or more arguments
$ log 'matching(6)'
6
$ log 'matching(6:7, "phase parents user date branch summary files description substate")'
6
7
+
+Testing min and max
+
+max: simple
+
$ log 'max(contains(a))'
5
+min: simple
+
$ log 'min(contains(a))'
0
+
+min: simple on unordered set
+
+ $ log 'min((4+0+2+5+7) and contains(a))'
+ 0
+
+min: empty
+
+ $ log 'min(contains(stringthatdoesnotappearanywhere))'
+
+min: empty on unordered set
+
+ $ log 'min((4+0+2+5+7) and contains(stringthatdoesnotappearanywhere))'
+
+
$ log 'merge()'
6
$ log 'branchpoint()'
1
4
More information about the Mercurial-devel
mailing list