Patchwork largefiles: avoid infinite recursive call of openlfdirstate in overriderevert

login
register
mail settings
Submitter Katsunori FUJIWARA
Date March 2, 2015, 2:42 p.m.
Message ID <90f08728e0f7cc92d4ba.1425307323@juju>
Download mbox | patch
Permalink /patch/7876/
State Accepted
Commit 90f08728e0f7cc92d4bae67965d18d8ae5cc312c
Headers show

Comments

Katsunori FUJIWARA - March 2, 2015, 2:42 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@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.
Matt Mackall - March 2, 2015, 4:57 p.m.
On Mon, 2015-03-02 at 23:42 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy@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

Queued for default, thanks!

Patch

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: