diff mercurial/dirstate.py @ 47328:a43d256c041a

dirstate-v2: Add `hg debugupgraderepo` command support This command changes changes the file formats used inside an existing repository to what they would be in a new repository with the current config. For example: hg debugupgraderepo --config format.exp-dirstate-v2=1 --run hg debugupgraderepo --config format.exp-dirstate-v2=0 --run If a repository has a dirstate in v1 format, the first command would upgrade it to dirstate-v2. Conversely, if a repository has a dirstate in v2 format, the second command would downgrade it to v1. (Both may also run some unrelated upgrades.) Since `format.exp-dirstate-v2` is currently disabled by default, not specifying it in `--config` or any configuration file would result in the second command. Differential Revision: https://phab.mercurial-scm.org/D10769
author Simon Sapin <simon.sapin@octobus.net>
date Wed, 19 May 2021 18:35:43 +0200
parents 1766130fe9ba
children 04d1f17f49e7
line wrap: on
line diff
--- a/mercurial/dirstate.py	Fri May 21 17:12:47 2021 +0200
+++ b/mercurial/dirstate.py	Wed May 19 18:35:43 2021 +0200
@@ -1775,6 +1775,12 @@
             # for consistent view between _pl() and _read() invocations
             self._pendingmode = None
 
+            self._use_dirstate_tree = self._ui.configbool(
+                b"experimental",
+                b"dirstate-tree.in-memory",
+                False,
+            )
+
         def addfile(self, *args, **kwargs):
             return self._rustmap.addfile(*args, **kwargs)
 
@@ -1903,13 +1909,8 @@
                     raise
                 st = b''
 
-            use_dirstate_tree = self._ui.configbool(
-                b"experimental",
-                b"dirstate-tree.in-memory",
-                False,
-            )
             self._rustmap, parents = rustmod.DirstateMap.new(
-                use_dirstate_tree, self._use_dirstate_v2, st
+                self._use_dirstate_tree, self._use_dirstate_v2, st
             )
 
             if parents and not self._dirtyparents: