changeset 51015:812cd3dfa4cb

verify: keep the revlog open for reading while verifying it This is more explicit. No performances difference were observed.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 25 Sep 2023 12:37:52 +0200
parents ed65e97db7bc
children aed91a4421b8
files mercurial/verify.py
diffstat 1 files changed, 15 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- 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