progress: hide update(None) in a new complete() method
update(None) seemed a bit cryptic.
Differential Revision: https://phab.mercurial-scm.org/D3774
--- a/mercurial/changegroup.py Sat Jun 16 08:22:10 2018 +0530
+++ b/mercurial/changegroup.py Sun Jun 17 22:13:41 2018 -0700
@@ -246,7 +246,7 @@
self.manifestheader()
deltas = self.deltaiter()
repo.manifestlog._revlog.addgroup(deltas, revmap, trp)
- prog.update(None)
+ prog.complete()
self.callback = None
def apply(self, repo, tr, srctype, url, targetphase=phases.draft,
@@ -309,7 +309,7 @@
config='warn-empty-changegroup')
clend = len(cl)
changesets = clend - clstart
- progress.update(None)
+ progress.complete()
self.callback = None
# pull off the manifest group
--- a/mercurial/cmdutil.py Sat Jun 16 08:22:10 2018 +0530
+++ b/mercurial/cmdutil.py Sun Jun 17 22:13:41 2018 -0700
@@ -2195,7 +2195,7 @@
except error.LookupError:
warnings.append(_("skipping missing subrepository: %s\n")
% join(subpath))
- progress.update(None)
+ progress.complete()
# warn about failure to delete explicit files/dirs
deleteddirs = util.dirs(deleted)
@@ -2224,7 +2224,7 @@
% m.rel(f))
# missing files will generate a warning elsewhere
ret = 1
- progress.update(None)
+ progress.complete()
if force:
list = modified + deleted + clean + added
@@ -2239,7 +2239,7 @@
warnings.append(_('not removing %s: file still exists\n')
% m.rel(f))
ret = 1
- progress.update(None)
+ progress.complete()
else:
list = deleted + clean
progress = ui.makeprogress(_('skipping'),
@@ -2255,7 +2255,7 @@
warnings.append(_("not removing %s: file has been marked for add"
" (use 'hg forget' to undo add)\n") % m.rel(f))
ret = 1
- progress.update(None)
+ progress.complete()
list = sorted(list)
progress = ui.makeprogress(_('deleting'), total=len(list),
@@ -2264,7 +2264,7 @@
if ui.verbose or not m.exact(f):
progress.increment()
ui.status(_('removing %s\n') % m.rel(f))
- progress.update(None)
+ progress.complete()
if not dryrun:
with repo.wlock():
--- a/mercurial/merge.py Sat Jun 16 08:22:10 2018 +0530
+++ b/mercurial/merge.py Sun Jun 17 22:13:41 2018 -0700
@@ -1785,7 +1785,7 @@
actions[ACTION_MERGE] = [a for a in actions[ACTION_MERGE]
if a[0] in mfiles]
- progress.update(None)
+ progress.complete()
return updateresult(updated, merged, removed, unresolved)
def recordupdates(repo, actions, branchmerge):
--- a/mercurial/scmutil.py Sat Jun 16 08:22:10 2018 +0530
+++ b/mercurial/scmutil.py Sun Jun 17 22:13:41 2018 -0700
@@ -1302,6 +1302,9 @@
def increment(self, step=1, item="", total=None):
self.update(self.pos + step, item, total)
+ def complete(self):
+ self.update(None)
+
def _print(self, item):
self.ui.progress(self.topic, self.pos, item, self.unit,
self.total)
--- a/mercurial/setdiscovery.py Sat Jun 16 08:22:10 2018 +0530
+++ b/mercurial/setdiscovery.py Sun Jun 17 22:13:41 2018 -0700
@@ -252,7 +252,7 @@
# return any heads in that case, so discard that
result.discard(nullrev)
elapsed = util.timer() - start
- progress.update(None)
+ progress.complete()
ui.debug("%d total queries in %.4fs\n" % (roundtrips, elapsed))
msg = ('found %d common and %d unknown server heads,'
' %d roundtrips in %.4fs\n')
--- a/mercurial/similar.py Sat Jun 16 08:22:10 2018 +0530
+++ b/mercurial/similar.py Sun Jun 17 22:13:41 2018 -0700
@@ -44,7 +44,7 @@
break
# Done
- progress.update(None)
+ progress.complete()
def _ctxdata(fctx):
# lazily load text
--- a/mercurial/streamclone.py Sat Jun 16 08:22:10 2018 +0530
+++ b/mercurial/streamclone.py Sun Jun 17 22:13:41 2018 -0700
@@ -321,7 +321,7 @@
progress.increment(step=len(chunk))
yield chunk
- progress.update(None)
+ progress.complete()
return requirements, gen()
@@ -384,7 +384,7 @@
elapsed = util.timer() - start
if elapsed <= 0:
elapsed = 0.001
- progress.update(None)
+ progress.complete()
repo.ui.status(_('transferred %s in %.1f seconds (%s/sec)\n') %
(util.bytecount(bytecount), elapsed,
util.bytecount(bytecount / elapsed)))
@@ -526,7 +526,7 @@
finally:
fp.close()
finally:
- progress.update(None)
+ progress.complete()
def generatev2(repo):
"""Emit content for version 2 of a streaming clone.
@@ -624,7 +624,7 @@
repo.ui.status(_('transferred %s in %.1f seconds (%s/sec)\n') %
(util.bytecount(progress.pos), elapsed,
util.bytecount(progress.pos / elapsed)))
- progress.update(None)
+ progress.complete()
def applybundlev2(repo, fp, filecount, filesize, requirements):
missingreqs = [r for r in requirements if r not in repo.supported]