##// END OF EJS Templates
revset: reject negative number to select first/last n members...
Yuya Nishihara -
r32798:b36ec65e default
parent child Browse files
Show More
@@ -1162,6 +1162,8 b' def limit(repo, subset, x):'
1162 raise error.ParseError(_("limit requires one to three arguments"))
1162 raise error.ParseError(_("limit requires one to three arguments"))
1163 # i18n: "limit" is a keyword
1163 # i18n: "limit" is a keyword
1164 lim = getinteger(args.get('n'), _("limit expects a number"), default=1)
1164 lim = getinteger(args.get('n'), _("limit expects a number"), default=1)
1165 if lim < 0:
1166 raise error.ParseError(_("negative number to select"))
1165 # i18n: "limit" is a keyword
1167 # i18n: "limit" is a keyword
1166 ofs = getinteger(args.get('offset'), _("limit expects a number"), default=0)
1168 ofs = getinteger(args.get('offset'), _("limit expects a number"), default=0)
1167 if ofs < 0:
1169 if ofs < 0:
@@ -1192,6 +1194,8 b' def last(repo, subset, x):'
1192 if len(l) == 2:
1194 if len(l) == 2:
1193 # i18n: "last" is a keyword
1195 # i18n: "last" is a keyword
1194 lim = getinteger(l[1], _("last expects a number"))
1196 lim = getinteger(l[1], _("last expects a number"))
1197 if lim < 0:
1198 raise error.ParseError(_("negative number to select"))
1195 os = getset(repo, fullreposet(repo), l[0])
1199 os = getset(repo, fullreposet(repo), l[0])
1196 os.reverse()
1200 os.reverse()
1197 result = []
1201 result = []
@@ -1001,7 +1001,14 b' Test first (=limit) and last'
1001 $ log 'limit(all(), 1, -1)'
1001 $ log 'limit(all(), 1, -1)'
1002 hg: parse error: negative offset
1002 hg: parse error: negative offset
1003 [255]
1003 [255]
1004
1004 $ log 'limit(all(), -1)'
1005 hg: parse error: negative number to select
1006 [255]
1007 $ log 'limit(all(), 0)'
1008
1009 $ log 'last(all(), -1)'
1010 hg: parse error: negative number to select
1011 [255]
1005 $ log 'last(all(), 0)'
1012 $ log 'last(all(), 0)'
1006 $ log 'last(all(), 1)'
1013 $ log 'last(all(), 1)'
1007 9
1014 9
General Comments 0
You need to be logged in to leave comments. Login now