diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -418,6 +418,7 @@ class hgsubrepo(abstractsubrepo): % (inst, subrelpath(self))) def archive(self, ui, archiver, prefix): + self._get(self._state + ('hg',)) abstractsubrepo.archive(self, ui, archiver, prefix) rev = self._state[1] 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 @@ -304,6 +304,47 @@ Test archiving to zip file (unzip output archiving (foo/bar) [================================>] 1/1 \r (esc) +Test archiving a revision that references a subrepo that is not yet +cloned: + + $ hg clone -U . ../empty + $ cd ../empty + $ hg archive --subrepos -r tip ../archive.tar.gz 2>&1 | $TESTDIR/filtercr.py + + archiving [ ] 0/3 + archiving [ ] 0/3 + archiving [=============> ] 1/3 + archiving [=============> ] 1/3 + archiving [===========================> ] 2/3 + archiving [===========================> ] 2/3 + archiving [==========================================>] 3/3 + archiving [==========================================>] 3/3 + + archiving (foo) [ ] 0/3 + archiving (foo) [ ] 0/3 + archiving (foo) [===========> ] 1/3 + archiving (foo) [===========> ] 1/3 + archiving (foo) [=======================> ] 2/3 + archiving (foo) [=======================> ] 2/3 + archiving (foo) [====================================>] 3/3 + archiving (foo) [====================================>] 3/3 + + archiving (foo/bar) [ ] 0/1 + archiving (foo/bar) [ ] 0/1 + archiving (foo/bar) [================================>] 1/1 + archiving (foo/bar) [================================>] 1/1 + + cloning subrepo foo from $TESTTMP/repo/foo + cloning subrepo foo/bar from $TESTTMP/repo/foo/bar + +The newly cloned subrepos contain no working copy: + + $ hg -R foo summary + parent: -1:000000000000 (no revision checked out) + branch: default + commit: (clean) + update: 4 new changesets (update) + Disable progress extension and cleanup: $ mv $HGRCPATH.no-progress $HGRCPATH