changeset 40857:dd1006874a5a

fastannotate: use progress helper Differential Revision: https://phab.mercurial-scm.org/D5374
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 04 Dec 2018 15:59:47 -0800
parents 901f6ef670ca
children 05afb32e9380
files hgext/fastannotate/context.py
diffstat 1 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/fastannotate/context.py	Tue Dec 04 15:57:11 2018 -0800
+++ b/hgext/fastannotate/context.py	Tue Dec 04 15:59:47 2018 -0800
@@ -398,7 +398,8 @@
 
         # 3rd DFS does the actual annotate
         visit = initvisit[:]
-        progress = 0
+        progress = self.ui.makeprogress(('building cache'),
+                                        total=len(newmainbranch))
         while visit:
             f = visit[-1]
             if f in hist:
@@ -437,10 +438,7 @@
             del pcache[f]
 
             if ismainbranch: # need to write to linelog
-                if not self.ui.quiet:
-                    progress += 1
-                    self.ui.progress(_('building cache'), progress,
-                                     total=len(newmainbranch))
+                progress.increment()
                 bannotated = None
                 if len(pl) == 2 and self.opts.followmerge: # merge
                     bannotated = curr[0]
@@ -450,8 +448,7 @@
             elif showpath: # not append linelog, but we need to record path
                 self._node2path[f.node()] = f.path()
 
-        if progress: # clean progress bar
-            self.ui.write()
+        progress.complete()
 
         result = [
             ((self.revmap.rev2hsh(fr) if isinstance(fr, int) else fr.node()), l)