changeset 45888:c8860a212770

errors: raise InputError when line range to followlines() is out of bounds Differential Revision: https://phab.mercurial-scm.org/D9333
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 16 Nov 2020 16:25:04 -0800
parents ec73a6a75985
children 1a72e4839795
files mercurial/mdiff.py tests/test-annotate.t
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/mdiff.py	Sat Nov 07 22:31:29 2020 +0100
+++ b/mercurial/mdiff.py	Mon Nov 16 16:25:04 2020 -0800
@@ -199,7 +199,7 @@
         if hunkinrange((b1, (b2 - b1)), rangeb):
             filteredblocks.append(block)
     if lba is None or uba is None or uba < lba:
-        raise error.Abort(_(b'line range exceeds file size'))
+        raise error.InputError(_(b'line range exceeds file size'))
     return filteredblocks, (lba, uba)
 
 
--- a/tests/test-annotate.t	Sat Nov 07 22:31:29 2020 +0100
+++ b/tests/test-annotate.t	Mon Nov 16 16:25:04 2020 -0800
@@ -960,7 +960,7 @@
   [255]
   $ hg log -r 'followlines(baz, 2:40)'
   abort: line range exceeds file size
-  [255]
+  [10]
   $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=[1])'
   hg: parse error at 43: not a prefix: [
   (followlines(baz, 2:4, startrev=20, descend=[1])