##// END OF EJS Templates
revset: filter first/last members by __and__ operation...
Yuya Nishihara -
r32799:3e6f9bff default
parent child Browse files
Show More
@@ -1179,10 +1179,9 b' def limit(repo, subset, x):'
1179 y = next(it, None)
1179 y = next(it, None)
1180 if y is None:
1180 if y is None:
1181 break
1181 break
1182 elif y in subset:
1182 result.append(y)
1183 result.append(y)
1183 ls = baseset(result, datarepr=('<limit n=%d, offset=%d, %r>', lim, ofs, os))
1184 return baseset(result, datarepr=('<limit n=%d, offset=%d, %r, %r>',
1184 return ls & subset
1185 lim, ofs, subset, os))
1186
1185
1187 @predicate('last(set, [n])', safe=True)
1186 @predicate('last(set, [n])', safe=True)
1188 def last(repo, subset, x):
1187 def last(repo, subset, x):
@@ -1204,10 +1203,10 b' def last(repo, subset, x):'
1204 y = next(it, None)
1203 y = next(it, None)
1205 if y is None:
1204 if y is None:
1206 break
1205 break
1207 elif y in subset:
1206 result.append(y)
1208 result.append(y)
1207 ls = baseset(result, datarepr=('<last n=%d, %r>', lim, os))
1209 return baseset(result[::-1], datarepr=('<last n=%d, %r, %r>',
1208 ls.reverse()
1210 lim, subset, os))
1209 return ls & subset
1211
1210
1212 @predicate('max(set)', safe=True)
1211 @predicate('max(set)', safe=True)
1213 def maxrev(repo, subset, x):
1212 def maxrev(repo, subset, x):
@@ -1016,6 +1016,50 b' Test first (=limit) and last'
1016 8
1016 8
1017 9
1017 9
1018
1018
1019 Test order of first/last revisions
1020
1021 $ hg debugrevspec -s 'first(4:0, 3) & 3:'
1022 * set:
1023 <filteredset
1024 <baseset
1025 <limit n=3, offset=0,
1026 <spanset- 0:4>>>,
1027 <spanset+ 3:9>>
1028 4
1029 3
1030
1031 $ hg debugrevspec -s '3: & first(4:0, 3)'
1032 * set:
1033 <filteredset
1034 <baseset
1035 <limit n=3, offset=0,
1036 <spanset- 0:4>>>,
1037 <spanset+ 3:9>>
1038 4
1039 3
1040 BROKEN: should be '3 4'
1041
1042 $ hg debugrevspec -s 'last(4:0, 3) & :1'
1043 * set:
1044 <filteredset
1045 <baseset
1046 <last n=3,
1047 <spanset+ 0:4>>>,
1048 <spanset+ 0:1>>
1049 1
1050 0
1051
1052 $ hg debugrevspec -s ':1 & last(4:0, 3)'
1053 * set:
1054 <filteredset
1055 <baseset
1056 <last n=3,
1057 <spanset+ 0:4>>>,
1058 <spanset+ 0:1>>
1059 1
1060 0
1061 BROKEN: should be '0 1'
1062
1019 Test matching
1063 Test matching
1020
1064
1021 $ log 'matching(6)'
1065 $ log 'matching(6)'
@@ -1230,10 +1274,10 b' Test null revision'
1230 $ log 'reverse(null:)' | tail -2
1274 $ log 'reverse(null:)' | tail -2
1231 0
1275 0
1232 -1
1276 -1
1277 $ log 'first(null:)'
1278 -1
1279 $ log 'min(null:)'
1233 BROKEN: should be '-1'
1280 BROKEN: should be '-1'
1234 $ log 'first(null:)'
1235 BROKEN: should be '-1'
1236 $ log 'min(null:)'
1237 $ log 'tip:null and all()' | tail -2
1281 $ log 'tip:null and all()' | tail -2
1238 1
1282 1
1239 0
1283 0
@@ -1295,9 +1339,9 b' For tests consistency'
1295 9
1339 9
1296 $ log '(all() + wdir()) & max(. + wdir())'
1340 $ log '(all() + wdir()) & max(. + wdir())'
1297 2147483647
1341 2147483647
1298 $ log '(all() + wdir()) & first(wdir() + .)'
1342 $ log 'first(wdir() + .)'
1299 2147483647
1343 2147483647
1300 $ log '(all() + wdir()) & last(. + wdir())'
1344 $ log 'last(. + wdir())'
1301 2147483647
1345 2147483647
1302
1346
1303 Test working-directory integer revision and node id
1347 Test working-directory integer revision and node id
@@ -1907,10 +1951,11 b' ordering defined by it.'
1907 follow)
1951 follow)
1908 define)
1952 define)
1909 * set:
1953 * set:
1910 <baseset
1954 <filteredset
1911 <limit n=1, offset=0,
1955 <baseset
1912 <spanset- 0:2>,
1956 <limit n=1, offset=0,
1913 <baseset [1, 0, 2]>>>
1957 <baseset [1, 0, 2]>>>,
1958 <spanset- 0:2>>
1914 1
1959 1
1915
1960
1916 $ try --optimize '2:0 & not last(0 + 2 + 1)'
1961 $ try --optimize '2:0 & not last(0 + 2 + 1)'
@@ -1946,7 +1991,6 b' ordering defined by it.'
1946 <not
1991 <not
1947 <baseset
1992 <baseset
1948 <last n=1,
1993 <last n=1,
1949 <fullreposet+ 0:9>,
1950 <baseset [1, 2, 0]>>>>>
1994 <baseset [1, 2, 0]>>>>>
1951 2
1995 2
1952 0
1996 0
@@ -3573,7 +3617,6 b' issue2549 - correct optimizations'
3573 <filteredset
3617 <filteredset
3574 <baseset
3618 <baseset
3575 <limit n=2, offset=0,
3619 <limit n=2, offset=0,
3576 <fullreposet+ 0:9>,
3577 <baseset [1, 2, 3]>>>,
3620 <baseset [1, 2, 3]>>>,
3578 <not
3621 <not
3579 <baseset [2]>>>
3622 <baseset [2]>>>
@@ -3630,7 +3673,6 b' issue2549 - correct optimizations'
3630 <filteredset
3673 <filteredset
3631 <baseset
3674 <baseset
3632 <last n=1,
3675 <last n=1,
3633 <fullreposet+ 0:9>,
3634 <baseset [2, 1]>>>,
3676 <baseset [2, 1]>>>,
3635 <not
3677 <not
3636 <baseset [2]>>>
3678 <baseset [2]>>>
General Comments 0
You need to be logged in to leave comments. Login now