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

login
register
mail settings
Submitter Pulkit Goyal
Date May 19, 2017, 3:07 p.m.
Message ID <e2a67243cdbcfef442f5.1495206473@workspace>
Download mbox | patch
Permalink /patch/20718/
State Accepted
Headers show

Comments

Pulkit Goyal - May 19, 2017, 3:07 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@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

Patch

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]