Got object sending working in direct mode.
However, I don't yet have a reliable way to deal with files being modified while they're being transferred. I have code that detects it on the sending side, but the receiver is still free to move the wrong content into its annex, and record that it has the content. So that's not acceptable, and I'll need to work on it some more. However, at this point I can use a direct mode repository as a remote and transfer files from and to it.
This commit is contained in:
parent
1727c71f8a
commit
b4c6da9cbd
4 changed files with 85 additions and 39 deletions
|
@ -262,9 +262,9 @@ copyFromRemote r key file dest
|
|||
-- run copy from perspective of remote
|
||||
liftIO $ onLocal r $ do
|
||||
ensureInitialized
|
||||
loc <- inRepo $ gitAnnexLocation key
|
||||
upload u key file noRetry $
|
||||
rsyncOrCopyFile params loc dest
|
||||
Annex.Content.sendAnnex key $ \object ->
|
||||
upload u key file noRetry $
|
||||
rsyncOrCopyFile params object dest
|
||||
| Git.repoIsSsh r = feedprogressback $ \feeder ->
|
||||
rsyncHelper (Just feeder)
|
||||
=<< rsyncParamsRemote r True key dest file
|
||||
|
@ -324,8 +324,12 @@ copyFromRemoteCheap r key file
|
|||
{- Tries to copy a key's content to a remote's annex. -}
|
||||
copyToRemote :: Git.Repo -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
|
||||
copyToRemote r key file p
|
||||
| not $ Git.repoIsUrl r = guardUsable r False $ commitOnCleanup r $ do
|
||||
keysrc <- inRepo $ gitAnnexLocation key
|
||||
| not $ Git.repoIsUrl r = guardUsable r False $ commitOnCleanup r $ copylocal
|
||||
| Git.repoIsSsh r = commitOnCleanup r $ Annex.Content.sendAnnex key $ \object ->
|
||||
rsyncHelper (Just p) =<< rsyncParamsRemote r False key object file
|
||||
| otherwise = error "copying to non-ssh repo not supported"
|
||||
where
|
||||
copylocal = Annex.Content.sendAnnex key $ \object -> do
|
||||
params <- rsyncParams r
|
||||
u <- getUUID
|
||||
-- run copy from perspective of remote
|
||||
|
@ -336,12 +340,8 @@ copyToRemote r key file p
|
|||
download u key file noRetry $
|
||||
Annex.Content.saveState True `after`
|
||||
Annex.Content.getViaTmp key
|
||||
(\d -> rsyncOrCopyFile params keysrc d p)
|
||||
(\d -> rsyncOrCopyFile params object d p)
|
||||
)
|
||||
| Git.repoIsSsh r = commitOnCleanup r $ do
|
||||
keysrc <- inRepo $ gitAnnexLocation key
|
||||
rsyncHelper (Just p) =<< rsyncParamsRemote r False key keysrc file
|
||||
| otherwise = error "copying to non-ssh repo not supported"
|
||||
|
||||
rsyncHelper :: Maybe MeterUpdate -> [CommandParam] -> Annex Bool
|
||||
rsyncHelper callback params = do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue