##// END OF EJS Templates
merge: separate worker functions for batch remove and batch get...
Mads Kiilerich -
r21392:b1ce47da default
parent child Browse files
Show More
@@ -577,23 +577,19 b' actionpriority = dict((m, p) for p, m in'
577 577 def actionkey(a):
578 578 return actionpriority[a[1]], a
579 579
580 def getremove(repo, mctx, overwrite, args):
581 """apply usually-non-interactive updates to the working directory
582
583 mctx is the context to be merged into the working copy
580 def batchremove(repo, actions):
581 """apply removes to the working directory
584 582
585 583 yields tuples for progress updates
586 584 """
587 585 verbose = repo.ui.verbose
588 586 unlink = util.unlinkpath
589 587 wjoin = repo.wjoin
590 fctx = mctx.filectx
591 wwrite = repo.wwrite
592 588 audit = repo.wopener.audit
593 589 i = 0
594 for f, m, args, msg in args:
595 repo.ui.debug(" %s: %s -> %s\n" % (f, msg, m))
596 if m == 'r':
590 for f, m, args, msg in actions:
591 repo.ui.debug(" %s: %s -> r\n" % (f, msg))
592 if True:
597 593 if verbose:
598 594 repo.ui.note(_("removing %s\n") % f)
599 595 audit(f)
@@ -602,7 +598,27 b' def getremove(repo, mctx, overwrite, arg'
602 598 except OSError, inst:
603 599 repo.ui.warn(_("update failed to remove %s: %s!\n") %
604 600 (f, inst.strerror))
605 else:
601 if i == 100:
602 yield i, f
603 i = 0
604 i += 1
605 if i > 0:
606 yield i, f
607
608 def batchget(repo, mctx, actions):
609 """apply gets to the working directory
610
611 mctx is the context to get from
612
613 yields tuples for progress updates
614 """
615 verbose = repo.ui.verbose
616 fctx = mctx.filectx
617 wwrite = repo.wwrite
618 i = 0
619 for f, m, args, msg in actions:
620 repo.ui.debug(" %s: %s -> g\n" % (f, msg))
621 if True:
606 622 if verbose:
607 623 repo.ui.note(_("getting %s\n") % f)
608 624 wwrite(f, fctx(f).data(), args[0])
@@ -674,15 +690,13 b' def applyupdates(repo, actions, wctx, mc'
674 690
675 691 # remove in parallel (must come first)
676 692 z = 0
677 prog = worker.worker(repo.ui, 0.001, getremove, (repo, mctx, overwrite),
678 removeactions)
693 prog = worker.worker(repo.ui, 0.001, batchremove, (repo,), removeactions)
679 694 for i, item in prog:
680 695 z += i
681 696 progress(_updating, z, item=item, total=numupdates, unit=_files)
682 697
683 698 # get in parallel
684 prog = worker.worker(repo.ui, 0.001, getremove, (repo, mctx, overwrite),
685 updateactions)
699 prog = worker.worker(repo.ui, 0.001, batchget, (repo, mctx), updateactions)
686 700 for i, item in prog:
687 701 z += i
688 702 progress(_updating, z, item=item, total=numupdates, unit=_files)
General Comments 0
You need to be logged in to leave comments. Login now