Commits

Bryan O'Sullivan committed 6390dd2

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.

  • Participants
  • Parent commits 3e20079

Comments (0)

Files changed (1)

File mercurial/merge.py

     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)
         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):
     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,