diff mercurial/revset.py @ 31667:080734cd2440

revset: factor out linerange processing into a utility function Similar processing will be done in hgweb.webutil in forthcoming changeset.
author Denis Laxalde <denis.laxalde@logilab.fr>
date Fri, 24 Feb 2017 18:39:08 +0100
parents 0e07855e6054
children 35b8bb1ef02b
line wrap: on
line diff
--- a/mercurial/revset.py	Mon Mar 13 10:41:13 2017 +0100
+++ b/mercurial/revset.py	Fri Feb 24 18:39:08 2017 +0100
@@ -945,11 +945,7 @@
     lr = getrange(args['lines'][0], _("followlines expects a line range"))
     fromline, toline = [getinteger(a, _("line range bounds must be integers"))
                         for a in lr]
-    if toline - fromline < 0:
-        raise error.ParseError(_("line range must be positive"))
-    if fromline < 1:
-        raise error.ParseError(_("fromline must be strictly positive"))
-    fromline -= 1
+    fromline, toline = util.processlinerange(fromline, toline)
 
     fctx = repo[rev].filectx(fname)
     revs = (c.rev() for c, _linerange