provide file with content to export
Rather than providing the key to export, provide the file. When exporting a treeish that contains files that are not annexed, this will let the content of those files also be exported. There's still a Key in the interface; it will be used by the external special remote protocol. A SHA1 key can be used when exporting non-annexed files. This commit was sponsored by Brock Spratlen on Patreon.
This commit is contained in:
parent
8f35c6584d
commit
cca2764f91
2 changed files with 11 additions and 13 deletions
|
@ -233,15 +233,13 @@ checkPresentGeneric d ps = liftIO $
|
|||
exportPath :: FilePath -> ExportLocation -> FilePath
|
||||
exportPath d (ExportLocation loc) = d </> loc
|
||||
|
||||
storeExportDirectory :: FilePath -> Key -> ExportLocation -> MeterUpdate -> Annex Bool
|
||||
storeExportDirectory d k loc p = sendAnnex k rollback send
|
||||
where
|
||||
dest = exportPath d loc
|
||||
send src = liftIO $ catchBoolIO $ do
|
||||
storeExportDirectory :: FilePath -> FilePath -> Key -> ExportLocation -> MeterUpdate -> Annex Bool
|
||||
storeExportDirectory d src _k loc p = liftIO $ catchBoolIO $ do
|
||||
createDirectoryIfMissing True dest
|
||||
withMeteredFile src p (L.writeFile dest)
|
||||
return True
|
||||
rollback = liftIO $ nukeFile dest
|
||||
where
|
||||
dest = exportPath d loc
|
||||
|
||||
retrieveExportDirectory :: FilePath -> Key -> ExportLocation -> FilePath -> MeterUpdate -> Annex (Bool, Verification)
|
||||
retrieveExportDirectory d _k loc dest p = unVerified $ liftIO $ catchBoolIO $ do
|
||||
|
|
|
@ -97,20 +97,20 @@ data RemoteA a = Remote {
|
|||
-- operation.
|
||||
checkPresentCheap :: Bool,
|
||||
|
||||
-- Exports a key's contents to an ExportLocation.
|
||||
-- Exports content to an ExportLocation.
|
||||
-- The exported file does not need to be updated atomically.
|
||||
storeExport :: Maybe (Key -> ExportLocation -> MeterUpdate -> a Bool),
|
||||
-- Retrieves an exported key to a file.
|
||||
storeExport :: Maybe (FilePath -> Key -> ExportLocation -> MeterUpdate -> a Bool),
|
||||
-- Retrieves exported content to a file.
|
||||
-- (The MeterUpdate does not need to be used if it writes
|
||||
-- sequentially to the file.)
|
||||
retrieveExport :: Maybe (Key -> ExportLocation -> FilePath -> MeterUpdate -> a (Bool, Verification)),
|
||||
-- Removes an exported key (succeeds if the contents are not present)
|
||||
-- Removes an exported file (succeeds if the contents are not present)
|
||||
removeExport :: Maybe (Key -> ExportLocation -> a Bool),
|
||||
-- Checks if a key is exported to the remote at the specified
|
||||
-- Checks if anything is exported to the remote at the specified
|
||||
-- ExportLocation.
|
||||
-- Throws an exception if the remote cannot be accessed.
|
||||
checkPresentExport :: Maybe (Key -> ExportLocation -> a Bool),
|
||||
-- Renames an already exported key.
|
||||
-- Renames an already exported file.
|
||||
renameExport :: Maybe (Key -> ExportLocation -> ExportLocation -> a Bool),
|
||||
|
||||
-- Some remotes can provide additional details for whereis.
|
||||
|
|
Loading…
Reference in a new issue