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.
--- 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)
--- 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 ..