# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 2021-02-15 09:43:20 # Node ID 636853347e14129738393fd0b88e0c769fc3076f # Parent e3f23814bac7324a457f5b231de3c8234c62503a 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 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 @@ def upgrade(ui, srcrepo, dstrepo, upgrad 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: 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 @@ upgrading $ 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)