@@ -178,6 +178,12 @@ def close(self):
178
178
self .scm .close ()
179
179
180
180
def fetch_external (self , paths : Iterable , cache , ** kwargs ):
181
+ # `RepoTree` will try downloading it to the repo's cache
182
+ # instead of `cache_dir`, need to change on all instances
183
+ with self .with_cache (cache .cache_dir ):
184
+ return self ._fetch_to_cache (paths , cache , ** kwargs )
185
+
186
+ def _fetch_to_cache (self , paths : Iterable , cache , ** kwargs ):
181
187
"""Fetch specified external repo paths into cache.
182
188
183
189
Returns 3-tuple in the form
@@ -197,14 +203,13 @@ def download_update(result):
197
203
for path in paths :
198
204
if not self .repo_tree .exists (path ):
199
205
raise PathMissingError (path , self .url )
200
- with self .with_cache (cache .cache_dir ):
201
- save_info = cache .save (
202
- path ,
203
- self .repo_tree ,
204
- None ,
205
- save_link = False ,
206
- download_callback = download_update ,
207
- )
206
+ save_info = cache .save (
207
+ path ,
208
+ self .repo_tree ,
209
+ None ,
210
+ save_link = False ,
211
+ download_callback = download_update ,
212
+ )
208
213
save_infos .append (save_info )
209
214
210
215
return sum (download_results ), failed , save_infos
@@ -214,7 +219,7 @@ def get_external(self, src, dest):
214
219
repo = self .in_repo (src )
215
220
if repo :
216
221
cache = repo .cache .local
217
- _ , _ , save_infos = self .fetch_external ([src ], cache )
222
+ _ , _ , save_infos = self ._fetch_to_cache ([src ], cache )
218
223
cache .checkout (PathInfo (dest ), save_infos [0 ])
219
224
else :
220
225
path = PathInfo (self .root_dir ) / src
@@ -233,7 +238,7 @@ def get_checksum(self, path_info, cache):
233
238
return self .repo_tree .get_file_hash (path_info )
234
239
235
240
def in_repo (self , path ):
236
- tree = self .repo_tree .in_subtree (path )
241
+ tree = self .repo_tree .in_subtree (PathInfo ( self . root_dir ) / path )
237
242
return tree .repo if tree else None
238
243
239
244
@property
0 commit comments