changeset 18633:6390dd22b12f

merge: report non-interactive progress in chunks Instead of a monotonic count, getupdates yields the number of files it has updated since it last reported, and its caller sums the numbers when updating progress. Once we run these updates in parallel, this will allow worker processes to report progress less often, reducing overhead.
author Bryan O'Sullivan <bryano@fb.com>
date Sat, 09 Feb 2013 15:22:09 -0800
parents 3e20079117c5
children 4b5d37ca3c11
files mercurial/merge.py
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Sat Feb 09 15:22:08 2013 -0800
+++ b/mercurial/merge.py	Sat Feb 09 15:22:09 2013 -0800
@@ -350,7 +350,8 @@
     yields tuples for progress updates
     """
     audit = repo.wopener.audit
-    for i, arg in enumerate(args):
+    i = 0
+    for arg in args:
         f = arg[0]
         if arg[1] == 'r':
             repo.ui.note(_("removing %s\n") % f)
@@ -363,6 +364,11 @@
         else:
             repo.ui.note(_("getting %s\n") % f)
             repo.wwrite(f, mctx.filectx(f).data(), arg[2][0])
+        if i == 100:
+            yield i, f
+            i = 0
+        i += 1
+    if i > 0:
         yield i, f
 
 def applyupdates(repo, actions, wctx, mctx, actx, overwrite):
@@ -425,15 +431,15 @@
     if hgsub and hgsub[0] == 'r':
         subrepo.submerge(repo, wctx, mctx, wctx, overwrite)
 
+    z = 0
     for i, item in getremove(repo, mctx, overwrite, workeractions):
-        repo.ui.progress(_('updating'), i + 1, item=item, total=numupdates,
+        z += i
+        repo.ui.progress(_('updating'), z, item=item, total=numupdates,
                          unit=_('files'))
 
     if hgsub and hgsub[0] == 'g':
         subrepo.submerge(repo, wctx, mctx, wctx, overwrite)
 
-    z = len(workeractions)
-
     for i, a in enumerate(actions):
         f, m, args, msg = a
         repo.ui.progress(_('updating'), z + i + 1, item=f, total=numupdates,