Mercurial > public > mercurial-scm > hg
comparison mercurial/revlogutils/nodemap.py @ 51172: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 | d718eddf01d9 |
children | 85d96517e650 |
comparison
equal
deleted
inserted
replaced
51171:e306d552dfb1 | 51172:1486d8c63f64 |
---|---|
161 repo.svfs.tryunlink(f) | 161 repo.svfs.tryunlink(f) |
162 | 162 |
163 | 163 |
164 def persist_nodemap(tr, revlog, pending=False, force=False): | 164 def persist_nodemap(tr, revlog, pending=False, force=False): |
165 """Write nodemap data on disk for a given revlog""" | 165 """Write nodemap data on disk for a given revlog""" |
166 if len(revlog.index) <= 0: | |
167 return | |
166 if getattr(revlog, 'filteredrevs', ()): | 168 if getattr(revlog, 'filteredrevs', ()): |
167 raise error.ProgrammingError( | 169 raise error.ProgrammingError( |
168 "cannot persist nodemap of a filtered changelog" | 170 "cannot persist nodemap of a filtered changelog" |
169 ) | 171 ) |
170 if revlog._nodemap_file is None: | 172 if revlog._nodemap_file is None: |