Show More
@@ -884,11 +884,11 b' def filelog(repo, subset, x):' | |||||
884 |
|
884 | |||
885 | return subset & s |
|
885 | return subset & s | |
886 |
|
886 | |||
887 | @predicate('first(set, [n])', safe=True) |
|
887 | @predicate('first(set, [n])', safe=True, takeorder=True) | |
888 | def first(repo, subset, x): |
|
888 | def first(repo, subset, x, order): | |
889 | """An alias for limit(). |
|
889 | """An alias for limit(). | |
890 | """ |
|
890 | """ | |
891 | return limit(repo, subset, x) |
|
891 | return limit(repo, subset, x, order) | |
892 |
|
892 | |||
893 | def _follow(repo, subset, x, name, followfirst=False): |
|
893 | def _follow(repo, subset, x, name, followfirst=False): | |
894 | l = getargs(x, 0, 2, _("%s takes no arguments or a pattern " |
|
894 | l = getargs(x, 0, 2, _("%s takes no arguments or a pattern " | |
@@ -1152,8 +1152,8 b' def keyword(repo, subset, x):' | |||||
1152 |
|
1152 | |||
1153 | return subset.filter(matches, condrepr=('<keyword %r>', kw)) |
|
1153 | return subset.filter(matches, condrepr=('<keyword %r>', kw)) | |
1154 |
|
1154 | |||
1155 | @predicate('limit(set[, n[, offset]])', safe=True) |
|
1155 | @predicate('limit(set[, n[, offset]])', safe=True, takeorder=True) | |
1156 | def limit(repo, subset, x): |
|
1156 | def limit(repo, subset, x, order): | |
1157 | """First n members of set, defaulting to 1, starting from offset. |
|
1157 | """First n members of set, defaulting to 1, starting from offset. | |
1158 | """ |
|
1158 | """ | |
1159 | args = getargsdict(x, 'limit', 'set n offset') |
|
1159 | args = getargsdict(x, 'limit', 'set n offset') | |
@@ -1181,10 +1181,12 b' def limit(repo, subset, x):' | |||||
1181 | break |
|
1181 | break | |
1182 | result.append(y) |
|
1182 | result.append(y) | |
1183 | ls = baseset(result, datarepr=('<limit n=%d, offset=%d, %r>', lim, ofs, os)) |
|
1183 | ls = baseset(result, datarepr=('<limit n=%d, offset=%d, %r>', lim, ofs, os)) | |
|
1184 | if order == followorder and lim > 1: | |||
|
1185 | return subset & ls | |||
1184 | return ls & subset |
|
1186 | return ls & subset | |
1185 |
|
1187 | |||
1186 | @predicate('last(set, [n])', safe=True) |
|
1188 | @predicate('last(set, [n])', safe=True, takeorder=True) | |
1187 | def last(repo, subset, x): |
|
1189 | def last(repo, subset, x, order): | |
1188 | """Last n members of set, defaulting to 1. |
|
1190 | """Last n members of set, defaulting to 1. | |
1189 | """ |
|
1191 | """ | |
1190 | # i18n: "last" is a keyword |
|
1192 | # i18n: "last" is a keyword | |
@@ -1205,6 +1207,8 b' def last(repo, subset, x):' | |||||
1205 | break |
|
1207 | break | |
1206 | result.append(y) |
|
1208 | result.append(y) | |
1207 | ls = baseset(result, datarepr=('<last n=%d, %r>', lim, os)) |
|
1209 | ls = baseset(result, datarepr=('<last n=%d, %r>', lim, os)) | |
|
1210 | if order == followorder and lim > 1: | |||
|
1211 | return subset & ls | |||
1208 | ls.reverse() |
|
1212 | ls.reverse() | |
1209 | return ls & subset |
|
1213 | return ls & subset | |
1210 |
|
1214 |
@@ -1031,13 +1031,12 b' Test order of first/last revisions' | |||||
1031 | $ hg debugrevspec -s '3: & first(4:0, 3)' |
|
1031 | $ hg debugrevspec -s '3: & first(4:0, 3)' | |
1032 | * set: |
|
1032 | * set: | |
1033 | <filteredset |
|
1033 | <filteredset | |
|
1034 | <spanset+ 3:9>, | |||
1034 | <baseset |
|
1035 | <baseset | |
1035 | <limit n=3, offset=0, |
|
1036 | <limit n=3, offset=0, | |
1036 |
<spanset- 0:4>>> |
|
1037 | <spanset- 0:4>>>> | |
1037 | <spanset+ 3:9>> |
|
1038 | 3 | |
1038 | 4 |
|
1039 | 4 | |
1039 | 3 |
|
|||
1040 | BROKEN: should be '3 4' |
|
|||
1041 |
|
1040 | |||
1042 | $ hg debugrevspec -s 'last(4:0, 3) & :1' |
|
1041 | $ hg debugrevspec -s 'last(4:0, 3) & :1' | |
1043 | * set: |
|
1042 | * set: | |
@@ -1052,13 +1051,12 b" BROKEN: should be '3 4'" | |||||
1052 | $ hg debugrevspec -s ':1 & last(4:0, 3)' |
|
1051 | $ hg debugrevspec -s ':1 & last(4:0, 3)' | |
1053 | * set: |
|
1052 | * set: | |
1054 | <filteredset |
|
1053 | <filteredset | |
|
1054 | <spanset+ 0:1>, | |||
1055 | <baseset |
|
1055 | <baseset | |
1056 | <last n=3, |
|
1056 | <last n=3, | |
1057 |
<spanset+ 0:4>>> |
|
1057 | <spanset+ 0:4>>>> | |
1058 | <spanset+ 0:1>> |
|
1058 | 0 | |
1059 | 1 |
|
1059 | 1 | |
1060 | 0 |
|
|||
1061 | BROKEN: should be '0 1' |
|
|||
1062 |
|
1060 | |||
1063 | Test matching |
|
1061 | Test matching | |
1064 |
|
1062 |
General Comments 0
You need to be logged in to leave comments.
Login now