[PATCH] sparse: fix dirstate changing context usage - looks that forgotten after introduced

alexraynepe196 at gmail.com alexraynepe196 at gmail.com
Sat Jul 22 15:49:25 UTC 2023


# HG changeset patch
# User alexrayne
# Date 1689943593 -10800
#      Fri Jul 21 15:46:33 2023 +0300
# Node ID 54dd736398b78d54dda845ea24bac3b5f0a2c375
# Parent  cf0502231d56faeee7569666642b5b8502432f06
# EXP-Topic fix-sparse-dirstatectx
sparse: fix dirstate changing context usage - looks that forgotten after introduced
        changing_XXX() API for dirstate

diff --git a/mercurial/sparse.py b/mercurial/sparse.py
--- a/mercurial/sparse.py
+++ b/mercurial/sparse.py
@@ -294,8 +294,9 @@
     )
 
     # Fix dirstate
-    for file in dropped:
-        dirstate.update_file(file, p1_tracked=False, wc_tracked=False)
+    with dirstate.changing_parents(repo):
+        for file in dropped:
+            dirstate.update_file(file, p1_tracked=False, wc_tracked=False)
 
     repo.vfs.unlink(b'tempsparse')
     repo._sparsesignaturecache.clear()
@@ -576,17 +577,18 @@
     )
 
     # Fix dirstate
-    for file in added:
-        dirstate.update_file(file, p1_tracked=True, wc_tracked=True)
-
-    for file in dropped:
-        dirstate.update_file(file, p1_tracked=False, wc_tracked=False)
-
-    for file in lookup:
-        # File exists on disk, and we're bringing it back in an unknown state.
-        dirstate.update_file(
-            file, p1_tracked=True, wc_tracked=True, possibly_dirty=True
-        )
+    with dirstate.changing_parents(repo):
+        for file in added:
+            dirstate.update_file(file, p1_tracked=True, wc_tracked=True)
+    
+        for file in dropped:
+            dirstate.update_file(file, p1_tracked=False, wc_tracked=False)
+    
+        for file in lookup:
+            # File exists on disk, and we're bringing it back in an unknown state.
+            dirstate.update_file(
+                file, p1_tracked=True, wc_tracked=True, possibly_dirty=True
+            )
 
     return added, dropped, lookup
 



More information about the Mercurial-devel mailing list