comparison mercurial/revlog.py @ 51025:9011c38b4f65

revlog: use a `reading` context in `_enforceinlinesize` We are about to enforce reading context on various operation, so we make sure top level method are in the right context. In the future we might move the responsibility of opening the revlog for reading higher in the call chain but lets limit the disruption for now.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Tue, 26 Sep 2023 02:49:18 +0200
parents 299b7b5440db
children 8520db304f01
comparison
equal deleted inserted replaced
51024:299b7b5440db 51025:9011c38b4f65
2226 tr.addabort(callback_id, abort_callback) 2226 tr.addabort(callback_id, abort_callback)
2227 2227
2228 new_dfh = self._datafp(b'w+') 2228 new_dfh = self._datafp(b'w+')
2229 new_dfh.truncate(0) # drop any potentially existing data 2229 new_dfh.truncate(0) # drop any potentially existing data
2230 try: 2230 try:
2231 with self._indexfp() as read_ifh: 2231 with self.reading():
2232 for r in self: 2232 for r in self:
2233 new_dfh.write(self._getsegmentforrevs(r, r, df=read_ifh)[1]) 2233 new_dfh.write(self._getsegmentforrevs(r, r)[1])
2234 new_dfh.flush() 2234 new_dfh.flush()
2235 2235
2236 if side_write: 2236 if side_write:
2237 self._indexfile = new_index_file_path 2237 self._indexfile = new_index_file_path
2238 with self.__index_new_fp() as fp: 2238 with self.__index_new_fp() as fp: