Patchwork D3809: synthrepo: use progress helper

login
register
mail settings
Submitter phabricator
Date June 19, 2018, 11:18 a.m.
Message ID <ff6f65f4168e14ca6441718432f0a915@localhost.localdomain>
Download mbox | patch
Permalink /patch/32325/
State Not Applicable
Headers show

Comments

phabricator - June 19, 2018, 11:18 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6540333acb95: synthrepo: use progress helper (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3809?vs=9211&id=9225

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

AFFECTED FILES
  contrib/synthrepo.py

CHANGE DETAILS




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

Patch

diff --git a/contrib/synthrepo.py b/contrib/synthrepo.py
--- a/contrib/synthrepo.py
+++ b/contrib/synthrepo.py
@@ -172,13 +172,10 @@ 
         revs = scmutil.revrange(repo, revs)
         revs.sort()
 
-        progress = ui.progress
-        _analyzing = _('analyzing')
-        _changesets = _('changesets')
-        _total = len(revs)
-
+        progress = ui.makeprogress(_('analyzing'), unit=_('changesets'),
+                                   total=len(revs))
         for i, rev in enumerate(revs):
-            progress(_analyzing, i, unit=_changesets, total=_total)
+            progress.update(i)
             ctx = repo[rev]
             pl = ctx.parents()
             pctx = pl[0]
@@ -338,7 +335,6 @@ 
 
     nevertouch = {'.hgsub', '.hgignore', '.hgtags'}
 
-    progress = ui.progress
     _synthesizing = _('synthesizing')
     _files = _('initial files')
     _changesets = _('changesets')
@@ -362,8 +358,9 @@ 
                 path = os.path.dirname(path)
             return True
 
+        progress = ui.makeprogress(_synthesizing, unit=_files, total=initcount)
         for i in xrange(0, initcount):
-            ui.progress(_synthesizing, i, unit=_files, total=initcount)
+            progress.update(i)
 
             path = pickpath()
             while not validpath(path):
@@ -378,7 +375,7 @@ 
         def filectxfn(repo, memctx, path):
             return context.memfilectx(repo, memctx, path, files[path])
 
-        ui.progress(_synthesizing, None)
+        progress.complete()
         message = 'synthesized wide repo with %d files' % (len(files),)
         mc = context.memctx(repo, [pctx.node(), nullid], message,
                             files, filectxfn, ui.username(),
@@ -394,8 +391,9 @@ 
     # Synthesize incremental revisions to the repository, adding repo depth.
     count = int(opts['count'])
     heads = set(map(repo.changelog.rev, repo.heads()))
+    progress = ui.makeprogress(_synthesizing, unit=_changesets, total=count)
     for i in xrange(count):
-        progress(_synthesizing, i, unit=_changesets, total=count)
+        progress.update(i)
 
         node = repo.changelog.node
         revs = len(repo)