Show More
@@ -44,6 +44,7 b' getinteger = revsetlang.getinteger' | |||
|
44 | 44 | getboolean = revsetlang.getboolean |
|
45 | 45 | getlist = revsetlang.getlist |
|
46 | 46 | getrange = revsetlang.getrange |
|
47 | getintrange = revsetlang.getintrange | |
|
47 | 48 | getargs = revsetlang.getargs |
|
48 | 49 | getargsdict = revsetlang.getargsdict |
|
49 | 50 | |
@@ -1067,11 +1068,11 b' def followlines(repo, subset, x):' | |||
|
1067 | 1068 | # i18n: "followlines" is a keyword |
|
1068 | 1069 | msg = _("followlines expects exactly one file") |
|
1069 | 1070 | fname = scmutil.parsefollowlinespattern(repo, rev, pat, msg) |
|
1070 | # i18n: "followlines" is a keyword | |
|
1071 | lr = getrange(args['lines'][0], _("followlines expects a line range")) | |
|
1072 | fromline, toline = [getinteger(a, _("line range bounds must be integers")) | |
|
1073 |
|
|
|
1074 | fromline, toline = util.processlinerange(fromline, toline) | |
|
1071 | fromline, toline = util.processlinerange( | |
|
1072 | *getintrange(args['lines'][0], | |
|
1073 | # i18n: "followlines" is a keyword | |
|
1074 | _("followlines expects a line range"), | |
|
1075 | _("line range bounds must be integers"))) | |
|
1075 | 1076 | |
|
1076 | 1077 | fctx = repo[rev].filectx(fname) |
|
1077 | 1078 | descend = False |
@@ -240,6 +240,15 b' def getrange(x, err):' | |||
|
240 | 240 | return None, None |
|
241 | 241 | raise error.ParseError(err) |
|
242 | 242 | |
|
243 | def getintrange(x, err1, err2, deffirst=_notset, deflast=_notset): | |
|
244 | """Get [first, last] integer range (both inclusive) from a parsed tree | |
|
245 | ||
|
246 | If any of the sides omitted, and if no default provided, ParseError will | |
|
247 | be raised. | |
|
248 | """ | |
|
249 | a, b = getrange(x, err1) | |
|
250 | return getinteger(a, err2, deffirst), getinteger(b, err2, deflast) | |
|
251 | ||
|
243 | 252 | def getargs(x, min, max, err): |
|
244 | 253 | l = getlist(x) |
|
245 | 254 | if len(l) < min or (max >= 0 and len(l) > max): |
General Comments 0
You need to be logged in to leave comments.
Login now