D3797: verify: use progress helper for subdirectory progress

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon Jun 18 16:26:18 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG0ddbe03c5aaa: verify: use progress helper for subdirectory progress (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3797?vs=9191&id=9199

REVISION DETAIL
  https://phab.mercurial-scm.org/D3797

AFFECTED FILES
  mercurial/verify.py

CHANGE DETAILS

diff --git a/mercurial/verify.py b/mercurial/verify.py
--- a/mercurial/verify.py
+++ b/mercurial/verify.py
@@ -199,7 +199,7 @@
         return mflinkrevs, filelinkrevs
 
     def _verifymanifest(self, mflinkrevs, dir="", storefiles=None,
-                        progress=None):
+                        subdirprogress=None):
         repo = self.repo
         ui = self.ui
         match = self.match
@@ -217,8 +217,8 @@
             label = dir
             revlogfiles = mf.files()
             storefiles.difference_update(revlogfiles)
-            if progress: # should be true since we're in a subdirectory
-                progress()
+            if subdirprogress: # should be true since we're in a subdirectory
+                subdirprogress.increment()
         if self.refersmf:
             # Do not check manifest if there are only changelog entries with
             # null manifests.
@@ -280,21 +280,17 @@
                 elif (size > 0 or not revlogv1) and f.startswith('meta/'):
                     storefiles.add(_normpath(f))
                     subdirs.add(os.path.dirname(f))
-            subdircount = len(subdirs)
-            currentsubdir = [0]
-            def progress():
-                currentsubdir[0] += 1
-                ui.progress(_('checking'), currentsubdir[0], total=subdircount,
-                            unit=_('manifests'))
+            subdirprogress = ui.makeprogress(_('checking'), unit=_('manifests'),
+                                             total=len(subdirs))
 
         for subdir, linkrevs in subdirnodes.iteritems():
             subdirfilenodes = self._verifymanifest(linkrevs, subdir, storefiles,
-                                                   progress)
+                                                   subdirprogress)
             for f, onefilenodes in subdirfilenodes.iteritems():
                 filenodes.setdefault(f, {}).update(onefilenodes)
 
         if not dir and subdirnodes:
-            ui.progress(_('checking'), None)
+            subdirprogress.complete()
             if self.warnorphanstorefiles:
                 for f in sorted(storefiles):
                     self.warn(_("warning: orphan data file '%s'") % f)



To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel


More information about the Mercurial-devel mailing list