summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-04-30 13:59:05 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-04-30 13:59:05 -0400
commitbf70bbdbfc875836cf880ba8a03cac74948a30a3 (patch)
tree1f422e9cbf29e3541787abb9522f9ecd561f65ce
parent0c9c14b52fcdd9684da70c8dd763661acdbd3843 (diff)
fix test suite build
-rw-r--r--Annex.hs6
-rw-r--r--Option.hs8
-rw-r--r--test.hs9
3 files changed, 14 insertions, 9 deletions
diff --git a/Annex.hs b/Annex.hs
index f2fb1f401..d1509d4bd 100644
--- a/Annex.hs
+++ b/Annex.hs
@@ -18,6 +18,7 @@ module Annex (
changeState,
setFlag,
setField,
+ setOutput,
getFlag,
getField,
addCleanup,
@@ -148,6 +149,11 @@ addCleanup :: String -> Annex () -> Annex ()
addCleanup uid a = changeState $ \s ->
s { cleanup = M.insertWith' const uid a $ cleanup s }
+{- Sets the type of output to emit. -}
+setOutput :: OutputType -> Annex ()
+setOutput o = changeState $ \s ->
+ s { output = (output s) { outputType = o } }
+
{- Checks if a flag was set. -}
getFlag :: String -> Annex Bool
getFlag flag = fromMaybe False . M.lookup flag <$> getState flags
diff --git a/Option.hs b/Option.hs
index 769622055..1bac2cd05 100644
--- a/Option.hs
+++ b/Option.hs
@@ -32,11 +32,11 @@ common =
"avoid slow operations"
, Option ['a'] ["auto"] (NoArg (setauto True))
"automatic mode"
- , Option ['q'] ["quiet"] (NoArg (setoutput QuietOutput))
+ , Option ['q'] ["quiet"] (NoArg (Annex.setOutput QuietOutput))
"avoid verbose output"
- , Option ['v'] ["verbose"] (NoArg (setoutput NormalOutput))
+ , Option ['v'] ["verbose"] (NoArg (Annex.setOutput NormalOutput))
"allow verbose output (default)"
- , Option ['j'] ["json"] (NoArg (setoutput JSONOutput))
+ , Option ['j'] ["json"] (NoArg (Annex.setOutput JSONOutput))
"enable JSON output"
, Option ['d'] ["debug"] (NoArg setdebug)
"show debug messages"
@@ -47,8 +47,6 @@ common =
setforce v = Annex.changeState $ \s -> s { Annex.force = v }
setfast v = Annex.changeState $ \s -> s { Annex.fast = v }
setauto v = Annex.changeState $ \s -> s { Annex.auto = v }
- setoutput v = Annex.changeState $ \s ->
- s { Annex.output = (Annex.output s) { outputType = v } }
setforcebackend v = Annex.changeState $ \s -> s { Annex.forcebackend = Just v }
setdebug = liftIO $ updateGlobalLogger rootLoggerName $
setLevel DEBUG
diff --git a/test.hs b/test.hs
index 5f4b0ad40..8c24c3a23 100644
--- a/test.hs
+++ b/test.hs
@@ -38,6 +38,7 @@ import qualified Logs.Remote
import qualified Remote
import qualified Command.DropUnused
import qualified Types.Key
+import qualified Types.Messages
import qualified Config
import qualified Crypto
import qualified Utility.Path
@@ -720,10 +721,10 @@ git_annex_expectoutput command params expected = do
-- are not run; this should only be used for actions that query state.
annexeval :: Types.Annex a -> IO a
annexeval a = do
- g <- Git.Construct.fromCurrent
- g' <- Git.Config.read g
- s <- Annex.new g'
- Annex.eval s { Annex.output = Annex.QuietOutput } a
+ s <- Annex.new =<< Git.Config.read =<< Git.Construct.fromCurrent
+ Annex.eval s $ do
+ Annex.setOutput Types.Messages.QuietOutput
+ a
innewrepo :: Assertion -> Assertion
innewrepo a = withgitrepo $ \r -> indir r a