persistent-nodemap: avoid writing nodemap for empty revlog stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 07 Dec 2023 03:49:48 +0100
branchstable
changeset 51175 1486d8c63f64
parent 51174 e306d552dfb1
child 51176 37b52b938579
child 51183 028498b04a84
child 51265 85d96517e650
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.
mercurial/revlogutils/nodemap.py
--- 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"