Patchwork D3774: progress: hide update(None) in a new complete() method

login
register
mail settings
Submitter phabricator
Date June 18, 2018, 2:24 p.m.
Message ID <35f7f64978755037461b4c007f195418@localhost.localdomain>
Download mbox | patch
Permalink /patch/32289/
State Not Applicable
Headers show

Comments

phabricator - June 18, 2018, 2:24 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGef692614e601: progress: hide update(None) in a new complete() method (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3774?vs=9145&id=9178

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

AFFECTED FILES
  mercurial/changegroup.py
  mercurial/cmdutil.py
  mercurial/merge.py
  mercurial/scmutil.py
  mercurial/setdiscovery.py
  mercurial/similar.py
  mercurial/streamclone.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py
--- a/mercurial/streamclone.py
+++ b/mercurial/streamclone.py
@@ -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]
diff --git a/mercurial/similar.py b/mercurial/similar.py
--- a/mercurial/similar.py
+++ b/mercurial/similar.py
@@ -44,7 +44,7 @@ 
                 break
 
     # Done
-    progress.update(None)
+    progress.complete()
 
 def _ctxdata(fctx):
     # lazily load text
diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -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')
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -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)
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -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):
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -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,16 +2255,16 @@ 
             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),
                                unit=_('files'))
     for f in list:
         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():
diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -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