oldloc = mkExportLocation $ getTopFilePath oldf
startMoveToTempName :: Remote -> ExportHandle -> TopFilePath -> Key -> CommandStart
-startMoveToTempName r db f ek =
- starting ("rename " ++ name r) ai si $
+startMoveToTempName r db f ek = case renameExport (exportActions r) of
+ Just _ -> starting ("rename " ++ name r) ai si $
performRename r db ek loc tmploc
+ Nothing -> stop
where
loc = mkExportLocation f'
f' = getTopFilePath f
si = SeekInput []
startMoveFromTempName :: Remote -> ExportHandle -> Key -> TopFilePath -> CommandStart
-startMoveFromTempName r db ek f = do
- let tmploc = exportTempName ek
- let ai = ActionItemOther $ Just $
- QuotedPath (fromExportLocation tmploc) <> " -> " <> QuotedPath f'
- stopUnless (liftIO $ elem tmploc <$> getExportedLocation db ek) $
+startMoveFromTempName r db ek f = case renameExport (exportActions r) of
+ Just _ -> stopUnless (liftIO $ elem tmploc <$> getExportedLocation db ek) $
starting ("rename " ++ name r) ai si $
performRename r db ek tmploc loc
+ Nothing -> stop
where
loc = mkExportLocation f'
f' = getTopFilePath f
+ tmploc = exportTempName ek
+ ai = ActionItemOther $ Just $
+ QuotedPath (fromExportLocation tmploc) <> " -> " <> QuotedPath f'
si = SeekInput []
performRename :: Remote -> ExportHandle -> Key -> ExportLocation -> ExportLocation -> CommandPerform
-performRename r db ek src dest =
- tryNonAsync (renameExport (exportActions r) ek src dest) >>= \case
+performRename r db ek src dest = case renameExport (exportActions r) of
+ Just renameaction -> tryNonAsync (renameaction ek src dest) >>= \case
Right (Just ()) -> next $ cleanupRename r db ek src dest
Left err -> do
warning $ UnquotedString $ "rename failed (" ++ show err ++ "); deleting instead"
fallbackdelete
- -- remote does not support renaming
Right Nothing -> fallbackdelete
+ -- remote does not support renaming
+ Nothing -> fallbackdelete
where
fallbackdelete = performUnexport r db [ek] src
, versionedExport = False
, checkPresentExport = checkPresentExportM serial adir
, removeExportDirectory = Just $ removeExportDirectoryM serial adir
- , renameExport = renameExportM serial adir
+ , renameExport = Just $ renameExportM serial adir
}
, importActions = ImportActions
{ listImportableContents = listImportableContentsM serial adir c
-- Not needed because removeExportLocation
-- auto-removes empty directories.
, removeExportDirectory = Nothing
- , renameExport = renameExportM dir
+ , renameExport = Just $ renameExportM dir
}
, importActions = ImportActions
{ listImportableContents = listImportableContentsM ii dir
, versionedExport = False
, checkPresentExport = checkPresentExportM external
, removeExportDirectory = Just $ removeExportDirectoryM external
- , renameExport = renameExportM external
+ , renameExport = Just $ renameExportM external
}
else exportUnsupported
-- Cheap exportSupported that replaces the expensive
, removeExport = nope
, versionedExport = False
, removeExportDirectory = nope
- , renameExport = \_ _ _ -> return Nothing
+ , renameExport = Nothing
}
where
nope = giveup "export not supported"
-- renameExport is optional, and the remote's
-- implementation may lose modifications to the file
-- (by eg copying and then deleting) so don't use it
- , renameExport = \_ _ _ -> return Nothing
+ , renameExport = Nothing
, checkPresentExport = checkPresentImport ciddbv
}
{ storeExport = readonlyStoreExport
, removeExport = readonlyRemoveExport
, removeExportDirectory = Just readonlyRemoveExportDirectory
- , renameExport = readonlyRenameExport
+ , renameExport = Nothing
}
, importActions = (importActions r)
{ storeExportWithContentIdentifier = readonlyStoreExportWithContentIdentifier
readonlyRemoveExportDirectory :: ExportDirectory -> Annex ()
readonlyRemoveExportDirectory _ = readonlyFail
-readonlyRenameExport :: Key -> ExportLocation -> ExportLocation -> Annex (Maybe ())
-readonlyRenameExport _ _ _ = return Nothing
-
readonlyStoreExportWithContentIdentifier :: FilePath -> Key -> ExportLocation -> [ContentIdentifier] -> MeterUpdate -> Annex ContentIdentifier
readonlyStoreExportWithContentIdentifier _ _ _ _ _ = readonlyFail
, versionedExport = False
, checkPresentExport = checkPresentExportM o
, removeExportDirectory = Just (removeExportDirectoryM o)
- , renameExport = renameExportM o
+ , renameExport = Just $ renameExportM o
}
, importActions = importUnsupported
, whereisKey = Nothing
, checkPresentExport = checkPresentExportS3 hdl this info
-- S3 does not have directories.
, removeExportDirectory = Nothing
- , renameExport = renameExportS3 hdl this rs info
+ , renameExport = Just $ renameExportS3 hdl this rs info
}
, importActions = ImportActions
{ listImportableContents = listImportableContentsS3 hdl this info c
, versionedExport = False
, removeExportDirectory = Just $
removeExportDirectoryDav hdl
- , renameExport = renameExportDav hdl
+ , renameExport = Just $ renameExportDav hdl
}
, importActions = importUnsupported
, whereisKey = Nothing
--
-- Throws an exception if the remote cannot be accessed, or
-- the file doesn't exist or cannot be renamed.
- , renameExport :: Key -> ExportLocation -> ExportLocation -> a (Maybe ())
+ , renameExport :: Maybe (Key -> ExportLocation -> ExportLocation -> a (Maybe ()))
}
data ImportActions a = ImportActions