diff options
-rw-r--r-- | Messages.hs | 5 | ||||
-rw-r--r-- | Remote/Directory.hs | 8 | ||||
-rw-r--r-- | doc/design/assistant/progressbars.mdwn | 2 |
3 files changed, 8 insertions, 7 deletions
diff --git a/Messages.hs b/Messages.hs index 7f61efb88..d8d84d1ec 100644 --- a/Messages.hs +++ b/Messages.hs @@ -63,8 +63,8 @@ showProgress = handle q $ {- Shows a progress meter while performing a transfer of a key. - The action is passed a callback to use to update the meter. -} -metered :: Key -> (MeterUpdate -> Annex a) -> Annex a -metered key a = withOutputType $ go (keySize key) +metered :: (Maybe MeterUpdate) -> Key -> (MeterUpdate -> Annex a) -> Annex a +metered combinemeterupdate key a = withOutputType $ go (keySize key) where go (Just size) NormalOutput = do progress <- liftIO $ newProgress "" size @@ -74,6 +74,7 @@ metered key a = withOutputType $ go (keySize key) r <- a $ \n -> liftIO $ do incrP progress n displayMeter stdout meter + maybe noop (\m -> m n) combinemeterupdate liftIO $ clearMeter stdout meter return r go _ _ = a (const noop) diff --git a/Remote/Directory.hs b/Remote/Directory.hs index 9eada0635..bac531881 100644 --- a/Remote/Directory.hs +++ b/Remote/Directory.hs @@ -127,7 +127,7 @@ withStoredFiles = withCheckedFiles doesFileExist store :: FilePath -> ChunkSize -> Key -> AssociatedFile -> MeterUpdate -> Annex Bool store d chunksize k _f p = do src <- inRepo $ gitAnnexLocation k - metered k $ \meterupdate -> + metered (Just p) k $ \meterupdate -> storeHelper d chunksize k $ \dests -> case chunksize of Nothing -> do @@ -142,7 +142,7 @@ store d chunksize k _f p = do storeEncrypted :: FilePath -> ChunkSize -> (Cipher, Key) -> Key -> MeterUpdate -> Annex Bool storeEncrypted d chunksize (cipher, enck) k p = do src <- inRepo $ gitAnnexLocation k - metered k $ \meterupdate -> + metered (Just p) k $ \meterupdate -> storeHelper d chunksize enck $ \dests -> withEncryptedContent cipher (L.readFile src) $ \s -> case chunksize of @@ -245,7 +245,7 @@ storeHelper d chunksize key a = prep <&&> check <&&> go return (not $ null stored) retrieve :: FilePath -> ChunkSize -> Key -> AssociatedFile -> FilePath -> Annex Bool -retrieve d chunksize k _ f = metered k $ \meterupdate -> +retrieve d chunksize k _ f = metered Nothing k $ \meterupdate -> liftIO $ withStoredFiles chunksize d k $ \files -> catchBoolIO $ do meteredWriteFile' meterupdate f files feeder @@ -257,7 +257,7 @@ retrieve d chunksize k _ f = metered k $ \meterupdate -> return (xs, chunks) retrieveEncrypted :: FilePath -> ChunkSize -> (Cipher, Key) -> Key -> FilePath -> Annex Bool -retrieveEncrypted d chunksize (cipher, enck) k f = metered k $ \meterupdate -> +retrieveEncrypted d chunksize (cipher, enck) k f = metered Nothing k $ \meterupdate -> liftIO $ withStoredFiles chunksize d enck $ \files -> catchBoolIO $ do withDecryptedContent cipher (L.concat <$> mapM L.readFile files) $ diff --git a/doc/design/assistant/progressbars.mdwn b/doc/design/assistant/progressbars.mdwn index c7c76ddc6..ead440453 100644 --- a/doc/design/assistant/progressbars.mdwn +++ b/doc/design/assistant/progressbars.mdwn @@ -43,7 +43,7 @@ the ProgressCallback as the upload progresses. the multiplexing. * rsync: **done** -* directory +* directory: **done** * web: Not applicable; does not upload * S3 * bup |