revlog: use a `reading` context in `_enforceinlinesize`
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 26 Sep 2023 02:49:18 +0200
changeset 51025 9011c38b4f65
parent 51024 299b7b5440db
child 51026 8520db304f01
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.
mercurial/revlog.py
--- a/mercurial/revlog.py	Tue Sep 26 00:55:49 2023 +0200
+++ b/mercurial/revlog.py	Tue Sep 26 02:49:18 2023 +0200
@@ -2228,9 +2228,9 @@
         new_dfh = self._datafp(b'w+')
         new_dfh.truncate(0)  # drop any potentially existing data
         try:
-            with self._indexfp() as read_ifh:
+            with self.reading():
                 for r in self:
-                    new_dfh.write(self._getsegmentforrevs(r, r, df=read_ifh)[1])
+                    new_dfh.write(self._getsegmentforrevs(r, r)[1])
                 new_dfh.flush()
 
             if side_write: