[PATCH 2 of 3 V2] revlog: raise WdirUnsupported when wdirrev is passed
Pulkit Goyal
7895pulkit at gmail.com
Sun May 21 12:18:44 EDT 2017
# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1495201326 -19800
# Fri May 19 19:12:06 2017 +0530
# Node ID 497d73787ea6e0b0ec8aa2262812c82086dc8e8b
# Parent 2adbd2d46cd7588d75201108f6e02b92d1480022
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.
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -26,6 +26,7 @@
hex,
nullid,
nullrev,
+ wdirrev,
)
from .i18n import _
from . import (
@@ -477,7 +478,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("wdir() is not supported")
+ raise
def node(self, rev):
return self.index[rev][7]
More information about the Mercurial-devel
mailing list