Patchwork [6,of,7] verify: move changelog verificaiton to it's own function

login
register
mail settings
Submitter Durham Goode
Date Jan. 6, 2016, 2:44 a.m.
Message ID <48638907e0b683734ca0.1452048290@dev8486.prn1.facebook.com>
Download mbox | patch
Permalink /patch/12553/
State Accepted
Delegated to: Martin von Zweigbergk
Headers show

Comments

Durham Goode - Jan. 6, 2016, 2:44 a.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1452042494 28800
#      Tue Jan 05 17:08:14 2016 -0800
# Node ID 48638907e0b683734ca0e38502bcd0ce210a3590
# Parent  94e1449952e04acf0c289892850ae167b1f57c3c
verify: move changelog verificaiton to it's own function

This makes verify more modular so extensions can hook into it.

Patch

diff --git a/mercurial/verify.py b/mercurial/verify.py
--- a/mercurial/verify.py
+++ b/mercurial/verify.py
@@ -153,6 +153,34 @@  class verifier(object):
             ui.status(_("repository uses revlog format %d\n") %
                            (revlogv1 and 1 or 0))
 
+        self._verifychangelog(mflinkrevs, filelinkrevs)
+
+        self._verifymanifest(mflinkrevs, filenodes)
+
+        self._crosscheckfiles(mflinkrevs, filelinkrevs, filenodes)
+
+        totalfiles, filerevisions = self._verifyfiles(filenodes, filelinkrevs)
+        revisions += filerevisions
+
+        ui.status(_("%d files, %d changesets, %d total revisions\n") %
+                       (totalfiles, len(cl), revisions))
+        if self.warnings:
+            ui.warn(_("%d warnings encountered!\n") % self.warnings)
+        if self.fncachewarned:
+            ui.warn(_('hint: run "hg debugrebuildfncache" to recover from '
+                      'corrupt fncache\n'))
+        if self.errors:
+            ui.warn(_("%d integrity errors encountered!\n") % self.errors)
+            if badrevs:
+                ui.warn(_("(first damaged changeset appears to be %d)\n")
+                        % min(badrevs))
+            return 1
+
+    def _verifychangelog(self, mflinkrevs, filelinkrevs):
+        ui = self.ui
+        repo = self.repo
+        cl = repo.changelog
+
         ui.status(_("checking changesets\n"))
         seen = {}
         self.checklog(cl, "changelog", 0)
@@ -175,27 +203,6 @@  class verifier(object):
                 self.exc(i, _("unpacking changeset %s") % short(n), inst)
         ui.progress(_('checking'), None)
 
-        self._verifymanifest(mflinkrevs, filenodes)
-
-        self._crosscheckfiles(mflinkrevs, filelinkrevs, filenodes)
-
-        totalfiles, filerevisions = self._verifyfiles(filenodes, filelinkrevs)
-        revisions += filerevisions
-
-        ui.status(_("%d files, %d changesets, %d total revisions\n") %
-                       (totalfiles, len(cl), revisions))
-        if self.warnings:
-            ui.warn(_("%d warnings encountered!\n") % self.warnings)
-        if self.fncachewarned:
-            ui.warn(_('hint: run "hg debugrebuildfncache" to recover from '
-                      'corrupt fncache\n'))
-        if self.errors:
-            ui.warn(_("%d integrity errors encountered!\n") % self.errors)
-            if badrevs:
-                ui.warn(_("(first damaged changeset appears to be %d)\n")
-                        % min(badrevs))
-            return 1
-
     def _verifymanifest(self, mflinkrevs, filenodes):
         repo = self.repo
         ui = self.ui