Patchwork D3797: verify: use progress helper for subdirectory progress

login
register
mail settings
Submitter phabricator
Date June 18, 2018, 8:26 p.m.
Message ID <13f10b928641a4221123d2dffb0c779a@localhost.localdomain>
Download mbox | patch
Permalink /patch/32303/
State Not Applicable
Headers show

Comments

phabricator - June 18, 2018, 8:26 p.m.
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




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

Patch

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)