changeset 51012:3470a39fb66b

revlog: adapt the `reading` check for `bundlerepo` We cannot just rely on the length check for the `bundlerepo` as the local revlog might be empty with all data in the bundle.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 25 Sep 2023 12:13:38 +0200
parents 9461a0b74596
children 93a44c1ba0c6
files mercurial/bundlerepo.py
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundlerepo.py	Mon Sep 25 12:07:25 2023 +0200
+++ b/mercurial/bundlerepo.py	Mon Sep 25 12:13:38 2023 +0200
@@ -12,6 +12,7 @@
 """
 
 
+import contextlib
 import os
 import shutil
 
@@ -108,6 +109,14 @@
             self.bundlerevs.add(n)
             n += 1
 
+    @contextlib.contextmanager
+    def reading(self):
+        if self.repotiprev < 0:
+            yield
+        else:
+            with super().reading() as x:
+                yield x
+
     def _chunk(self, rev, df=None):
         # Warning: in case of bundle, the diff is against what we stored as
         # delta base, not against rev - 1