Submitter | Pulkit Goyal |
---|---|
Date | May 22, 2017, 8:52 p.m. |
Message ID | <9e27cccadbf4b13a7f7a.1495486340@workspace> |
Download | mbox | patch |
Permalink | /patch/20851/ |
State | Accepted |
Headers | show |
Comments
On Tue, 23 May 2017 02:22:20 +0530, Pulkit Goyal wrote: > # 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 This doesn't look correct and would be platform dependent. Maybe we'll need a workaround to yield wdirrev if start=wdirrev and stop=wdirrev?
Patch
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):