Add --debug option. Closes: #627499
This takes advantage of the debug logging done by missingh, and I added my own debug messages for executeFile calls. There are still some other low-level ways git-annex runs stuff that are not shown by debugging, but this gets most of it easily.
This commit is contained in:
parent
1876db50f2
commit
93a4f3d4e6
6 changed files with 23 additions and 4 deletions
|
@ -8,6 +8,8 @@
|
||||||
module Options where
|
module Options where
|
||||||
|
|
||||||
import System.Console.GetOpt
|
import System.Console.GetOpt
|
||||||
|
import System.Log.Logger
|
||||||
|
import Control.Monad.State (liftIO)
|
||||||
|
|
||||||
import qualified Annex
|
import qualified Annex
|
||||||
import Types
|
import Types
|
||||||
|
@ -27,7 +29,9 @@ commonOptions =
|
||||||
, Option ['q'] ["quiet"] (NoArg (setquiet True))
|
, Option ['q'] ["quiet"] (NoArg (setquiet True))
|
||||||
"avoid verbose output"
|
"avoid verbose output"
|
||||||
, Option ['v'] ["verbose"] (NoArg (setquiet False))
|
, Option ['v'] ["verbose"] (NoArg (setquiet False))
|
||||||
"allow verbose output"
|
"allow verbose output (default)"
|
||||||
|
, Option ['d'] ["debug"] (NoArg (setdebug))
|
||||||
|
"show debug messages"
|
||||||
, Option ['b'] ["backend"] (ReqArg setforcebackend paramName)
|
, Option ['b'] ["backend"] (ReqArg setforcebackend paramName)
|
||||||
"specify key-value backend to use"
|
"specify key-value backend to use"
|
||||||
]
|
]
|
||||||
|
@ -36,3 +40,4 @@ commonOptions =
|
||||||
setfast v = Annex.changeState $ \s -> s { Annex.fast = v }
|
setfast v = Annex.changeState $ \s -> s { Annex.fast = v }
|
||||||
setquiet v = Annex.changeState $ \s -> s { Annex.quiet = v }
|
setquiet v = Annex.changeState $ \s -> s { Annex.quiet = v }
|
||||||
setforcebackend v = Annex.changeState $ \s -> s { Annex.forcebackend = Just v }
|
setforcebackend v = Annex.changeState $ \s -> s { Annex.forcebackend = Just v }
|
||||||
|
setdebug = liftIO $ updateGlobalLogger "" $ setLevel DEBUG
|
||||||
|
|
|
@ -12,7 +12,7 @@ import Control.Exception.Extensible (IOException)
|
||||||
import qualified Data.Map as M
|
import qualified Data.Map as M
|
||||||
import Control.Monad.State (liftIO)
|
import Control.Monad.State (liftIO)
|
||||||
import System.FilePath
|
import System.FilePath
|
||||||
import System.Posix.Process
|
import System.Posix.Process hiding (executeFile)
|
||||||
import System.Posix.IO
|
import System.Posix.IO
|
||||||
import System.IO
|
import System.IO
|
||||||
import System.IO.Error (try)
|
import System.IO.Error (try)
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
module RsyncFile where
|
module RsyncFile where
|
||||||
|
|
||||||
import System.Posix.Process
|
|
||||||
import Data.String.Utils
|
import Data.String.Utils
|
||||||
|
|
||||||
import Utility
|
import Utility
|
||||||
|
|
12
Utility.hs
12
Utility.hs
|
@ -17,6 +17,7 @@ module Utility (
|
||||||
relPathDirToFile,
|
relPathDirToFile,
|
||||||
boolSystem,
|
boolSystem,
|
||||||
boolSystemEnv,
|
boolSystemEnv,
|
||||||
|
executeFile,
|
||||||
shellEscape,
|
shellEscape,
|
||||||
shellUnEscape,
|
shellUnEscape,
|
||||||
unsetFileMode,
|
unsetFileMode,
|
||||||
|
@ -39,7 +40,8 @@ module Utility (
|
||||||
|
|
||||||
import System.IO
|
import System.IO
|
||||||
import System.Exit
|
import System.Exit
|
||||||
import System.Posix.Process
|
import qualified System.Posix.Process
|
||||||
|
import System.Posix.Process hiding (executeFile)
|
||||||
import System.Posix.Signals
|
import System.Posix.Signals
|
||||||
import System.Posix.Files
|
import System.Posix.Files
|
||||||
import System.Posix.Types
|
import System.Posix.Types
|
||||||
|
@ -52,6 +54,7 @@ import Foreign (complement)
|
||||||
import Data.List
|
import Data.List
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Control.Monad (liftM2, when, unless)
|
import Control.Monad (liftM2, when, unless)
|
||||||
|
import System.Log.Logger
|
||||||
|
|
||||||
{- A type for parameters passed to a shell command. A command can
|
{- A type for parameters passed to a shell command. A command can
|
||||||
- be passed either some Params (multiple parameters can be included,
|
- be passed either some Params (multiple parameters can be included,
|
||||||
|
@ -104,6 +107,13 @@ boolSystemEnv command params env = do
|
||||||
restoresignals oldint oldset
|
restoresignals oldint oldset
|
||||||
executeFile command True (toCommand params) env
|
executeFile command True (toCommand params) env
|
||||||
|
|
||||||
|
{- executeFile with debug logging -}
|
||||||
|
executeFile :: FilePath -> Bool -> [String] -> Maybe [(String, String)] -> IO a
|
||||||
|
executeFile c path p e = do
|
||||||
|
debugM "Utility.executeFile" $
|
||||||
|
"Running: " ++ c ++ " " ++ show p ++ " " ++ maybe "" show e
|
||||||
|
System.Posix.Process.executeFile c path p e
|
||||||
|
|
||||||
{- Escapes a filename or other parameter to be safely able to be exposed to
|
{- Escapes a filename or other parameter to be safely able to be exposed to
|
||||||
- the shell. -}
|
- the shell. -}
|
||||||
shellEscape :: String -> String
|
shellEscape :: String -> String
|
||||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -2,6 +2,7 @@ git-annex (0.20110517) UNRELEASED; urgency=low
|
||||||
|
|
||||||
* status: New subcommand to show info about an annex, including its size.
|
* status: New subcommand to show info about an annex, including its size.
|
||||||
* --backend now overrides any backend configured in .gitattributes files.
|
* --backend now overrides any backend configured in .gitattributes files.
|
||||||
|
* Add --debug option. Closes: #627499
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Mon, 16 May 2011 20:27:46 -0400
|
-- Joey Hess <joeyh@debian.org> Mon, 16 May 2011 20:27:46 -0400
|
||||||
|
|
||||||
|
|
|
@ -330,6 +330,10 @@ Many git-annex commands will stage changes for later `git commit` by you.
|
||||||
|
|
||||||
Enable verbose logging.
|
Enable verbose logging.
|
||||||
|
|
||||||
|
* --debug
|
||||||
|
|
||||||
|
Show debug messages.
|
||||||
|
|
||||||
* --from=repository
|
* --from=repository
|
||||||
|
|
||||||
Specifies a repository that content will be retrieved from, or that
|
Specifies a repository that content will be retrieved from, or that
|
||||||
|
|
Loading…
Reference in a new issue