Patchwork D6468: narrowspec: replace one recursion-avoidance hack with another

login
register
mail settings
Submitter phabricator
Date June 3, 2019, 5:56 p.m.
Message ID <156e9430f6e21b2dc87a7880301e4d0e@localhost.localdomain>
Download mbox | patch
Permalink /patch/40307/
State Not Applicable
Headers show

Comments

phabricator - June 3, 2019, 5:56 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG4738c292a520: narrowspec: replace one recursion-avoidance hack with another (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6468?vs=15316&id=15331

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

AFFECTED FILES
  mercurial/narrowspec.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/narrowspec.py b/mercurial/narrowspec.py
--- a/mercurial/narrowspec.py
+++ b/mercurial/narrowspec.py
@@ -262,6 +262,9 @@ 
                        mctx=repo['.'], overwrite=False)
 
 def checkworkingcopynarrowspec(repo):
+    # Avoid infinite recursion when updating the working copy
+    if getattr(repo, '_updatingnarrowspec', False):
+        return
     storespec = repo.svfs.tryread(FILENAME)
     wcspec = repo.vfs.tryread(DIRSTATE_FILENAME)
     if wcspec != storespec:
@@ -276,6 +279,7 @@ 
     """
     oldspec = repo.vfs.tryread(DIRSTATE_FILENAME)
     newspec = repo.svfs.tryread(FILENAME)
+    repo._updatingnarrowspec = True
 
     oldincludes, oldexcludes = parseconfig(repo.ui, oldspec)
     newincludes, newexcludes = parseconfig(repo.ui, newspec)
@@ -305,10 +309,9 @@ 
     for f in clean + trackeddirty:
         ds.drop(f)
 
-    repo.narrowpats = newincludes, newexcludes
-    repo._narrowmatch = newmatch
     pctx = repo['.']
     newfiles = [f for f in pctx.manifest().walk(addedmatch) if f not in ds]
     for f in newfiles:
         ds.normallookup(f)
     _writeaddedfiles(repo, pctx, newfiles)
+    repo._updatingnarrowspec = False