Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/revlog.py @ 47336:27e9ed1217c5
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
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 26 May 2021 21:46:45 +0200 |
parents | 1844a2e3401c |
children | d6a52783d2ba |
comparison
equal
deleted
inserted
replaced
47335:1844a2e3401c | 47336:27e9ed1217c5 |
---|---|
2265 yield | 2265 yield |
2266 if self._docket is not None: | 2266 if self._docket is not None: |
2267 self._write_docket(transaction) | 2267 self._write_docket(transaction) |
2268 finally: | 2268 finally: |
2269 self._writinghandles = None | 2269 self._writinghandles = None |
2270 if dfh is not None: | |
2271 dfh.close() | |
2272 # closing the index file last to avoid exposing referent to | |
2273 # potential unflushed data content. | |
2270 if ifh is not None: | 2274 if ifh is not None: |
2271 ifh.close() | 2275 ifh.close() |
2272 if dfh is not None: | |
2273 dfh.close() | |
2274 | 2276 |
2275 def _write_docket(self, transaction): | 2277 def _write_docket(self, transaction): |
2276 """write the current docket on disk | 2278 """write the current docket on disk |
2277 | 2279 |
2278 Exist as a method to help changelog to implement transaction logic | 2280 Exist as a method to help changelog to implement transaction logic |