Mercurial > public > mercurial-scm > hg
comparison mercurial/hg.py @ 17895:17c030014ddf stable
subrepo: only do clean update when overwrite is set (issue3276)
Files in a subrepo were overwritten on update. But this should only happen on a
clean update (example: -C is specified).
Use the overwrite parameter introduced for svn subrepos in c19b9282d3a7 to
decide whether to merge changes (as update) or remove them (as clean).
The new function hg.updaterepo is intruduced to keep all update calls in hg.
test-subrepo.t is extended to test if an untracked file is overwritten
(issue3276). (Update -C is already tested in many places.)
The first two chunks are debugging output which has changed. (Because overwrite
is not always true anymore for subrepos)
All other tests still pass without any change.
author | Simon Heimberg <simohe@besonet.ch> |
---|---|
date | Wed, 24 Oct 2012 18:45:22 +0200 |
parents | 0e2846b2482c |
children | 47fb48060e36 |
comparison
equal
deleted
inserted
replaced
17894:afa7e6fa820b | 17895:17c030014ddf |
---|---|
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): |