# HG changeset patch # User Martin Geisler # Date 1318867298 -7200 # 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 -r 4be845e3932c -r b3e19c355ca7 mercurial/subrepo.py --- a/mercurial/subrepo.py Mon Oct 17 16:45:19 2011 +0200 +++ b/mercurial/subrepo.py Mon Oct 17 18:01:38 2011 +0200 @@ -467,7 +467,7 @@ 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 -r 4be845e3932c -r b3e19c355ca7 tests/test-subrepo-recursion.t --- a/tests/test-subrepo-recursion.t Mon Oct 17 16:45:19 2011 +0200 +++ b/tests/test-subrepo-recursion.t Mon Oct 17 18:01:38 2011 +0200 @@ -349,6 +349,18 @@ $ 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 ..