diff options
author | Joey Hess <joey@kitenet.net> | 2012-12-08 17:03:39 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-12-08 17:03:39 -0400 |
commit | e2dd3ae351cbe7b2b1a027ef257808dde02d899f (patch) | |
tree | b8bf1c308dc9ea3fbc80db47921a2b3eb6c5a89b /Remote/Git.hs | |
parent | 0c7ac5732d8bece6ba259bfa31e383612f3fb8df (diff) |
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.
Diffstat (limited to 'Remote/Git.hs')
-rw-r--r-- | Remote/Git.hs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Remote/Git.hs b/Remote/Git.hs index 0933a1cae..a333a707b 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -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 |