revlog: raise WdirUnsupported when wdirrev is passed
revlog.parentrevs() is called while evaluating ^ operator in revsets. When wdir
is passed, it raises IndexError. This patch raises WdirUnsupported if wdir is
passed in the function. The error will be caugth in future patches.
--- a/mercurial/revlog.py Fri May 19 19:10:37 2017 +0530
+++ b/mercurial/revlog.py Fri May 19 19:12:06 2017 +0530
@@ -26,6 +26,7 @@
hex,
nullid,
nullrev,
+ wdirrev,
)
from .i18n import _
from . import (
@@ -481,7 +482,12 @@
return self.index[rev][4]
def parentrevs(self, rev):
- return self.index[rev][5:7]
+ try:
+ return self.index[rev][5:7]
+ except IndexError:
+ if rev == wdirrev:
+ raise error.WdirUnsupported
+ raise
def node(self, rev):
return self.index[rev][7]