Commit 2ea6a67ff50 by Pierre-Yves David

nodemap: write new data from the expected current data length

If the amount of data in the file exceed the expect amount, we will overwrite
the extra data. This is a simple way to be safer.

Differential Revision: https://phab.mercurial-scm.org/D7891
parent 1d2b37def01
......@@ -92,7 +92,8 @@ def _persist_nodemap(tr, revlog):
datafile = _rawdata_filepath(revlog, target_docket)
# EXP-TODO: if this is a cache, this should use a cache vfs, not a
# store vfs
with revlog.opener(datafile, b'a') as fd:
with revlog.opener(datafile, b'r+') as fd:
fd.seek(target_docket.data_length)
fd.write(data)
target_docket.data_length += len(data)
target_docket.data_unused += data_changed_count
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment