mercurial/dirstatemap.py
branchstable
changeset 50222 ecd28d89c29e
parent 50221 1891086f6c7f
child 50228 fc8e37c380d3
--- a/mercurial/dirstatemap.py	Fri Feb 24 18:21:54 2023 +0100
+++ b/mercurial/dirstatemap.py	Tue Feb 28 15:49:53 2023 +0100
@@ -33,6 +33,7 @@
 
 WRITE_MODE_AUTO = 0
 WRITE_MODE_FORCE_NEW = 1
+WRITE_MODE_FORCE_APPEND = 2
 
 
 class _dirstatemapcommon:
@@ -57,6 +58,16 @@
         self._parents = None
         self._dirtyparents = False
         self._docket = None
+        write_mode = ui.config(b"devel", b"dirstate.v2.data_update_mode")
+        if write_mode == b"auto":
+            self._write_mode = WRITE_MODE_AUTO
+        elif write_mode == b"force-append":
+            self._write_mode = WRITE_MODE_FORCE_APPEND
+        elif write_mode == b"force-new":
+            self._write_mode = WRITE_MODE_FORCE_NEW
+        else:
+            # unknown value, fallback to default
+            self._write_mode = WRITE_MODE_AUTO
 
         # for consistent view between _pl() and _read() invocations
         self._pendingmode = None
@@ -612,7 +623,7 @@
                 return
 
             # We can only append to an existing data file if there is one
-            write_mode = WRITE_MODE_AUTO
+            write_mode = self._write_mode
             if self.docket.uuid is None:
                 write_mode = WRITE_MODE_FORCE_NEW
             packed, meta, append = self._map.write_v2(write_mode)