changeset 27647:2c2858f3c1bb

verify: move changelog verificaiton to its own function This makes verify more modular so extensions can hook into it.
author Durham Goode <durham@fb.com>
date Tue, 05 Jan 2016 17:08:14 -0800
parents 8f43793382c6
children e72e669dd51f
files mercurial/verify.py
diffstat 1 files changed, 28 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/verify.py	Tue Jan 05 18:34:39 2016 -0800
+++ b/mercurial/verify.py	Tue Jan 05 17:08:14 2016 -0800
@@ -153,6 +153,34 @@
             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 @@
                 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