implement fastDebug
Most of the changes here involve global option parsing: GlobalSetter changed so it can both run an Annex action to set state, but can also change the AnnexRead value, which is immutable once the Annex monad is running. That allowed a debugselector value to be added to AnnexRead, seeded from the git config. The --debugfilter option's GlobalSetter then updates the AnnexRead. This improved GlobalSetter can later be used to move more stuff to AnnexRead. Things that don't involve a git config will be easier to move, and probably a *lot* of things can be moved eventually. fastDebug, while implemented, is not used anywhere yet. But it should be fast..
This commit is contained in:
parent
6136006106
commit
d16d739ce2
12 changed files with 194 additions and 84 deletions
13
CmdLine.hs
13
CmdLine.hs
|
@ -53,14 +53,14 @@ dispatch' subcommandname args fuzzy cmds allargs allcmds fields getgitrepo progn
|
|||
where
|
||||
go (Right g) = do
|
||||
g' <- Git.Config.read g
|
||||
(cmd, seek, globalconfig) <- parsewith False cmdparser
|
||||
(cmd, seek, globalsetter) <- parsewith False cmdparser
|
||||
(\a -> a (Just g'))
|
||||
O.handleParseResult
|
||||
state <- Annex.new g'
|
||||
state <- applyAnnexReadSetter globalsetter <$> Annex.new g'
|
||||
Annex.eval state $ do
|
||||
checkEnvironment
|
||||
forM_ fields $ uncurry Annex.setField
|
||||
prepRunCommand cmd globalconfig
|
||||
prepRunCommand cmd globalsetter
|
||||
startup
|
||||
performCommandAction cmd seek $
|
||||
shutdown $ cmdnocommit cmd
|
||||
|
@ -141,11 +141,14 @@ subCmdName argv = (name, args)
|
|||
| "-" `isPrefixOf` a = findname as (a:c)
|
||||
| otherwise = (Just a, reverse c ++ as)
|
||||
|
||||
-- | Note that the GlobalSetter must have already had its annexReadSetter
|
||||
-- applied before entering the Annex monad; that cannot be changed while
|
||||
-- running in the Annex monad.
|
||||
prepRunCommand :: Command -> GlobalSetter -> Annex ()
|
||||
prepRunCommand cmd globalconfig = do
|
||||
prepRunCommand cmd globalsetter = do
|
||||
when (cmdnomessages cmd) $
|
||||
Annex.setOutput QuietOutput
|
||||
getParsed globalconfig
|
||||
annexStateSetter globalsetter
|
||||
whenM (annexDebug <$> Annex.getGitConfig) $
|
||||
enableDebugOutput
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue