Patchwork D3848: fix: add progress bar for number of file revisions processed

login
register
mail settings
Submitter phabricator
Date July 4, 2018, 12:04 p.m.
Message ID <514508345523d04a0936f75f24ed210d@localhost.localdomain>
Download mbox | patch
Permalink /patch/32611/
State Not Applicable
Headers show

Comments

phabricator - July 4, 2018, 12:04 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc8961e9b2f5e: fix: add progress bar for number of file revisions processed (authored by hooper, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3848?vs=9368&id=9432

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

AFFECTED FILES
  hgext/fix.py

CHANGE DETAILS




To: hooper, #hg-reviewers, durin42
Cc: mercurial-devel

Patch

diff --git a/hgext/fix.py b/hgext/fix.py
--- a/hgext/fix.py
+++ b/hgext/fix.py
@@ -162,22 +162,25 @@ 
         filedata = collections.defaultdict(dict)
         replacements = {}
         commitorder = sorted(revstofix, reverse=True)
-        for rev, path, newdata in results:
-            if newdata is not None:
-                filedata[rev][path] = newdata
-            numitems[rev] -= 1
-            # Apply the fixes for this and any other revisions that are ready
-            # and sitting at the front of the queue. Using a loop here prevents
-            # the queue from being blocked by the first revision to be ready out
-            # of order.
-            while commitorder and not numitems[commitorder[-1]]:
-                rev = commitorder.pop()
-                ctx = repo[rev]
-                if rev == wdirrev:
-                    writeworkingdir(repo, ctx, filedata[rev], replacements)
-                else:
-                    replacerev(ui, repo, ctx, filedata[rev], replacements)
-                del filedata[rev]
+        with ui.makeprogress(topic=_('fixing'), unit=_('files'),
+                             total=sum(numitems.values())) as progress:
+            for rev, path, newdata in results:
+                progress.increment(item=path)
+                if newdata is not None:
+                    filedata[rev][path] = newdata
+                numitems[rev] -= 1
+                # Apply the fixes for this and any other revisions that are
+                # ready and sitting at the front of the queue. Using a loop here
+                # prevents the queue from being blocked by the first revision to
+                # be ready out of order.
+                while commitorder and not numitems[commitorder[-1]]:
+                    rev = commitorder.pop()
+                    ctx = repo[rev]
+                    if rev == wdirrev:
+                        writeworkingdir(repo, ctx, filedata[rev], replacements)
+                    else:
+                        replacerev(ui, repo, ctx, filedata[rev], replacements)
+                    del filedata[rev]
 
         replacements = {prec: [succ] for prec, succ in replacements.iteritems()}
         scmutil.cleanupnodes(repo, replacements, 'fix', fixphase=True)