[PATCH 11 of 27 clfilter V2] clfilter: prevent unwanted warning about filtered parents as unknown

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Oct 8 16:38:02 CDT 2012


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
# Date 1349709308 -7200
# Node ID 40956eab8349b41f1c1b3d143250ad572d976b14
# Parent  6b33b8080e38bab1e824902107689cef55a99ce5
clfilter: prevent unwanted warning about filtered parents as unknown

During changectx __init__ the dirstate parent MAY be checked. If the repo is
filtered this check will report will complains about "working directory has
unknown parent" even if the parent are perfectly known. This may happen when the
repo is used as a server and the dirstate parents are secret. (as secret
changeset are filtered for server).

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -95,7 +95,10 @@
 
         # lookup failed
         # check if it might have come from damaged dirstate
-        if changeid in repo.dirstate.parents():
+        #
+        # XXX we could avoid the unfiltered if we had a recognisable exception
+        # for filtered changeset access
+        if changeid in repo.unfiltered().dirstate.parents():
             raise error.Abort(_("working directory has unknown parent '%s'!")
                               % short(changeid))
         try:


More information about the Mercurial-devel mailing list