Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/merge.py @ 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 | 5774732bb5e5 |
comparison
equal
deleted
inserted
replaced
18632:3e20079117c5 | 18633:6390dd22b12f |
---|---|
348 mctx is the context to be merged into the working copy | 348 mctx is the context to be merged into the working copy |
349 | 349 |
350 yields tuples for progress updates | 350 yields tuples for progress updates |
351 """ | 351 """ |
352 audit = repo.wopener.audit | 352 audit = repo.wopener.audit |
353 for i, arg in enumerate(args): | 353 i = 0 |
354 for arg in args: | |
354 f = arg[0] | 355 f = arg[0] |
355 if arg[1] == 'r': | 356 if arg[1] == 'r': |
356 repo.ui.note(_("removing %s\n") % f) | 357 repo.ui.note(_("removing %s\n") % f) |
357 audit(f) | 358 audit(f) |
358 try: | 359 try: |
361 repo.ui.warn(_("update failed to remove %s: %s!\n") % | 362 repo.ui.warn(_("update failed to remove %s: %s!\n") % |
362 (f, inst.strerror)) | 363 (f, inst.strerror)) |
363 else: | 364 else: |
364 repo.ui.note(_("getting %s\n") % f) | 365 repo.ui.note(_("getting %s\n") % f) |
365 repo.wwrite(f, mctx.filectx(f).data(), arg[2][0]) | 366 repo.wwrite(f, mctx.filectx(f).data(), arg[2][0]) |
367 if i == 100: | |
368 yield i, f | |
369 i = 0 | |
370 i += 1 | |
371 if i > 0: | |
366 yield i, f | 372 yield i, f |
367 | 373 |
368 def applyupdates(repo, actions, wctx, mctx, actx, overwrite): | 374 def applyupdates(repo, actions, wctx, mctx, actx, overwrite): |
369 """apply the merge action list to the working directory | 375 """apply the merge action list to the working directory |
370 | 376 |
423 | 429 |
424 hgsub = [a[1] for a in workeractions if a[0] == '.hgsubstate'] | 430 hgsub = [a[1] for a in workeractions if a[0] == '.hgsubstate'] |
425 if hgsub and hgsub[0] == 'r': | 431 if hgsub and hgsub[0] == 'r': |
426 subrepo.submerge(repo, wctx, mctx, wctx, overwrite) | 432 subrepo.submerge(repo, wctx, mctx, wctx, overwrite) |
427 | 433 |
434 z = 0 | |
428 for i, item in getremove(repo, mctx, overwrite, workeractions): | 435 for i, item in getremove(repo, mctx, overwrite, workeractions): |
429 repo.ui.progress(_('updating'), i + 1, item=item, total=numupdates, | 436 z += i |
437 repo.ui.progress(_('updating'), z, item=item, total=numupdates, | |
430 unit=_('files')) | 438 unit=_('files')) |
431 | 439 |
432 if hgsub and hgsub[0] == 'g': | 440 if hgsub and hgsub[0] == 'g': |
433 subrepo.submerge(repo, wctx, mctx, wctx, overwrite) | 441 subrepo.submerge(repo, wctx, mctx, wctx, overwrite) |
434 | |
435 z = len(workeractions) | |
436 | 442 |
437 for i, a in enumerate(actions): | 443 for i, a in enumerate(actions): |
438 f, m, args, msg = a | 444 f, m, args, msg = a |
439 repo.ui.progress(_('updating'), z + i + 1, item=f, total=numupdates, | 445 repo.ui.progress(_('updating'), z + i + 1, item=f, total=numupdates, |
440 unit=_('files')) | 446 unit=_('files')) |