summaryrefslogtreecommitdiff
path: root/Remote/Bup.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-05-17 03:10:13 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-05-17 03:13:11 -0400
commitc91929f6934fc4e94603d0fa004e824d5e2cfb65 (patch)
treee958f5b4dc1209afb90c786493164c351dea4b9a /Remote/Bup.hs
parent75a3f5027f74565d909fb940893636d081d9872a (diff)
add whenM and unlessM
Just more golfing.. I am pretty sure something in a library somewhere can do this, but I have been unable to find it.
Diffstat (limited to 'Remote/Bup.hs')
-rw-r--r--Remote/Bup.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/Remote/Bup.hs b/Remote/Bup.hs
index d2b771bf7..51a5d05d1 100644
--- a/Remote/Bup.hs
+++ b/Remote/Bup.hs
@@ -11,7 +11,7 @@ import qualified Data.ByteString.Lazy.Char8 as L
import IO
import Control.Exception.Extensible (IOException)
import qualified Data.Map as M
-import Control.Monad (unless, when)
+import Control.Monad (when)
import Control.Monad.State (liftIO)
import System.Process
import System.Exit
@@ -75,8 +75,7 @@ bupSetup u c = do
-- bup init will create the repository.
-- (If the repository already exists, bup init again appears safe.)
showNote "bup init"
- ok <- bup "init" buprepo []
- unless ok $ error "bup init failed"
+ bup "init" buprepo [] <|> error "bup init failed"
storeBupUUID u buprepo
@@ -172,9 +171,9 @@ storeBupUUID u buprepo = do
if Git.repoIsUrl r
then do
showNote "storing uuid"
- ok <- onBupRemote r boolSystem "git"
+ onBupRemote r boolSystem "git"
[Params $ "config annex.uuid " ++ u]
- unless ok $ do error "ssh failed"
+ <|> error "ssh failed"
else liftIO $ do
r' <- Git.configRead r
let olduuid = Git.configGet r' "annex.uuid" ""