import Annex.Export
import Annex.RemoteTrackingBranch
import Annex.HashObject
+import Annex.Transfer
import Command
import Backend
import Types.Key
const runimport
dodownload cidmap db (loc, (cid, sz)) largematcher = do
+ f <- locworktreefile loc
+ let af = AssociatedFile (Just f)
let downloader tmpfile p = do
- k <- Remote.retrieveExportWithContentIdentifier ia loc cid tmpfile (mkkey loc tmpfile largematcher) p
+ k <- Remote.retrieveExportWithContentIdentifier
+ ia loc cid tmpfile
+ (mkkey f tmpfile largematcher)
+ p
case keyGitSha k of
Nothing -> do
ok <- moveAnnex k tmpfile
warning (show e)
return Nothing
checkDiskSpaceToGet tmpkey Nothing $
- withTmp tmpkey $ \tmpfile ->
- metered Nothing tmpkey $
- const (rundownload tmpfile)
+ notifyTransfer Download af $
+ download (Remote.uuid remote) tmpkey af stdRetry $ \p ->
+ withTmp tmpkey $ \tmpfile ->
+ metered (Just p) tmpkey $
+ const (rundownload tmpfile)
where
tmpkey = importKey cid sz
-
+
ia = Remote.importActions remote
- mkkey loc tmpfile largematcher = do
- f <- fromRepo $ fromTopFilePath $ locworktreefilename loc
+ mkkey f tmpfile largematcher = do
matcher <- largematcher (fromRawFilePath f)
let mi = MatchingFile FileInfo
{ matchFile = f
fst <$> genKey ks nullMeterUpdate backend
else gitShaKey <$> hashFile tmpfile
- locworktreefilename loc = asTopFilePath $ case importtreeconfig of
- ImportTree -> fromImportLocation loc
- ImportSubTree subdir _ ->
- getTopFilePath subdir P.</> fromImportLocation loc
+ locworktreefile loc = fromRepo $ fromTopFilePath $ asTopFilePath $
+ case importtreeconfig of
+ ImportTree -> fromImportLocation loc
+ ImportSubTree subdir _ ->
+ getTopFilePath subdir P.</> fromImportLocation loc
getcidkey cidmap db cid = liftIO $
CIDDb.getContentIdentifierKeys db rs cid >>= \case
to 5, to avoid some unusual edge cases where too much retrying could
result in far more data transfer than makes sense.
* Retry transfers to exporttree=yes remotes same as for other remotes.
+ * import: Retry downloads that fail, same as is done for downloads generally.
-- Joey Hess <id@joeyh.name> Fri, 14 Aug 2020 14:57:45 -0400