revlog: remove the `_indexfp` method
authorPierre-Yves David <pierre-yves.david@octobus.net>
Wed, 11 Oct 2023 02:19:00 +0200
changeset 51081 5ffee3cff8de
parent 51080 09d60aed5f5d
child 51082 808f1e38cd1d
revlog: remove the `_indexfp` method The method is only used two time and we want to move that code to a lower level object. So we simply inline the method to simplify further refactoring.
mercurial/revlog.py
--- a/mercurial/revlog.py	Sat Oct 14 03:24:13 2023 +0200
+++ b/mercurial/revlog.py	Wed Oct 11 02:19:00 2023 +0200
@@ -793,7 +793,7 @@
         if self._inline:
 
             def get_stream():
-                with self._indexfp() as fp:
+                with self.opener(self._indexfile, mode=b"r") as fp:
                     yield None
                     size = index_size + data_size
                     if size <= 65536:
@@ -832,7 +832,7 @@
         else:
 
             def get_index_stream():
-                with self._indexfp() as fp:
+                with self.opener(self._indexfile, mode=b"r") as fp:
                     yield None
                     if index_size <= 65536:
                         yield fp.read(index_size)
@@ -1065,10 +1065,6 @@
         c = self._get_decompressor(t)
         return c.decompress
 
-    def _indexfp(self):
-        """file object for the revlog's index file"""
-        return self.opener(self._indexfile, mode=b"r")
-
     def __index_write_fp(self):
         # You should not use this directly and use `_writing` instead
         try: