# HG changeset patch # User Martin Geisler # Date 2011-10-17 16:01:38 # Node ID b3e19c355ca72e682fe7763165b844e453daf083 # Parent 4be845e3932cff65d62cd6b99ae40ba30e0f9f28 subrepo: abort in hgsubrepo._get if the destination is obstructed Before, we deleted foo when we determined that there were zero changesets in the foo subrepo. Any files in foo was deleted too. We now delete foo/.hg instead, and the normal checks in hg.clone will then abort if there are untracked files in foo. diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -467,7 +467,7 @@ class hgsubrepo(abstractsubrepo): self._repo.ui.status(_('cloning subrepo %s from %s\n') % (subrelpath(self), srcurl)) parentrepo = self._repo._subparent - shutil.rmtree(self._repo.root) + shutil.rmtree(self._repo.path) other, self._repo = hg.clone(self._repo._subparent.ui, {}, other, self._repo.root, update=False) self._initrepo(parentrepo, source, create=True) diff --git a/tests/test-subrepo-recursion.t b/tests/test-subrepo-recursion.t --- a/tests/test-subrepo-recursion.t +++ b/tests/test-subrepo-recursion.t @@ -349,6 +349,18 @@ Disable progress extension and cleanup: $ mv $HGRCPATH.no-progress $HGRCPATH +Test archiving when there is a directory in the way for a subrepo +created by archive: + + $ hg clone -U . ../almost-empty + $ cd ../almost-empty + $ mkdir foo + $ echo f > foo/f + $ hg archive --subrepos -r tip archive + cloning subrepo foo from $TESTTMP/empty/foo + abort: destination '$TESTTMP/almost-empty/foo' is not empty + [255] + Clone and test outgoing: $ cd ..