Patchwork D3782: archival: use progress helper

login
register
mail settings
Submitter phabricator
Date June 18, 2018, 7:05 a.m.
Message ID <differential-rev-PHID-DREV-k6eloos5bbth4rjwn4jy-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/32240/
State Superseded
Headers show

Comments

phabricator - June 18, 2018, 7:05 a.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/archival.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/archival.py b/mercurial/archival.py
--- a/mercurial/archival.py
+++ b/mercurial/archival.py
@@ -322,13 +322,14 @@ 
         files.sort()
         scmutil.prefetchfiles(repo, [ctx.rev()],
                               scmutil.matchfiles(repo, files))
-        repo.ui.progress(_('archiving'), 0, unit=_('files'), total=total)
-        for i, f in enumerate(files):
+        progress = scmutil.progress(repo.ui, _('archiving'), unit=_('files'),
+                                    total=total)
+        progress.update(0)
+        for f in files:
             ff = ctx.flags(f)
             write(f, 'x' in ff and 0o755 or 0o644, 'l' in ff, ctx[f].data)
-            repo.ui.progress(_('archiving'), i + 1, item=f,
-                             unit=_('files'), total=total)
-        repo.ui.progress(_('archiving'), None)
+            progress.increment(item=f)
+        progress.complete()
 
     if subrepos:
         for subpath in sorted(ctx.substate):