Mercurial > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/hg.py Wed Oct 31 03:59:28 2012 +0900 +++ b/mercurial/hg.py Wed Oct 24 18:45:22 2012 +0200 @@ -459,9 +459,17 @@ repo.ui.status(_("%d files updated, %d files merged, " "%d files removed, %d files unresolved\n") % stats) +def updaterepo(repo, node, overwrite): + """Update the working directory to node. + + When overwrite is set, changes are clobbered, merged else + + returns stats (see pydoc mercurial.merge.applyupdates)""" + return mergemod.update(repo, node, False, overwrite, None) + def update(repo, node): """update the working directory to node, merging linear changes""" - stats = mergemod.update(repo, node, False, False, None) + stats = updaterepo(repo, node, False) _showstats(repo, stats) if stats[3]: repo.ui.status(_("use 'hg resolve' to retry unresolved file merges\n")) @@ -472,7 +480,7 @@ def clean(repo, node, show_stats=True): """forcibly switch the working directory to node, clobbering changes""" - stats = mergemod.update(repo, node, False, True, None) + stats = updaterepo(repo, node, True) if show_stats: _showstats(repo, stats) return stats[3] > 0