diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-10-09 13:07:03 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-10-09 13:12:58 -0400 |
commit | 8817fe6331ffc3d99bbf44af559f773af1a2ddd2 (patch) | |
tree | 21da807bf1ae9dda9714990b5d6c0dd961bd4ff6 /Remote | |
parent | 7788d302397096c85fe70c35f2661d76a8d2f511 (diff) |
content locking during drop working for local git remotes
Only ssh remotes lack locking now
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/Git.hs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Remote/Git.hs b/Remote/Git.hs index 725b302b8..9fa7158e5 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -53,6 +53,7 @@ import Annex.Path import Creds import Annex.CatFile import Messages.Progress +import Types.NumCopies import Control.Concurrent import Control.Concurrent.MSampleVar @@ -142,7 +143,7 @@ gen r u c gc , retrieveKeyFile = copyFromRemote new , retrieveKeyFileCheap = copyFromRemoteCheap new , removeKey = dropKey new - , lockContent = Nothing + , lockContent = Just (lockKey new) , checkPresent = inAnnex new , checkPresentCheap = repoCheap r , whereisKey = Nothing @@ -359,6 +360,16 @@ dropKey r key | Git.repoIsHttp (repo r) = error "dropping from http remote not supported" | otherwise = commitOnCleanup r $ Ssh.dropKey (repo r) key +lockKey :: Remote -> Key -> (VerifiedCopy -> Annex r) -> Annex r +lockKey r key a + | not $ Git.repoIsUrl (repo r) = + guardUsable (repo r) cantlock $ + onLocal r $ Annex.Content.lockContentShared key a + | Git.repoIsHttp (repo r) = cantlock + | otherwise = error "TODO" + where + cantlock = error "can't lock content" + {- Tries to copy a key's content from a remote's annex to a file. -} copyFromRemote :: Remote -> Key -> AssociatedFile -> FilePath -> MeterUpdate -> Annex (Bool, Verification) copyFromRemote r key file dest p = parallelMetered (Just p) key file $ |