module VCSWrapper.Svn.Process (
svnExec
, svnExec_
, svnExec'
, svnExecNoEnvir
, svnExecNoEnvirNoOpts
, module VCSWrapper.Common.Process
) where
import VCSWrapper.Common.Process
import VCSWrapper.Common.Types
import Control.Monad.Reader(ask)
import qualified Control.Exception as Exc
svnExec_ :: String
-> [String]
-> Maybe String
-> [String]
-> Ctx()
svnExec_ cmd cmdOpts pw opts = do
config <- ask
let mbAuthor = configAuthor config
let builtOpts = (pwopts pw)++(authopts mbAuthor)++opts
svnExecNoEnvir cmd $ builtOpts ++ cmdOpts
return()
where
useropts Nothing = []
useropts (Just u) = ["--username",u]
pwopts Nothing = []
pwopts (Just p) = ["--password",p]
authopts Nothing = []
authopts (Just a) = ["--username", authorName a]
svnExecNoEnvirNoOpts :: String
-> Ctx String
svnExecNoEnvirNoOpts cmd = svnExecNoEnvir cmd []
svnExecNoEnvir :: String
-> [String]
-> Ctx String
svnExecNoEnvir cmd opts = svnExec cmd opts []
svnExec :: String
-> [String]
-> [(String, String)]
-> Ctx String
svnExec cmd opts = do
let extOpts = opts++globalOpts
vcsExecThrowingOnError "svn" cmd extOpts
where
globalOpts = ["--non-interactive"]++["--no-auth-cache"]
svnExec' :: String
-> [String]
-> [(String, String)]
-> Ctx (Either VCSException String)
svnExec' cmd opts = do
let extOpts = opts++globalOpts
vcsExec "svn" cmd extOpts
where
globalOpts = ["--non-interactive"]++["--no-auth-cache"]