[PATCH 2 of 3] revlog: raise WdirRevNotSupportedError when wdirrev is passed

Pulkit Goyal 7895pulkit at gmail.com
Fri May 19 11:07:53 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 e2a67243cdbcfef442f53ac8a566c91b9e34a93d
# Parent  10bab5388a7f11060a76c10d28d60578b428fdb0
revlog: raise WdirRevNotSupportedError when wdirrev is passed

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 (
@@ -475,7 +476,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.WdirRevNotSupportedError()
+            raise
 
     def node(self, rev):
         return self.index[rev][7]


More information about the Mercurial-devel mailing list