# HG changeset patch # User Pierre-Yves David # Date 2021-05-26 19:46:45 # Node ID 27e9ed1217c507f092c32201be255c69d53f5878 # Parent 1844a2e3401c3c05ca91b3a928b2eabf16215217 revlog: close the index file handle after the data one This make sure the data file is flushed before the index. preventing the index to reference unflushed data. Differential Revision: https://phab.mercurial-scm.org/D10776 diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -2267,10 +2267,12 @@ class revlog(object): self._write_docket(transaction) finally: self._writinghandles = None + if dfh is not None: + dfh.close() + # closing the index file last to avoid exposing referent to + # potential unflushed data content. if ifh is not None: ifh.close() - if dfh is not None: - dfh.close() def _write_docket(self, transaction): """write the current docket on disk