--debug is passed along to git-annex-shell when git-annex is in debug mode.
This commit is contained in:
parent
34c848381f
commit
43aa881b47
5 changed files with 28 additions and 19 deletions
|
@ -49,7 +49,6 @@ import Network.Socket (SockAddr, HostName)
|
||||||
import Data.Text (pack, unpack)
|
import Data.Text (pack, unpack)
|
||||||
import qualified Network.Wai.Handler.WarpTLS as TLS
|
import qualified Network.Wai.Handler.WarpTLS as TLS
|
||||||
import Network.Wai.Middleware.RequestLogger
|
import Network.Wai.Middleware.RequestLogger
|
||||||
import System.Log.Logger
|
|
||||||
|
|
||||||
mkYesodDispatch "WebApp" $(parseRoutesFile "Assistant/WebApp/routes")
|
mkYesodDispatch "WebApp" $(parseRoutesFile "Assistant/WebApp/routes")
|
||||||
|
|
||||||
|
@ -138,9 +137,3 @@ getTlsSettings = do
|
||||||
#else
|
#else
|
||||||
return Nothing
|
return Nothing
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{- Checks if debugging is actually enabled. -}
|
|
||||||
debugEnabled :: IO Bool
|
|
||||||
debugEnabled = do
|
|
||||||
l <- getRootLogger
|
|
||||||
return $ getLevel l <= Just DEBUG
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ data PrefsForm = PrefsForm
|
||||||
, numCopies :: Int
|
, numCopies :: Int
|
||||||
, autoStart :: Bool
|
, autoStart :: Bool
|
||||||
, autoUpgrade :: AutoUpgrade
|
, autoUpgrade :: AutoUpgrade
|
||||||
, debugEnabled :: Bool
|
, enableDebug :: Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
prefsAForm :: PrefsForm -> MkAForm PrefsForm
|
prefsAForm :: PrefsForm -> MkAForm PrefsForm
|
||||||
|
@ -44,7 +44,7 @@ prefsAForm d = PrefsForm
|
||||||
<*> areq (selectFieldList autoUpgradeChoices)
|
<*> areq (selectFieldList autoUpgradeChoices)
|
||||||
(bfs autoUpgradeLabel) (Just $ autoUpgrade d)
|
(bfs autoUpgradeLabel) (Just $ autoUpgrade d)
|
||||||
<*> areq (checkBoxField `withNote` debugnote)
|
<*> areq (checkBoxField `withNote` debugnote)
|
||||||
"Enable debug logging" (Just $ debugEnabled d)
|
"Enable debug logging" (Just $ enableDebug d)
|
||||||
where
|
where
|
||||||
diskreservenote = [whamlet|<br>Avoid downloading files from other repositories when there is too little free disk space.|]
|
diskreservenote = [whamlet|<br>Avoid downloading files from other repositories when there is too little free disk space.|]
|
||||||
numcopiesnote = [whamlet|<br>Only drop a file after verifying that other repositories contain this many copies.|]
|
numcopiesnote = [whamlet|<br>Only drop a file after verifying that other repositories contain this many copies.|]
|
||||||
|
@ -98,8 +98,8 @@ storePrefs p = do
|
||||||
liftIO $ if autoStart p
|
liftIO $ if autoStart p
|
||||||
then addAutoStartFile here
|
then addAutoStartFile here
|
||||||
else removeAutoStartFile here
|
else removeAutoStartFile here
|
||||||
setConfig (annexConfig "debug") (boolConfig $ debugEnabled p)
|
setConfig (annexConfig "debug") (boolConfig $ enableDebug p)
|
||||||
liftIO $ if debugEnabled p
|
liftIO $ if enableDebug p
|
||||||
then enableDebugOutput
|
then enableDebugOutput
|
||||||
else disableDebugOutput
|
else disableDebugOutput
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ module Messages (
|
||||||
setupConsole,
|
setupConsole,
|
||||||
enableDebugOutput,
|
enableDebugOutput,
|
||||||
disableDebugOutput,
|
disableDebugOutput,
|
||||||
|
debugEnabled,
|
||||||
commandProgressDisabled,
|
commandProgressDisabled,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
@ -191,6 +192,12 @@ enableDebugOutput = updateGlobalLogger rootLoggerName $ setLevel DEBUG
|
||||||
disableDebugOutput :: IO ()
|
disableDebugOutput :: IO ()
|
||||||
disableDebugOutput = updateGlobalLogger rootLoggerName $ setLevel NOTICE
|
disableDebugOutput = updateGlobalLogger rootLoggerName $ setLevel NOTICE
|
||||||
|
|
||||||
|
{- Checks if debugging is enabled. -}
|
||||||
|
debugEnabled :: IO Bool
|
||||||
|
debugEnabled = do
|
||||||
|
l <- getRootLogger
|
||||||
|
return $ getLevel l <= Just DEBUG
|
||||||
|
|
||||||
{- Should commands that normally output progress messages have that
|
{- Should commands that normally output progress messages have that
|
||||||
- output disabled? -}
|
- output disabled? -}
|
||||||
commandProgressDisabled :: Annex Bool
|
commandProgressDisabled :: Annex Bool
|
||||||
|
|
|
@ -38,22 +38,30 @@ toRepo r gc sshcmd = do
|
||||||
- repository. -}
|
- repository. -}
|
||||||
git_annex_shell :: Git.Repo -> String -> [CommandParam] -> [(Field, String)] -> Annex (Maybe (FilePath, [CommandParam]))
|
git_annex_shell :: Git.Repo -> String -> [CommandParam] -> [(Field, String)] -> Annex (Maybe (FilePath, [CommandParam]))
|
||||||
git_annex_shell r command params fields
|
git_annex_shell r command params fields
|
||||||
| not $ Git.repoIsUrl r = return $ Just (shellcmd, shellopts ++ fieldopts)
|
| not $ Git.repoIsUrl r = do
|
||||||
|
shellopts <- getshellopts
|
||||||
|
return $ Just (shellcmd, shellopts ++ fieldopts)
|
||||||
| Git.repoIsSsh r = do
|
| Git.repoIsSsh r = do
|
||||||
gc <- Annex.getRemoteGitConfig r
|
gc <- Annex.getRemoteGitConfig r
|
||||||
u <- getRepoUUID r
|
u <- getRepoUUID r
|
||||||
sshparams <- toRepo r gc [Param $ sshcmd u gc]
|
shellopts <- getshellopts
|
||||||
|
let sshcmd = unwords $
|
||||||
|
fromMaybe shellcmd (remoteAnnexShell gc)
|
||||||
|
: map shellEscape (toCommand shellopts) ++
|
||||||
|
uuidcheck u ++
|
||||||
|
map shellEscape (toCommand fieldopts)
|
||||||
|
sshparams <- toRepo r gc [Param sshcmd]
|
||||||
return $ Just ("ssh", sshparams)
|
return $ Just ("ssh", sshparams)
|
||||||
| otherwise = return Nothing
|
| otherwise = return Nothing
|
||||||
where
|
where
|
||||||
dir = Git.repoPath r
|
dir = Git.repoPath r
|
||||||
shellcmd = "git-annex-shell"
|
shellcmd = "git-annex-shell"
|
||||||
shellopts = Param command : File dir : params
|
getshellopts = do
|
||||||
sshcmd u gc = unwords $
|
debug <- liftIO debugEnabled
|
||||||
fromMaybe shellcmd (remoteAnnexShell gc)
|
let params' = if debug
|
||||||
: map shellEscape (toCommand shellopts) ++
|
then Param "--debug" : params
|
||||||
uuidcheck u ++
|
else params
|
||||||
map shellEscape (toCommand fieldopts)
|
return (Param command : File dir : params')
|
||||||
uuidcheck NoUUID = []
|
uuidcheck NoUUID = []
|
||||||
uuidcheck (UUID u) = ["--uuid", u]
|
uuidcheck (UUID u) = ["--uuid", u]
|
||||||
fieldopts
|
fieldopts
|
||||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -3,6 +3,7 @@ git-annex (5.20150813) UNRELEASED; urgency=medium
|
||||||
* --debug log messages are now timestamped with fractional seconds.
|
* --debug log messages are now timestamped with fractional seconds.
|
||||||
* Sped up downloads of files from ssh remotes, reducing the
|
* Sped up downloads of files from ssh remotes, reducing the
|
||||||
non-data-transfer overhead 6x.
|
non-data-transfer overhead 6x.
|
||||||
|
* --debug is passed along to git-annex-shell when git-annex is in debug mode.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Wed, 12 Aug 2015 14:31:01 -0400
|
-- Joey Hess <id@joeyh.name> Wed, 12 Aug 2015 14:31:01 -0400
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue