verify: keep the revlog open for reading while verifying it
This is more explicit. No performances difference were observed.
--- 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