Patchwork D9991: upgrade: write nodemap for manifests too

login
register
mail settings
Submitter phabricator
Date Feb. 15, 2021, 10:28 a.m.
Message ID <differential-rev-PHID-DREV-xwifz4orkbzca2ca7rch-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48306/
State Superseded
Headers show

Comments

phabricator - Feb. 15, 2021, 10:28 a.m.
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  In 98e39f04d60e <https://phab.mercurial-scm.org/rHG98e39f04d60e5dbfc6c70fd3ba5465b3e62ca662> 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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9991

AFFECTED FILES
  mercurial/upgrade_utils/engine.py
  tests/test-persistent-nodemap.t

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-persistent-nodemap.t b/tests/test-persistent-nodemap.t
--- a/tests/test-persistent-nodemap.t
+++ b/tests/test-persistent-nodemap.t
@@ -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)
diff --git a/mercurial/upgrade_utils/engine.py b/mercurial/upgrade_utils/engine.py
--- a/mercurial/upgrade_utils/engine.py
+++ b/mercurial/upgrade_utils/engine.py
@@ -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: