# HG changeset patch # User Pierre-Yves David # Date 2023-02-22 03:00:30 # Node ID 98890baf324e6664cb87d97eaccc61f89d6a85e4 # Parent e9379b55ed801ecbfbcc942416cf5bd8b3c15519 large-files: use a `changing_files` context when initializing the dirstate We are obviously mutating the dirstate, so lets scope this mutation. diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py --- a/hgext/largefiles/lfutil.py +++ b/hgext/largefiles/lfutil.py @@ -233,7 +233,7 @@ def openlfdirstate(ui, repo, create=True # largefiles operation in a new clone. if create and not vfs.exists(vfs.join(lfstoredir, b'dirstate')): try: - with repo.wlock(wait=False): + with repo.wlock(wait=False), lfdirstate.changing_files(repo): matcher = getstandinmatcher(repo) standins = repo.dirstate.walk( matcher, subrepos=[], unknown=False, ignored=False @@ -250,8 +250,6 @@ def openlfdirstate(ui, repo, create=True wc_tracked=True, possibly_dirty=True, ) - # avoid getting dirty dirstate before other operations - lfdirstate.write(repo.currenttransaction()) except error.LockError: # Assume that whatever was holding the lock was important. # If we were doing something important, we would already have