From c30d38e108ade7eb4fa57552631b64dd3b9582c4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 26 Jan 2011 20:30:07 -0400 Subject: [PATCH] better warnings display --- CmdLine.hs | 1 - Messages.hs | 15 +++++++++------ debian/changelog | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CmdLine.hs b/CmdLine.hs index 1b5daadeb0..76402a8218 100644 --- a/CmdLine.hs +++ b/CmdLine.hs @@ -70,7 +70,6 @@ usage header cmds options = cmdparams c ++ pad (longest cmdparams + 2) (cmdparams c) ++ cmddesc c - indent l = " " ++ l pad n s = replicate (n - length s) ' ' longest f = foldl max 0 $ map (length . f) cmds diff --git a/Messages.hs b/Messages.hs index 2b98622309..6f4ec1e626 100644 --- a/Messages.hs +++ b/Messages.hs @@ -37,9 +37,8 @@ showProgress :: Annex () showProgress = verbose $ liftIO $ putStr "\n" showLongNote :: String -> Annex () -showLongNote s = verbose $ liftIO $ putStr $ "\n" ++ indented - where - indented = join "\n" $ map (\l -> " " ++ l) $ lines s +showLongNote s = verbose $ liftIO $ putStr $ "\n" ++ indent s + showEndOk :: Annex () showEndOk = verbose $ liftIO $ putStrLn "ok" @@ -48,9 +47,13 @@ showEndFail = verbose $ liftIO $ putStrLn "\nfailed" {- Exception pretty-printing. -} showErr :: (Show a) => a -> Annex () -showErr e = warning $ show e +showErr e = warning $ "git-annex: " ++ show e warning :: String -> Annex () -warning s = do +warning w = do verbose $ liftIO $ putStr "\n" - liftIO $ hPutStrLn stderr $ "git-annex: " ++ s ++ " " + liftIO $ hFlush stdout + liftIO $ hPutStrLn stderr $ indent w + +indent :: String -> String +indent s = join "\n" $ map (\l -> " " ++ l) $ lines s diff --git a/debian/changelog b/debian/changelog index c675d1456d..92b21173c8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,7 +6,7 @@ git-annex (0.19) UNRELEASED; urgency=low * untrust: Now marks the current repository as untrusted. * semitrust: Now restores the default trust level. (What untrust used to do.) * fsck, drop: Take untrusted repositories into account. - * bugfix: Files were copied from trusted remotes first even if their + * Bugfix: Files were copied from trusted remotes first even if their annex.cost was higher than other remotes. -- Joey Hess Wed, 19 Jan 2011 18:07:51 -0400