changeset 50153:98890baf324e

large-files: use a `changing_files` context when initializing the dirstate We are obviously mutating the dirstate, so lets scope this mutation.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 22 Feb 2023 04:00:30 +0100
parents e9379b55ed80
children 028fb89a0539
files hgext/largefiles/lfutil.py
diffstat 1 files changed, 1 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/lfutil.py	Wed Feb 22 03:20:19 2023 +0100
+++ b/hgext/largefiles/lfutil.py	Wed Feb 22 04:00:30 2023 +0100
@@ -233,7 +233,7 @@
     # 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 @@
                         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