better indicate when special remotes do not support renameExport
Avoid a warning message when renameExport is not supported, and just fallback to deleting with a subsequent re-upload. Especially needed for importtree remotes, where renameExport needs to be disabled. This changes the external special remote protocol, but in a backwards-compatible way. A reply of UNSUPPORTED-REQUEST to an older version of git-annex will cause it to make renameExport return False.
This commit is contained in:
parent
c755788256
commit
2912429640
11 changed files with 62 additions and 53 deletions
|
@ -279,13 +279,15 @@ checkPresentExportM :: FilePath -> Key -> ExportLocation -> Annex Bool
|
|||
checkPresentExportM d _k loc =
|
||||
checkPresentGeneric d [exportPath d loc]
|
||||
|
||||
renameExportM :: FilePath -> Key -> ExportLocation -> ExportLocation -> Annex Bool
|
||||
renameExportM d _k oldloc newloc = liftIO $ catchBoolIO $ do
|
||||
createDirectoryIfMissing True (takeDirectory dest)
|
||||
renameFile src dest
|
||||
removeExportLocation d oldloc
|
||||
return True
|
||||
renameExportM :: FilePath -> Key -> ExportLocation -> ExportLocation -> Annex (Maybe Bool)
|
||||
renameExportM d _k oldloc newloc = liftIO $ Just <$> go
|
||||
where
|
||||
go = catchBoolIO $ do
|
||||
createDirectoryIfMissing True (takeDirectory dest)
|
||||
renameFile src dest
|
||||
removeExportLocation d oldloc
|
||||
return True
|
||||
|
||||
src = exportPath d oldloc
|
||||
dest = exportPath d newloc
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue