Mercurial > hg
comparison hgext/fix.py @ 38537:a3be09e277e9
fix: add progress bar for number of file revisions processed
This ensures responsiveness when the configured tools are slow or numerous.
Differential Revision: https://phab.mercurial-scm.org/D3848
author | Danny Hooper <hooper@google.com> |
---|---|
date | Tue, 26 Jun 2018 16:29:55 -0700 |
parents | 5ffe2041d427 |
children | f068495a1c28 |
comparison
equal
deleted
inserted
replaced
38536:5ffe2041d427 | 38537:a3be09e277e9 |
---|---|
160 # the tests deterministic. It might also be considered a feature since | 160 # the tests deterministic. It might also be considered a feature since |
161 # it makes the results more easily reproducible. | 161 # it makes the results more easily reproducible. |
162 filedata = collections.defaultdict(dict) | 162 filedata = collections.defaultdict(dict) |
163 replacements = {} | 163 replacements = {} |
164 commitorder = sorted(revstofix, reverse=True) | 164 commitorder = sorted(revstofix, reverse=True) |
165 for rev, path, newdata in results: | 165 with ui.makeprogress(topic=_('fixing'), unit=_('files'), |
166 if newdata is not None: | 166 total=sum(numitems.values())) as progress: |
167 filedata[rev][path] = newdata | 167 for rev, path, newdata in results: |
168 numitems[rev] -= 1 | 168 progress.increment(item=path) |
169 # Apply the fixes for this and any other revisions that are ready | 169 if newdata is not None: |
170 # and sitting at the front of the queue. Using a loop here prevents | 170 filedata[rev][path] = newdata |
171 # the queue from being blocked by the first revision to be ready out | 171 numitems[rev] -= 1 |
172 # of order. | 172 # Apply the fixes for this and any other revisions that are |
173 while commitorder and not numitems[commitorder[-1]]: | 173 # ready and sitting at the front of the queue. Using a loop here |
174 rev = commitorder.pop() | 174 # prevents the queue from being blocked by the first revision to |
175 ctx = repo[rev] | 175 # be ready out of order. |
176 if rev == wdirrev: | 176 while commitorder and not numitems[commitorder[-1]]: |
177 writeworkingdir(repo, ctx, filedata[rev], replacements) | 177 rev = commitorder.pop() |
178 else: | 178 ctx = repo[rev] |
179 replacerev(ui, repo, ctx, filedata[rev], replacements) | 179 if rev == wdirrev: |
180 del filedata[rev] | 180 writeworkingdir(repo, ctx, filedata[rev], replacements) |
181 else: | |
182 replacerev(ui, repo, ctx, filedata[rev], replacements) | |
183 del filedata[rev] | |
181 | 184 |
182 replacements = {prec: [succ] for prec, succ in replacements.iteritems()} | 185 replacements = {prec: [succ] for prec, succ in replacements.iteritems()} |
183 scmutil.cleanupnodes(repo, replacements, 'fix', fixphase=True) | 186 scmutil.cleanupnodes(repo, replacements, 'fix', fixphase=True) |
184 | 187 |
185 def getworkqueue(ui, repo, pats, opts, revstofix, basectxs): | 188 def getworkqueue(ui, repo, pats, opts, revstofix, basectxs): |