changeset 51019:66c139d33cfe

censors: simply use `revlog.reading` to keep things open dring rewrite We have a dedicated context now, we can simply use it. In practice, we cannot "simply" use it, as `finddeltainfo` still requires the file pointer to be passed explicitly. We will keep the old context manager open for a small bit until we get rid of it in a future changeset.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 25 Sep 2023 16:47:55 +0200
parents 720e5a5f2b95
children 509f0f7fc89e
files mercurial/revlogutils/rewrite.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlogutils/rewrite.py	Mon Sep 25 17:18:40 2023 +0200
+++ b/mercurial/revlogutils/rewrite.py	Mon Sep 25 16:47:55 2023 +0200
@@ -234,7 +234,7 @@
     dc = deltas.deltacomputer(revlog)
     rewritten_entries = {}
     first_excl_rev = min(excluded_revs)
-    with revlog._segmentfile._open_read() as dfh:
+    with revlog.reading(), revlog._segmentfile._open_read() as dfh:
         for rev in range(first_excl_rev, len(old_index)):
             if rev in excluded_revs:
                 # this revision will be preserved as is, so we don't need to
@@ -250,7 +250,7 @@
                 rewritten_entries[rev] = (nullrev, 0, 0, COMP_MODE_PLAIN)
             else:
 
-                text = revlog.rawdata(rev, _df=dfh)
+                text = revlog.rawdata(rev)
                 info = revlogutils.revisioninfo(
                     node=entry[ENTRY_NODE_ID],
                     p1=revlog.node(entry[ENTRY_PARENT_1]),