# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 2012-09-23 04:08:13
# Node ID 75f25bd4c7d43cce38b9da91aa17b8f685adc79c
# Parent  e4ed5638bc55324c1008729cfb9ac7a207931d73

largefiles: download missing subrepo revs when archiving

This is something plain hgsubrepos already do.  Previously, an abort message
complained about an unknown revision.

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -841,6 +841,7 @@ def overridearchive(orig, repo, dest, no
     archiver.done()
 
 def hgsubrepoarchive(orig, repo, ui, archiver, prefix, match=None):
+    repo._get(repo._state + ('hg',))
     rev = repo._state[1]
     ctx = repo._repo[rev]
 
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -1582,6 +1582,14 @@ Lock in subrepo, otherwise the change is
   lf_subrepo_archive/subrepo/large.txt
   lf_subrepo_archive/subrepo/normal.txt
 
+Test archiving a revision that references a subrepo that is not yet
+cloned (see test-subrepo-recursion.t):
+
+  $ hg clone -U . ../empty
+  $ cd ../empty
+  $ hg archive --subrepos -r tip ../archive.tar.gz 2>&1 | "$TESTDIR/filtercr.py"
+  cloning subrepo subrepo from $TESTTMP/statusmatch/subrepo
+  
   $ cd ..
 
 Test that addremove picks up largefiles prior to the initial commit (issue3541)