457 |
457 |
458 def _showstats(repo, stats): |
458 def _showstats(repo, stats): |
459 repo.ui.status(_("%d files updated, %d files merged, " |
459 repo.ui.status(_("%d files updated, %d files merged, " |
460 "%d files removed, %d files unresolved\n") % stats) |
460 "%d files removed, %d files unresolved\n") % stats) |
461 |
461 |
|
462 def updaterepo(repo, node, overwrite): |
|
463 """Update the working directory to node. |
|
464 |
|
465 When overwrite is set, changes are clobbered, merged else |
|
466 |
|
467 returns stats (see pydoc mercurial.merge.applyupdates)""" |
|
468 return mergemod.update(repo, node, False, overwrite, None) |
|
469 |
462 def update(repo, node): |
470 def update(repo, node): |
463 """update the working directory to node, merging linear changes""" |
471 """update the working directory to node, merging linear changes""" |
464 stats = mergemod.update(repo, node, False, False, None) |
472 stats = updaterepo(repo, node, False) |
465 _showstats(repo, stats) |
473 _showstats(repo, stats) |
466 if stats[3]: |
474 if stats[3]: |
467 repo.ui.status(_("use 'hg resolve' to retry unresolved file merges\n")) |
475 repo.ui.status(_("use 'hg resolve' to retry unresolved file merges\n")) |
468 return stats[3] > 0 |
476 return stats[3] > 0 |
469 |
477 |
470 # naming conflict in clone() |
478 # naming conflict in clone() |
471 _update = update |
479 _update = update |
472 |
480 |
473 def clean(repo, node, show_stats=True): |
481 def clean(repo, node, show_stats=True): |
474 """forcibly switch the working directory to node, clobbering changes""" |
482 """forcibly switch the working directory to node, clobbering changes""" |
475 stats = mergemod.update(repo, node, False, True, None) |
483 stats = updaterepo(repo, node, True) |
476 if show_stats: |
484 if show_stats: |
477 _showstats(repo, stats) |
485 _showstats(repo, stats) |
478 return stats[3] > 0 |
486 return stats[3] > 0 |
479 |
487 |
480 def merge(repo, node, force=None, remind=True): |
488 def merge(repo, node, force=None, remind=True): |