Mercurial > hg-stable
changeset 38402:0ddbe03c5aaa
verify: use progress helper for subdirectory progress
I also reworded a variable to make it clearer that it's only used for
subdirectories.
Differential Revision: https://phab.mercurial-scm.org/D3797
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Sun, 17 Jun 2018 23:35:49 -0700 |
parents | 59c9d3cc810f |
children | 1249475f0bd6 |
files | mercurial/verify.py |
diffstat | 1 files changed, 7 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/verify.py Sun Jun 17 23:17:03 2018 -0700 +++ b/mercurial/verify.py Sun Jun 17 23:35:49 2018 -0700 @@ -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)