changeset 38381:1a2ff11e8a88

archival: use progress helper Differential Revision: https://phab.mercurial-scm.org/D3782
author Martin von Zweigbergk <martinvonz@google.com>
date Sun, 17 Jun 2018 23:00:59 -0700
parents 63e6f5ae84bc
children daa08d45740f
files mercurial/archival.py
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/archival.py	Sun Jun 17 22:57:34 2018 -0700
+++ b/mercurial/archival.py	Sun Jun 17 23:00:59 2018 -0700
@@ -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):