[PATCH] largefiles: avoid infinite recursive call of openlfdirstate in overriderevert

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Mon Mar 2 14:42:03 UTC 2015


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1425307075 -32400
#      Mon Mar 02 23:37:55 2015 +0900
# Node ID 90f08728e0f7cc92d4bae67965d18d8ae5cc312c
# Parent  bb11081562d776f255e738ecb38a845a5e074226
largefiles: avoid infinite recursive call of openlfdirstate in overriderevert

When there isn't lfdirstate file in cases below, "openlfdirstate()"
call "scmutil.match()" indirectly to build lfdirstate up.

  - subrepos disabling largefiles locally
  - lfdirstate file is missed accidentally

This causes infinite recursive call of "openlfdirstate()" in
"overriderevert()" (introduced by 79c2c29c71ae), because
"openlfdirstate()" is invoked from the function overriding
"scmutil.match()" itself.

To avoid infinite recursive call of "openlfdirstate()" in
"overriderevert()" in such cases, this patch passes "create=False"
argument to "openlfdirstate()".

"create=False" forcibly makes "openlfdirstate()" avoid code path to
build lfdirstate up.

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -721,7 +721,7 @@ def overriderevert(orig, ui, repo, *pats
             # currently doesn't work correctly in that case, this match is
             # called, so the lfdirstate above may not be the correct one for
             # this invocation of match.
-            lfdirstate = lfutil.openlfdirstate(ctx._repo.ui, ctx._repo)
+            lfdirstate = lfutil.openlfdirstate(ctx._repo.ui, ctx._repo, False)
 
             def tostandin(f):
                 if lfutil.standin(f) in ctx:


More information about the Mercurial-devel mailing list