From patchwork Mon May 22 20:52:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [10, of, 10] revlog: raise error.WdirUnsupported from revlog.revs() if wdirrev is passed From: Pulkit Goyal <7895pulkit@gmail.com> X-Patchwork-Id: 20851 Message-Id: <9e27cccadbf4b13a7f7a.1495486340@workspace> To: mercurial-devel@mercurial-scm.org Date: Tue, 23 May 2017 02:22:20 +0530 # HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1495483959 -19800 # Tue May 23 01:42:39 2017 +0530 # Node ID 9e27cccadbf4b13a7f7a4e83a19f854b1e4350e2 # Parent db4b48c60495338c7c2ce659c73b0ecb9ae84c7b revlog: raise error.WdirUnsupported from revlog.revs() if wdirrev is passed revlog.revs() is called while evaluating predicates such as descendants() and only(). So if wdir() is passed in those predicates, it blows up with OverflowError. Lets raise WdirUnsupported instead so that the exception can be helpful and catched and fix from the functions calling it. I am not sure if anyone will ever pass wdir() to descendants() but it can be passed to only(). diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -383,7 +383,12 @@ stop += step else: stop = len(self) - return xrange(start, stop, step) + try: + return xrange(start, stop, step) + except OverflowError: + if start == wdirrev: + raise error.WdirUnsupported + raise @util.propertycache def nodemap(self):