changeset 51150:1486d8c63f64 stable

persistent-nodemap: avoid writing nodemap for empty revlog The format cannot encode the lack of tip_rev. There is currently nothing known to write such empty nodemap right now, but the change we are preparing on default reveal this issue. So I had rather fix it on stable.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 07 Dec 2023 03:49:48 +0100
parents e306d552dfb1
children 85d96517e650 37b52b938579 028498b04a84
files mercurial/revlogutils/nodemap.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlogutils/nodemap.py	Tue Dec 12 11:47:48 2023 +0100
+++ b/mercurial/revlogutils/nodemap.py	Thu Dec 07 03:49:48 2023 +0100
@@ -163,6 +163,8 @@
 
 def persist_nodemap(tr, revlog, pending=False, force=False):
     """Write nodemap data on disk for a given revlog"""
+    if len(revlog.index) <= 0:
+        return
     if getattr(revlog, 'filteredrevs', ()):
         raise error.ProgrammingError(
             "cannot persist nodemap of a filtered changelog"