[PATCH 05 of 15 RFC] verify: introduce interface to make partial verification available

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Wed Oct 3 11:39:02 CDT 2012


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1349281445 -32400
# Node ID d8898e4a2e1908b67de486139cb55c58bb461718
# Parent  07c423d400694c4ca3bb5a7cadd0e4119d31d4bd
verify: introduce interface to make partial verification available

this patch introduces new interface to make partial verification
available into "verify()" and internal function "_verify()" in verify
module.

"targetrevs" arguement of "verify()" should be tuple of below:

  - revision numbers of verification targets in changelog
  - revision numbers of verification targets in manifest
  - function to get lock object for store area

This patch also changes "for" looping and progress management for
changelog and manifest.

diff -r 07c423d40069 -r d8898e4a2e19 mercurial/verify.py
--- a/mercurial/verify.py	Thu Oct 04 01:24:05 2012 +0900
+++ b/mercurial/verify.py	Thu Oct 04 01:24:05 2012 +0900
@@ -10,14 +10,18 @@
 import os
 import revlog, util, error
 
-def verify(repo):
-    lock = repo.lock()
+def verify(repo, targetrevs=None):
+    if targetrevs:
+        clrevs, mfrevs, getlock = targetrevs
+    else:
+        clrevs, mfrevs, getlock = repo.changelog, repo.manifest, repo.lock
+    lock = getlock()
     try:
-        return _verify(repo)
+        return _verify(repo, clrevs, mfrevs, targetrevs)
     finally:
         lock.release()
 
-def _verify(repo):
+def _verify(repo, clrevs, mfrevs, partially):
     mflinkrevs = {}
     filelinkrevs = {}
     filenodes = {}
@@ -123,9 +127,11 @@
     refersmf = False
     seen = {}
     checklog(cl, "changelog", 0)
-    total = len(repo)
-    for i in repo:
-        ui.progress(_('checking'), i, total=total, unit=_('changesets'))
+    total = len(clrevs)
+    count = 0
+    for i in clrevs:
+        count += 1
+        ui.progress(_('checking'), count, total=total, unit=_('changesets'))
         n = cl.node(i)
         checkentry(cl, i, n, seen, [i], "changelog")
 
@@ -147,9 +153,11 @@
         # Do not check manifest if there are only changelog entries with
         # null manifests.
         checklog(mf, "manifest", 0)
-    total = len(mf)
-    for i in mf:
-        ui.progress(_('checking'), i, total=total, unit=_('manifests'))
+    total = len(mfrevs)
+    count = 0
+    for i in mfrevs:
+        count += 1
+        ui.progress(_('checking'), count, total=total, unit=_('manifests'))
         n = mf.node(i)
         lr = checkentry(mf, i, n, seen, mflinkrevs.get(n, []), "manifest")
         if n in mflinkrevs:


More information about the Mercurial-devel mailing list