Fix transferring files to special remotes in direct mode.
This commit is contained in:
parent
e457be7631
commit
909f67443f
10 changed files with 33 additions and 38 deletions
|
@ -309,7 +309,6 @@ withObjectLoc key indirect direct = ifM isDirect
|
||||||
where
|
where
|
||||||
goindirect = indirect =<< inRepo (gitAnnexLocation key)
|
goindirect = indirect =<< inRepo (gitAnnexLocation key)
|
||||||
|
|
||||||
|
|
||||||
cleanObjectLoc :: Key -> Annex ()
|
cleanObjectLoc :: Key -> Annex ()
|
||||||
cleanObjectLoc key = do
|
cleanObjectLoc key = do
|
||||||
file <- inRepo $ gitAnnexLocation key
|
file <- inRepo $ gitAnnexLocation key
|
||||||
|
|
|
@ -93,6 +93,9 @@ annexLocation key hasher = objectDir </> keyPath key hasher
|
||||||
-
|
-
|
||||||
- When the file is not present, returns the location where the file should
|
- When the file is not present, returns the location where the file should
|
||||||
- be stored.
|
- be stored.
|
||||||
|
-
|
||||||
|
- This does not take direct mode into account, so in direct mode it is not
|
||||||
|
- the actual location of the file's content.
|
||||||
-}
|
-}
|
||||||
gitAnnexLocation :: Key -> Git.Repo -> IO FilePath
|
gitAnnexLocation :: Key -> Git.Repo -> IO FilePath
|
||||||
gitAnnexLocation key r
|
gitAnnexLocation key r
|
||||||
|
|
|
@ -27,6 +27,7 @@ import Crypto
|
||||||
import Data.ByteString.Lazy.UTF8 (fromString)
|
import Data.ByteString.Lazy.UTF8 (fromString)
|
||||||
import Data.Digest.Pure.SHA
|
import Data.Digest.Pure.SHA
|
||||||
import Utility.UserInfo
|
import Utility.UserInfo
|
||||||
|
import Annex.Content
|
||||||
|
|
||||||
type BupRepo = String
|
type BupRepo = String
|
||||||
|
|
||||||
|
@ -120,14 +121,12 @@ bupSplitParams r buprepo k src = do
|
||||||
(os ++ [Param "-n", Param (bupRef k)] ++ src)
|
(os ++ [Param "-n", Param (bupRef k)] ++ src)
|
||||||
|
|
||||||
store :: Remote -> BupRepo -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
|
store :: Remote -> BupRepo -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
|
||||||
store r buprepo k _f _p = do
|
store r buprepo k _f _p = sendAnnex k $ \src -> do
|
||||||
src <- inRepo $ gitAnnexLocation k
|
|
||||||
params <- bupSplitParams r buprepo k [File src]
|
params <- bupSplitParams r buprepo k [File src]
|
||||||
liftIO $ boolSystem "bup" params
|
liftIO $ boolSystem "bup" params
|
||||||
|
|
||||||
storeEncrypted :: Remote -> BupRepo -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool
|
storeEncrypted :: Remote -> BupRepo -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool
|
||||||
storeEncrypted r buprepo (cipher, enck) k _p = do
|
storeEncrypted r buprepo (cipher, enck) k _p = sendAnnex k $ \src -> do
|
||||||
src <- inRepo $ gitAnnexLocation k
|
|
||||||
params <- bupSplitParams r buprepo enck []
|
params <- bupSplitParams r buprepo enck []
|
||||||
liftIO $ catchBoolIO $
|
liftIO $ catchBoolIO $
|
||||||
encrypt cipher (feedFile src) $ \h ->
|
encrypt cipher (feedFile src) $ \h ->
|
||||||
|
|
|
@ -111,8 +111,7 @@ withStoredFiles :: ChunkSize -> FilePath -> Key -> ([FilePath] -> IO Bool) -> IO
|
||||||
withStoredFiles = withCheckedFiles doesFileExist
|
withStoredFiles = withCheckedFiles doesFileExist
|
||||||
|
|
||||||
store :: FilePath -> ChunkSize -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
|
store :: FilePath -> ChunkSize -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
|
||||||
store d chunksize k _f p = do
|
store d chunksize k _f p = sendAnnex k $ \src ->
|
||||||
src <- inRepo $ gitAnnexLocation k
|
|
||||||
metered (Just p) k $ \meterupdate ->
|
metered (Just p) k $ \meterupdate ->
|
||||||
storeHelper d chunksize k $ \dests ->
|
storeHelper d chunksize k $ \dests ->
|
||||||
case chunksize of
|
case chunksize of
|
||||||
|
@ -126,8 +125,7 @@ store d chunksize k _f p = do
|
||||||
=<< L.readFile src
|
=<< L.readFile src
|
||||||
|
|
||||||
storeEncrypted :: FilePath -> ChunkSize -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool
|
storeEncrypted :: FilePath -> ChunkSize -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool
|
||||||
storeEncrypted d chunksize (cipher, enck) k p = do
|
storeEncrypted d chunksize (cipher, enck) k p = sendAnnex k $ \src ->
|
||||||
src <- inRepo $ gitAnnexLocation k
|
|
||||||
metered (Just p) k $ \meterupdate ->
|
metered (Just p) k $ \meterupdate ->
|
||||||
storeHelper d chunksize enck $ \dests ->
|
storeHelper d chunksize enck $ \dests ->
|
||||||
encrypt cipher (feedFile src) $ readBytes $ \b ->
|
encrypt cipher (feedFile src) $ readBytes $ \b ->
|
||||||
|
|
|
@ -23,6 +23,7 @@ import Crypto
|
||||||
import Creds
|
import Creds
|
||||||
import Meters
|
import Meters
|
||||||
import qualified Annex
|
import qualified Annex
|
||||||
|
import Annex.Content
|
||||||
|
|
||||||
import System.Process
|
import System.Process
|
||||||
|
|
||||||
|
@ -84,17 +85,15 @@ store r k _f m
|
||||||
| keySize k == Just 0 = do
|
| keySize k == Just 0 = do
|
||||||
warning "Cannot store empty files in Glacier."
|
warning "Cannot store empty files in Glacier."
|
||||||
return False
|
return False
|
||||||
| otherwise = do
|
| otherwise = sendAnnex k $ \src ->
|
||||||
src <- inRepo $ gitAnnexLocation k
|
|
||||||
metered (Just m) k $ \meterupdate ->
|
metered (Just m) k $ \meterupdate ->
|
||||||
storeHelper r k $ streamMeteredFile src meterupdate
|
storeHelper r k $ streamMeteredFile src meterupdate
|
||||||
|
|
||||||
storeEncrypted :: Remote -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool
|
storeEncrypted :: Remote -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool
|
||||||
storeEncrypted r (cipher, enck) k m = do
|
storeEncrypted r (cipher, enck) k m = sendAnnex k $ \src -> do
|
||||||
f <- inRepo $ gitAnnexLocation k
|
|
||||||
metered (Just m) k $ \meterupdate ->
|
metered (Just m) k $ \meterupdate ->
|
||||||
storeHelper r enck $ \h ->
|
storeHelper r enck $ \h ->
|
||||||
encrypt cipher (feedFile f)
|
encrypt cipher (feedFile src)
|
||||||
(readBytes $ meteredWrite meterupdate h)
|
(readBytes $ meteredWrite meterupdate h)
|
||||||
|
|
||||||
retrieve :: Remote -> Key -> AssociatedFile -> FilePath -> Annex Bool
|
retrieve :: Remote -> Key -> AssociatedFile -> FilePath -> Annex Bool
|
||||||
|
|
|
@ -103,13 +103,12 @@ runHook hooktype hook k f a = maybe (return False) run =<< lookupHook hooktype h
|
||||||
)
|
)
|
||||||
|
|
||||||
store :: String -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
|
store :: String -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
|
||||||
store h k _f _p = do
|
store h k _f _p = sendAnnex k $ \src ->
|
||||||
src <- inRepo $ gitAnnexLocation k
|
|
||||||
runHook h "store" k (Just src) $ return True
|
runHook h "store" k (Just src) $ return True
|
||||||
|
|
||||||
storeEncrypted :: String -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool
|
storeEncrypted :: String -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool
|
||||||
storeEncrypted h (cipher, enck) k _p = withTmp enck $ \tmp -> do
|
storeEncrypted h (cipher, enck) k _p = withTmp enck $ \tmp ->
|
||||||
src <- inRepo $ gitAnnexLocation k
|
sendAnnex k $ \src -> do
|
||||||
liftIO $ encrypt cipher (feedFile src) $
|
liftIO $ encrypt cipher (feedFile src) $
|
||||||
readBytes $ L.writeFile tmp
|
readBytes $ L.writeFile tmp
|
||||||
runHook h "store" enck (Just tmp) $ return True
|
runHook h "store" enck (Just tmp) $ return True
|
||||||
|
|
|
@ -101,11 +101,11 @@ rsyncUrls o k = map use annexHashes
|
||||||
f = keyFile k
|
f = keyFile k
|
||||||
|
|
||||||
store :: RsyncOpts -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
|
store :: RsyncOpts -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
|
||||||
store o k _f p = rsyncSend o p k <=< inRepo $ gitAnnexLocation k
|
store o k _f p = sendAnnex k $ rsyncSend o p k
|
||||||
|
|
||||||
storeEncrypted :: RsyncOpts -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool
|
storeEncrypted :: RsyncOpts -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool
|
||||||
storeEncrypted o (cipher, enck) k p = withTmp enck $ \tmp -> do
|
storeEncrypted o (cipher, enck) k p = withTmp enck $ \tmp ->
|
||||||
src <- inRepo $ gitAnnexLocation k
|
sendAnnex k $ \src -> do
|
||||||
liftIO $ encrypt cipher (feedFile src) $
|
liftIO $ encrypt cipher (feedFile src) $
|
||||||
readBytes $ L.writeFile tmp
|
readBytes $ L.writeFile tmp
|
||||||
rsyncSend o p enck tmp
|
rsyncSend o p enck tmp
|
||||||
|
|
|
@ -112,8 +112,7 @@ s3Setup u c = handlehost $ M.lookup "host" c
|
||||||
M.delete "bucket" defaults
|
M.delete "bucket" defaults
|
||||||
|
|
||||||
store :: Remote -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
|
store :: Remote -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
|
||||||
store r k _f p = s3Action r False $ \(conn, bucket) -> do
|
store r k _f p = s3Action r False $ \(conn, bucket) -> sendAnnex k $ \src -> do
|
||||||
src <- inRepo $ gitAnnexLocation k
|
|
||||||
res <- storeHelper (conn, bucket) r k p src
|
res <- storeHelper (conn, bucket) r k p src
|
||||||
s3Bool res
|
s3Bool res
|
||||||
|
|
||||||
|
@ -121,9 +120,8 @@ storeEncrypted :: Remote -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool
|
||||||
storeEncrypted r (cipher, enck) k p = s3Action r False $ \(conn, bucket) ->
|
storeEncrypted r (cipher, enck) k p = s3Action r False $ \(conn, bucket) ->
|
||||||
-- To get file size of the encrypted content, have to use a temp file.
|
-- To get file size of the encrypted content, have to use a temp file.
|
||||||
-- (An alternative would be chunking to to a constant size.)
|
-- (An alternative would be chunking to to a constant size.)
|
||||||
withTmp enck $ \tmp -> do
|
withTmp enck $ \tmp -> sendAnnex k $ \src -> do
|
||||||
f <- inRepo $ gitAnnexLocation k
|
liftIO $ encrypt cipher (feedFile src) $
|
||||||
liftIO $ encrypt cipher (feedFile f) $
|
|
||||||
readBytes $ L.writeFile tmp
|
readBytes $ L.writeFile tmp
|
||||||
res <- storeHelper (conn, bucket) r enck p tmp
|
res <- storeHelper (conn, bucket) r enck p tmp
|
||||||
s3Bool res
|
s3Bool res
|
||||||
|
|
|
@ -30,6 +30,7 @@ import Remote.Helper.Chunked
|
||||||
import Crypto
|
import Crypto
|
||||||
import Creds
|
import Creds
|
||||||
import Meters
|
import Meters
|
||||||
|
import Annex.Content
|
||||||
|
|
||||||
type DavUrl = String
|
type DavUrl = String
|
||||||
type DavUser = B8.ByteString
|
type DavUser = B8.ByteString
|
||||||
|
@ -82,16 +83,14 @@ webdavSetup u c = do
|
||||||
|
|
||||||
store :: Remote -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
|
store :: Remote -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool
|
||||||
store r k _f p = metered (Just p) k $ \meterupdate ->
|
store r k _f p = metered (Just p) k $ \meterupdate ->
|
||||||
davAction r False $ \(baseurl, user, pass) -> do
|
davAction r False $ \(baseurl, user, pass) -> sendAnnex k $ \src ->
|
||||||
f <- inRepo $ gitAnnexLocation k
|
liftIO $ withMeteredFile src meterupdate $
|
||||||
liftIO $ withMeteredFile f meterupdate $
|
|
||||||
storeHelper r k baseurl user pass
|
storeHelper r k baseurl user pass
|
||||||
|
|
||||||
storeEncrypted :: Remote -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool
|
storeEncrypted :: Remote -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool
|
||||||
storeEncrypted r (cipher, enck) k p = metered (Just p) k $ \meterupdate ->
|
storeEncrypted r (cipher, enck) k p = metered (Just p) k $ \meterupdate ->
|
||||||
davAction r False $ \(baseurl, user, pass) -> do
|
davAction r False $ \(baseurl, user, pass) -> sendAnnex k $ \src ->
|
||||||
f <- inRepo $ gitAnnexLocation k
|
liftIO $ encrypt cipher (streamMeteredFile src meterupdate) $
|
||||||
liftIO $ encrypt cipher (streamMeteredFile f meterupdate) $
|
|
||||||
readBytes $ storeHelper r enck baseurl user pass
|
readBytes $ storeHelper r enck baseurl user pass
|
||||||
|
|
||||||
storeHelper :: Remote -> Key -> DavUrl -> DavUser -> DavPass -> L.ByteString -> IO Bool
|
storeHelper :: Remote -> Key -> DavUrl -> DavUser -> DavPass -> L.ByteString -> IO Bool
|
||||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -9,6 +9,7 @@ git-annex (3.20130105) UNRELEASED; urgency=low
|
||||||
and set environment to prevent git from failing.
|
and set environment to prevent git from failing.
|
||||||
* direct: Avoid hardlinking symlinks that point to the same content
|
* direct: Avoid hardlinking symlinks that point to the same content
|
||||||
when the content is not present.
|
when the content is not present.
|
||||||
|
* Fix transferring files to special remotes in direct mode.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Thu, 03 Jan 2013 14:58:45 -0400
|
-- Joey Hess <joeyh@debian.org> Thu, 03 Jan 2013 14:58:45 -0400
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue