changeset 46525:636853347e14

upgrade: write nodemap for manifests too In 98e39f04d60e I assumed that writing nodemap for manifests was not desirable and stopped writing it during upgrade. However in recent discussion with Pierre-Yves, I learnt that that's not true. Differential Revision: https://phab.mercurial-scm.org/D9991
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 15 Feb 2021 15:13:20 +0530
parents e3f23814bac7
children 67b5fafd3a46
files mercurial/upgrade_utils/engine.py tests/test-persistent-nodemap.t
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/upgrade_utils/engine.py	Tue Feb 23 12:29:41 2021 -0800
+++ b/mercurial/upgrade_utils/engine.py	Mon Feb 15 15:13:20 2021 +0530
@@ -468,6 +468,13 @@
             unfi = srcrepo.unfiltered()
             cl = unfi.changelog
             nodemap.persist_nodemap(tr, cl, force=True)
+            # we want to directly operate on the underlying revlog to force
+            # create a nodemap file. This is fine since this is upgrade code
+            # and it heavily relies on repository being revlog based
+            # hence accessing private attributes can be justified
+            nodemap.persist_nodemap(
+                tr, unfi.manifestlog._rootstore._revlog, force=True
+            )
         scmutil.writereporequirements(srcrepo, upgrade_op.new_requirements)
     else:
         with dstrepo.transaction(b'upgrade') as tr:
--- a/tests/test-persistent-nodemap.t	Tue Feb 23 12:29:41 2021 -0800
+++ b/tests/test-persistent-nodemap.t	Mon Feb 15 15:13:20 2021 +0530
@@ -641,6 +641,8 @@
   $ ls -1 .hg/store/ | egrep '00(changelog|manifest)(\.n|-.*\.nd)'
   00changelog-*.nd (glob)
   00changelog.n
+  00manifest-*.nd (glob)
+  00manifest.n
 
   $ hg debugnodemap --metadata
   uid: * (glob)