This is an archive of the discontinued Mercurial Phabricator instance.

dirstate-v2: Add support when Rust is not enabled
ClosedPublic

Authored by SimonSapin on Oct 1 2021, 3:18 AM.

Details

Summary

This wires into dirstatemap the parser and serializer added in previous
changesets. The memory representation is still the same, with a flat dict
for DirstateItems and another one for copy sources. Serialization always
creates a new dirstate-v2 data file and does not support (when Rust is not
enabled) appending to an existing one, since we don’t keep track of which
tree nodes are new or modified. Instead the tree is reconstructed during
serialization.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

SimonSapin created this revision.Oct 1 2021, 3:18 AM

The current project policy is not to blindly add slow support for this new format. We should make it possible to supports it, but disabled by default.

For comparison, see what is done for the persistent-nodemap format variable through the storage.revlog.persistent-nodemap.slow-path config option.

mercurial/dirstatemap.py
38–39

The creation if this class should probably goes into a different changeset than the addition of the python support for v2, it would make it clearer which part are about factoring code out and which part is about adding support for v2 in Python.

40

iderticalidentical

marmoute updated this revision to Diff 30501.Oct 1 2021, 9:51 AM
marmoute requested changes to this revision.Oct 1 2021, 10:14 AM
This revision now requires changes to proceed.Oct 1 2021, 10:14 AM
SimonSapin updated this revision to Diff 30688.Oct 8 2021, 8:06 AM
baymax updated this revision to Diff 30761.Oct 12 2021, 2:04 PM

✅ refresh by Heptapod after a successful CI run (🐙 💚)

I’ve rebased this on top of D11655 and changed the Python parser and serializer to match recent changes to the Rust ones. Unfortunately this has to be done by carefully looking at both implementation and the docs, since we don’t yet have tests that show compatibility between the Rust serializer and Python parser, or vice-versa.

Also there’s a new test failure in test-dirstate-race.t#dirstate-v2 that I don’t understand. It’s only in pure-Python mode, and has three chunks like this:

   $ hg debugdirstate
   n 644          2 * a (glob)
-  n   0         -1 unset               b
-  n   0         -1 unset               d
-  n   0         -1 unset               dir1/c
-  n   0         -1 unset               e
+  n 644         -1 unset               b
+  n 644         -1 unset               d
+  n 644         -1 unset               dir1/c
+  n 644         -1 unset               e
pulkit accepted this revision.Oct 13 2021, 3:20 PM
This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.