diff --git a/Messages/Progress.hs b/Messages/Progress.hs index 48cc4912d3..da60716e64 100644 --- a/Messages/Progress.hs +++ b/Messages/Progress.hs @@ -116,7 +116,10 @@ metered' st othermeter msize showoutput a = go st a meter (combinemeter m) | otherwise = nometer go (MessageState { outputType = SerializedOutput h _ }) = do - liftIO $ outputSerialized h $ BeginProgressMeter msize + liftIO $ outputSerialized h BeginProgressMeter + case msize of + Just sz -> liftIO $ outputSerialized h $ UpdateProgressMeterTotalSize sz + Nothing -> noop szv <- liftIO $ newIORef msize meter <- liftIO $ mkMeter msize $ \_ msize' _old new -> do case msize' of diff --git a/Messages/Serialized.hs b/Messages/Serialized.hs index cd62e10448..ff2517a901 100644 --- a/Messages/Serialized.hs +++ b/Messages/Serialized.hs @@ -63,11 +63,11 @@ relaySerializedOutput getso sendsor meterreport runannex = go Nothing outputSerialized h $ JSONObject b _ -> q loop st - Left (BeginProgressMeter sz) -> do + Left BeginProgressMeter -> do ost <- runannex (Annex.getState Annex.output) -- Display a progress meter while running, until -- the meter ends or a final value is returned. - metered' ost Nothing sz (runannex showOutput) + metered' ost Nothing Nothing (runannex showOutput) (\meter meterupdate -> loop (Just (meter, meterupdate))) >>= \case Right r -> return (Right r) diff --git a/Types/Messages.hs b/Types/Messages.hs index ffb85ac3d0..593207be35 100644 --- a/Types/Messages.hs +++ b/Types/Messages.hs @@ -68,9 +68,9 @@ newMessageState = do data SerializedOutput = OutputMessage S.ByteString | OutputError String - | BeginProgressMeter (Maybe TotalSize) - | UpdateProgressMeter BytesProcessed + | BeginProgressMeter | UpdateProgressMeterTotalSize TotalSize + | UpdateProgressMeter BytesProcessed | EndProgressMeter | BeginPrompt | EndPrompt diff --git a/Types/Transferrer.hs b/Types/Transferrer.hs index 7dbcfb23be..79b0895126 100644 --- a/Types/Transferrer.hs +++ b/Types/Transferrer.hs @@ -85,14 +85,12 @@ instance Proto.Sendable TransferResponse where ["om", Proto.serialize (encode_c (decodeBS m))] formatMessage (TransferOutput (OutputError e)) = ["oe", Proto.serialize (encode_c e)] - formatMessage (TransferOutput (BeginProgressMeter (Just (TotalSize n)))) = - ["opb", Proto.serialize n] - formatMessage (TransferOutput (BeginProgressMeter Nothing)) = - ["opbx"] - formatMessage (TransferOutput (UpdateProgressMeter n)) = - ["op", Proto.serialize n] + formatMessage (TransferOutput BeginProgressMeter) = + ["opb"] formatMessage (TransferOutput (UpdateProgressMeterTotalSize (TotalSize sz))) = ["ops", Proto.serialize sz] + formatMessage (TransferOutput (UpdateProgressMeter n)) = + ["op", Proto.serialize n] formatMessage (TransferOutput EndProgressMeter) = ["ope"] formatMessage (TransferOutput BeginPrompt) = @@ -111,14 +109,12 @@ instance Proto.Receivable TransferResponse where TransferOutput . OutputMessage . encodeBS . decode_c parseCommand "oe" = Proto.parse1 $ TransferOutput . OutputError . decode_c - parseCommand "opb" = Proto.parse1 $ - TransferOutput . BeginProgressMeter . Just . TotalSize - parseCommand "opbx" = Proto.parse0 $ - TransferOutput (BeginProgressMeter Nothing) - parseCommand "op" = Proto.parse1 $ - TransferOutput . UpdateProgressMeter + parseCommand "opb" = Proto.parse0 $ + TransferOutput BeginProgressMeter parseCommand "ops" = Proto.parse1 $ TransferOutput . UpdateProgressMeterTotalSize . TotalSize + parseCommand "op" = Proto.parse1 $ + TransferOutput . UpdateProgressMeter parseCommand "ope" = Proto.parse0 $ TransferOutput EndProgressMeter parseCommand "oprb" = Proto.parse0 $