diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-11-04 16:19:00 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-11-04 16:22:43 -0400 |
commit | 332e98b6cb1091c46221e2d8579a0035ba4dff51 (patch) | |
tree | 7c80c508ddf408951a6ffc0c419c84094736e781 /CmdLine | |
parent | 527b6970457e74f8c88dfdac7c96241e2496a2f2 (diff) |
arrange for regional output manager to run when -J is enabled
Commands that want to use it have to run their seek action inside
allowConcurrentOutput. Which seems reasonable; perhaps some future command
will want to support the -J flag but not use regions.
The region state moved from Annex to MessageState. This makes sense
organizationally, and note that some uses of onLocal use a different Annex
state, but pass the MessageState into it, which is what is needed.
Diffstat (limited to 'CmdLine')
-rw-r--r-- | CmdLine/Action.hs | 3 | ||||
-rw-r--r-- | CmdLine/GitAnnex/Options.hs | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/CmdLine/Action.hs b/CmdLine/Action.hs index eeb41394a..73cffec76 100644 --- a/CmdLine/Action.hs +++ b/CmdLine/Action.hs @@ -56,7 +56,8 @@ commandAction a = withOutputType go else do l <- liftIO $ drainTo (n-1) ws findFreeSlot l - w <- liftIO $ async $ snd <$> Annex.run st run + w <- liftIO $ async + $ snd <$> Annex.run st (inOwnConsoleRegion run) Annex.changeState $ \s -> s { Annex.workers = Right w:ws' } go _ = run run = void $ includeCommandAction a diff --git a/CmdLine/GitAnnex/Options.hs b/CmdLine/GitAnnex/Options.hs index 06e04748d..b004e4239 100644 --- a/CmdLine/GitAnnex/Options.hs +++ b/CmdLine/GitAnnex/Options.hs @@ -282,13 +282,17 @@ jsonOption = globalFlag (Annex.setOutput JSONOutput) <> hidden ) +-- Note that a command that adds this option should wrap its seek +-- action in `allowConcurrentOutput`. jobsOption :: GlobalOption -jobsOption = globalSetter (Annex.setOutput . ConcurrentOutput) $ +jobsOption = globalSetter set $ option auto ( long "jobs" <> short 'J' <> metavar paramNumber <> help "enable concurrent jobs" <> hidden ) + where + set n = Annex.changeState $ \s -> s { Annex.concurrentjobs = Just n } timeLimitOption :: GlobalOption timeLimitOption = globalSetter Limit.addTimeLimit $ strOption |