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.
--- 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"