Patchwork D3450: context: only bother looking for broken dirstate for 20-byte changeid

login
register
mail settings
Submitter phabricator
Date May 7, 2018, 12:54 p.m.
Message ID <e41c461009b4b7afce3df71ef606b16f@localhost.localdomain>
Download mbox | patch
Permalink /patch/31294/
State Not Applicable
Headers show

Comments

phabricator - May 7, 2018, 12:54 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGfdd8da79eb85: context: only bother looking for broken dirstate for 20-byte changeid (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3450?vs=8467&id=8476

REVISION DETAIL
  https://phab.mercurial-scm.org/D3450

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -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)