##// END OF EJS Templates
subrepo: only do clean update when overwrite is set (issue3276)...
Simon Heimberg -
r17895:17c03001 stable
parent child Browse files
Show More
@@ -459,9 +459,17 b' 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"))
@@ -472,7 +480,7 b' def update(repo, node):'
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
@@ -523,7 +523,7 b' class hgsubrepo(abstractsubrepo):'
523 self._get(state)
523 self._get(state)
524 source, revision, kind = state
524 source, revision, kind = state
525 self._repo.ui.debug("getting subrepo %s\n" % self._path)
525 self._repo.ui.debug("getting subrepo %s\n" % self._path)
526 hg.clean(self._repo, revision, False)
526 hg.updaterepo(self._repo, revision, overwrite)
527
527
528 def merge(self, state):
528 def merge(self, state):
529 self._get(state)
529 self._get(state)
@@ -210,9 +210,10 b' merge tests'
210 subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec
210 subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec
211 subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg
211 subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg
212 getting subrepo t
212 getting subrepo t
213 searching for copies back to rev 1
213 resolving manifests
214 resolving manifests
214 overwrite: True, partial: False
215 overwrite: False, partial: False
215 ancestor: 60ca1237c194+, local: 60ca1237c194+, remote: 6747d179aa9a
216 ancestor: 60ca1237c194, local: 60ca1237c194+, remote: 6747d179aa9a
216 t: remote is newer -> g
217 t: remote is newer -> g
217 updating: t 1/1 files (100.00%)
218 updating: t 1/1 files (100.00%)
218 getting t
219 getting t
@@ -580,16 +581,37 b' Issue1977: multirepo push should fail if'
580 $ hg -q -R repo2/s push
581 $ hg -q -R repo2/s push
581 $ hg -R repo2/s up -C 0
582 $ hg -R repo2/s up -C 0
582 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
583 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
583 $ echo 2 > repo2/s/a
584 $ echo 2 > repo2/s/b
584 $ hg -R repo2/s ci -m3
585 $ hg -R repo2/s ci -m3 -A
586 adding b
585 created new head
587 created new head
586 $ hg -R repo2 ci -m3
588 $ hg -R repo2 ci -m3
587 $ hg -q -R repo2 push
589 $ hg -q -R repo2 push
588 abort: push creates new remote head 9d66565e64e1!
590 abort: push creates new remote head cc505f09a8b2!
589 (did you forget to merge? use push -f to force)
591 (did you forget to merge? use push -f to force)
590 [255]
592 [255]
591 $ hg -R repo update
593 $ hg -R repo update
592 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
594 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
595
596 test if untracked file is not overwritten
597
598 $ echo issue3276_ok > repo/s/b
599 $ hg -R repo2 push -f -q
600 $ hg -R repo update
601 b: untracked file differs
602 abort: untracked files in working directory differ from files in requested revision
603 [255]
604
605 $ cat repo/s/b
606 issue3276_ok
607 $ rm repo/s/b
608 $ hg -R repo revert --all
609 reverting repo/.hgsubstate
610 reverting subrepo s
611 $ hg -R repo update
612 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
613 $ cat repo/s/b
614 2
593 $ rm -rf repo2 repo
615 $ rm -rf repo2 repo
594
616
595
617
General Comments 0
You need to be logged in to leave comments. Login now