add progress display when receiving files

That was actually really easy. But, when getting a file from an encrypted
directory special remote, no meter can be shown, because the total file
size is not known.
This commit is contained in:
Joey Hess 2012-03-04 03:25:41 -04:00
parent 9856c24a59
commit 4638314001

View file

@ -13,7 +13,6 @@ import qualified Data.Map as M
import Control.Exception (bracket) import Control.Exception (bracket)
import Common.Annex import Common.Annex
import Utility.CopyFile
import Types.Remote import Types.Remote
import qualified Git import qualified Git
import Config import Config
@ -231,11 +230,11 @@ storeHelper d chunksize key a = do
tmpprefixlen = length tmpprefix tmpprefixlen = length tmpprefix
retrieve :: FilePath -> ChunkSize -> Key -> FilePath -> Annex Bool retrieve :: FilePath -> ChunkSize -> Key -> FilePath -> Annex Bool
retrieve d chunksize k f = liftIO $ withStoredFiles chunksize d k go retrieve d chunksize k f = metered k $ \meterupdate ->
where liftIO $ withStoredFiles chunksize d k $ \files ->
go [file] = copyFileExternal file f catchBoolIO $ do
go files = catchBoolIO $ do meteredWriteFile meterupdate f =<<
L.writeFile f =<< (L.concat <$> mapM L.readFile files) (L.concat <$> mapM L.readFile files)
return True return True
retrieveEncrypted :: FilePath -> ChunkSize -> (Cipher, Key) -> FilePath -> Annex Bool retrieveEncrypted :: FilePath -> ChunkSize -> (Cipher, Key) -> FilePath -> Annex Bool