mercurial/context.py
changeset 37855 fdd8da79eb85
parent 37852 8b86acc7aa64
child 37856 bb8e93b332a7
--- a/mercurial/context.py	Sat Apr 28 23:16:41 2018 -0700
+++ b/mercurial/context.py	Fri Apr 06 12:45:08 2018 -0700
@@ -412,7 +412,14 @@
                 except error.FilteredLookupError:
                     raise
                 except LookupError:
-                    pass
+                    # check if it might have come from damaged dirstate
+                    #
+                    # XXX we could avoid the unfiltered if we had a recognizable
+                    # exception for filtered changeset access
+                    if (repo.local()
+                        and changeid in repo.unfiltered().dirstate.parents()):
+                        msg = _("working directory has unknown parent '%s'!")
+                        raise error.Abort(msg % short(changeid))
 
             if len(changeid) == 40:
                 try:
@@ -425,14 +432,6 @@
                     pass
 
             # lookup failed
-            # check if it might have come from damaged dirstate
-            #
-            # XXX we could avoid the unfiltered if we had a recognizable
-            # exception for filtered changeset access
-            if (repo.local()
-                and changeid in repo.unfiltered().dirstate.parents()):
-                msg = _("working directory has unknown parent '%s'!")
-                raise error.Abort(msg % short(changeid))
             try:
                 if len(changeid) == 20 and nonascii(changeid):
                     changeid = hex(changeid)