allow building without ascii-progress, since it is not ready yet
No progress bars with -J unless built with ascii-progress.
This commit is contained in:
parent
e27b97d364
commit
505d540360
3 changed files with 45 additions and 5 deletions
|
@ -5,6 +5,8 @@
|
||||||
- Licensed under the GNU GPL version 3 or higher.
|
- Licensed under the GNU GPL version 3 or higher.
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
{-# LANGUAGE CPP #-}
|
||||||
|
|
||||||
module Messages.Progress where
|
module Messages.Progress where
|
||||||
|
|
||||||
import Common
|
import Common
|
||||||
|
@ -15,9 +17,15 @@ import Types
|
||||||
import Types.Messages
|
import Types.Messages
|
||||||
import Types.Key
|
import Types.Key
|
||||||
|
|
||||||
|
#ifdef WITH_ASCIIPROGRESS
|
||||||
import System.Console.AsciiProgress
|
import System.Console.AsciiProgress
|
||||||
import qualified System.Console.Terminal.Size as Terminal
|
import qualified System.Console.Terminal.Size as Terminal
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
|
#else
|
||||||
|
import Data.Progress.Meter
|
||||||
|
import Data.Progress.Tracker
|
||||||
|
import Data.Quantity
|
||||||
|
#endif
|
||||||
|
|
||||||
{- Shows a progress meter while performing a transfer of a key.
|
{- Shows a progress meter while performing a transfer of a key.
|
||||||
- The action is passed a callback to use to update the meter. -}
|
- The action is passed a callback to use to update the meter. -}
|
||||||
|
@ -28,6 +36,7 @@ metered combinemeterupdate key af a = case keySize key of
|
||||||
where
|
where
|
||||||
go _ QuietOutput = nometer
|
go _ QuietOutput = nometer
|
||||||
go _ JSONOutput = nometer
|
go _ JSONOutput = nometer
|
||||||
|
#ifdef WITH_ASCIIPROGRESS
|
||||||
go size _ = do
|
go size _ = do
|
||||||
showOutput
|
showOutput
|
||||||
liftIO $ putStrLn ""
|
liftIO $ putStrLn ""
|
||||||
|
@ -55,20 +64,42 @@ metered combinemeterupdate key af a = case keySize key of
|
||||||
complete pg
|
complete pg
|
||||||
|
|
||||||
return r
|
return r
|
||||||
|
#else
|
||||||
|
-- Old progress bar code, not suitable for parallel output.
|
||||||
|
go _ (ParallelOutput _) = do
|
||||||
|
r <- nometer
|
||||||
|
liftIO $ putStrLn $ fromMaybe (key2file key) af
|
||||||
|
return r
|
||||||
|
go size NormalOutput = do
|
||||||
|
showOutput
|
||||||
|
progress <- liftIO $ newProgress "" size
|
||||||
|
meter <- liftIO $ newMeter progress "B" 25 (renderNums binaryOpts 1)
|
||||||
|
r <- a $ liftIO . pupdate meter progress
|
||||||
|
liftIO $ clearMeter stdout meter
|
||||||
|
return r
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef WITH_ASCIIPROGRESS
|
||||||
pupdate pg n = do
|
pupdate pg n = do
|
||||||
let i = fromBytesProcessed n
|
let i = fromBytesProcessed n
|
||||||
sofar <- stCompleted <$> getProgressStats pg
|
sofar <- stCompleted <$> getProgressStats pg
|
||||||
when (i > sofar) $
|
when (i > sofar) $
|
||||||
tickN pg (i - sofar)
|
tickN pg (i - sofar)
|
||||||
threadDelay 100
|
threadDelay 100
|
||||||
|
#else
|
||||||
|
pupdate meter progress n = do
|
||||||
|
setP progress $ fromBytesProcessed n
|
||||||
|
displayMeter stdout meter
|
||||||
|
#endif
|
||||||
maybe noop (\m -> m n) combinemeterupdate
|
maybe noop (\m -> m n) combinemeterupdate
|
||||||
|
|
||||||
nometer = a (const noop)
|
nometer = a (const noop)
|
||||||
|
|
||||||
|
#ifdef WITH_ASCIIPROGRESS
|
||||||
truncatepretty n s
|
truncatepretty n s
|
||||||
| length s > n = take (n-2) s ++ ".."
|
| length s > n = take (n-2) s ++ ".."
|
||||||
| otherwise = s
|
| otherwise = s
|
||||||
|
#endif
|
||||||
|
|
||||||
{- Use when the progress meter is only desired for parallel
|
{- Use when the progress meter is only desired for parallel
|
||||||
- mode; as when a command's own progress output is preferred. -}
|
- mode; as when a command's own progress output is preferred. -}
|
||||||
|
|
8
debian/changelog
vendored
8
debian/changelog
vendored
|
@ -1,6 +1,3 @@
|
||||||
* get, move, copy, mirror: Concurrent downloads and uploads are
|
|
||||||
now supported! For example: git-annex get -J10
|
|
||||||
|
|
||||||
git-annex (5.20150508.2) UNRELEASED; urgency=medium
|
git-annex (5.20150508.2) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
* import: Refuse to import files that are within the work tree, as that
|
* import: Refuse to import files that are within the work tree, as that
|
||||||
|
@ -8,6 +5,11 @@ git-annex (5.20150508.2) UNRELEASED; urgency=medium
|
||||||
* drop: Now supports --all, --unused, and --key.
|
* drop: Now supports --all, --unused, and --key.
|
||||||
* drop: Now defaults to --all when run in a bare repository.
|
* drop: Now defaults to --all when run in a bare repository.
|
||||||
(Previously, did nothing when run in a bare repository.)
|
(Previously, did nothing when run in a bare repository.)
|
||||||
|
* get, move, copy, mirror: Concurrent transfers are now supported!
|
||||||
|
For example: git-annex get -J10
|
||||||
|
However, progress bars are not yet displayed for concurrent transfers,
|
||||||
|
pending an updated version of the ascii-progress library.
|
||||||
|
* --quiet now makes progress output by rsync, wget, etc be quiet too.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Mon, 11 May 2015 12:45:06 -0400
|
-- Joey Hess <id@joeyh.name> Mon, 11 May 2015 12:45:06 -0400
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,10 @@ Flag DesktopNotify
|
||||||
Flag TorrentParser
|
Flag TorrentParser
|
||||||
Description: Use haskell torrent library to parse torrent files
|
Description: Use haskell torrent library to parse torrent files
|
||||||
|
|
||||||
|
Flag AsciiProgress
|
||||||
|
Description: Use ascii-progress library (experimental)
|
||||||
|
Default: False
|
||||||
|
|
||||||
Flag EKG
|
Flag EKG
|
||||||
Description: Enable use of EKG to monitor git-annex as it runs (at http://localhost:4242/)
|
Description: Enable use of EKG to monitor git-annex as it runs (at http://localhost:4242/)
|
||||||
Default: False
|
Default: False
|
||||||
|
@ -122,8 +126,7 @@ Executable git-annex
|
||||||
monad-control, transformers,
|
monad-control, transformers,
|
||||||
bloomfilter, edit-distance,
|
bloomfilter, edit-distance,
|
||||||
resourcet, http-conduit, http-types,
|
resourcet, http-conduit, http-types,
|
||||||
esqueleto, persistent-sqlite, persistent, persistent-template,
|
esqueleto, persistent-sqlite, persistent, persistent-template
|
||||||
ascii-progress (<= 0.2.1.2), terminal-size
|
|
||||||
CC-Options: -Wall
|
CC-Options: -Wall
|
||||||
GHC-Options: -Wall -fno-warn-tabs
|
GHC-Options: -Wall -fno-warn-tabs
|
||||||
Extensions: PackageImports
|
Extensions: PackageImports
|
||||||
|
@ -261,6 +264,10 @@ Executable git-annex
|
||||||
Build-Depends: torrent (>= 10000.0.0)
|
Build-Depends: torrent (>= 10000.0.0)
|
||||||
CPP-Options: -DWITH_TORRENTPARSER
|
CPP-Options: -DWITH_TORRENTPARSER
|
||||||
|
|
||||||
|
if flag(AsciiProgress)
|
||||||
|
Build-Depends: ascii-progress (<= 0.2.1.2), terminal-size
|
||||||
|
CPP-Options: -DWITH_ASCIIPROGRESS
|
||||||
|
|
||||||
if flag(EKG)
|
if flag(EKG)
|
||||||
Build-Depends: ekg
|
Build-Depends: ekg
|
||||||
GHC-Options: -with-rtsopts=-T
|
GHC-Options: -with-rtsopts=-T
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue