verify: keep the revlog open for reading while verifying it
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 25 Sep 2023 12:37:52 +0200
changeset 51015 812cd3dfa4cb
parent 51014 ed65e97db7bc
child 51016 aed91a4421b8
verify: keep the revlog open for reading while verifying it This is more explicit. No performances difference were observed.
mercurial/verify.py
--- a/mercurial/verify.py	Mon Sep 25 12:32:42 2023 +0200
+++ b/mercurial/verify.py	Mon Sep 25 12:37:52 2023 +0200
@@ -270,22 +270,23 @@
         progress = ui.makeprogress(
             _(b'checking'), unit=_(b'changesets'), total=len(repo)
         )
-        for i in repo:
-            progress.update(i)
-            n = cl.node(i)
-            self._checkentry(cl, i, n, seen, [i], b"changelog")
+        with cl.reading():
+            for i in repo:
+                progress.update(i)
+                n = cl.node(i)
+                self._checkentry(cl, i, n, seen, [i], b"changelog")
 
-            try:
-                changes = cl.read(n)
-                if changes[0] != self.repo.nullid:
-                    mflinkrevs.setdefault(changes[0], []).append(i)
+                try:
+                    changes = cl.read(n)
+                    if changes[0] != self.repo.nullid:
+                        mflinkrevs.setdefault(changes[0], []).append(i)
+                        self.refersmf = True
+                    for f in changes[3]:
+                        if match(f):
+                            filelinkrevs.setdefault(_normpath(f), []).append(i)
+                except Exception as inst:
                     self.refersmf = True
-                for f in changes[3]:
-                    if match(f):
-                        filelinkrevs.setdefault(_normpath(f), []).append(i)
-            except Exception as inst:
-                self.refersmf = True
-                self._exc(i, _(b"unpacking changeset %s") % short(n), inst)
+                    self._exc(i, _(b"unpacking changeset %s") % short(n), inst)
         progress.complete()
         return mflinkrevs, filelinkrevs