Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/merge.py @ 19095:5cc71484ee9c stable
merge: increase safety of parallel updating/removing on icasefs
"merge.applyupdates()" sorts "actions" in removal first order, and
"workeractions" derived from it should be also sorted.
If each actions in "workeractions" are executed in serial, this
sorting ensures that merging/updating process is collision free,
because updating the file in target context is always executed after
removing the existing file which causes case-folding collision against
the former.
In the other hand, if each actions are executed in parallel, updating
on a worker process may be executed before removing on another worker
process, because "worker.partition()" partitions list of actions
regardless of type of each actions.
This patch divides "workeractions" into removing and updating, and
executes the former first.
This patch still scans "actions"/"workeractions" some times for ease
of patch review, even though large list may cost much in this way.
(total cost should be as same as before)
This also changes some tests, because dividing "workeractions" affects
progress indication.
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Mon, 29 Apr 2013 15:58:15 +0900 |
parents | a59e575c6ff8 |
children | c60a7f5a741f |
comparison
equal
deleted
inserted
replaced
19094:fc1b77db123f | 19095:5cc71484ee9c |
---|---|
453 audit(f) | 453 audit(f) |
454 util.unlinkpath(repo.wjoin(f)) | 454 util.unlinkpath(repo.wjoin(f)) |
455 | 455 |
456 numupdates = len(actions) | 456 numupdates = len(actions) |
457 workeractions = [a for a in actions if a[1] in 'gr'] | 457 workeractions = [a for a in actions if a[1] in 'gr'] |
458 updated = len([a for a in workeractions if a[1] == 'g']) | 458 updateactions = [a for a in workeractions if a[1] == 'g'] |
459 removed = len([a for a in workeractions if a[1] == 'r']) | 459 updated = len(updateactions) |
460 removeactions = [a for a in workeractions if a[1] == 'r'] | |
461 removed = len(removeactions) | |
460 actions = [a for a in actions if a[1] not in 'gr'] | 462 actions = [a for a in actions if a[1] not in 'gr'] |
461 | 463 |
462 hgsub = [a[1] for a in workeractions if a[0] == '.hgsubstate'] | 464 hgsub = [a[1] for a in workeractions if a[0] == '.hgsubstate'] |
463 if hgsub and hgsub[0] == 'r': | 465 if hgsub and hgsub[0] == 'r': |
464 subrepo.submerge(repo, wctx, mctx, wctx, overwrite) | 466 subrepo.submerge(repo, wctx, mctx, wctx, overwrite) |
465 | 467 |
466 z = 0 | 468 z = 0 |
467 prog = worker.worker(repo.ui, 0.001, getremove, (repo, mctx, overwrite), | 469 prog = worker.worker(repo.ui, 0.001, getremove, (repo, mctx, overwrite), |
468 workeractions) | 470 removeactions) |
471 for i, item in prog: | |
472 z += i | |
473 repo.ui.progress(_('updating'), z, item=item, total=numupdates, | |
474 unit=_('files')) | |
475 prog = worker.worker(repo.ui, 0.001, getremove, (repo, mctx, overwrite), | |
476 updateactions) | |
469 for i, item in prog: | 477 for i, item in prog: |
470 z += i | 478 z += i |
471 repo.ui.progress(_('updating'), z, item=item, total=numupdates, | 479 repo.ui.progress(_('updating'), z, item=item, total=numupdates, |
472 unit=_('files')) | 480 unit=_('files')) |
473 | 481 |