diff options
author | Joey Hess <joey@kitenet.net> | 2012-01-24 15:28:13 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-01-24 16:22:07 -0400 |
commit | ce5637498fd4158f98376009dee2d22bec2d1f68 (patch) | |
tree | e529bad846ce43424c9b535206b75f3b53f6cdee /Remote | |
parent | ba6088b249902d456177af3c14f20f43b6def1fd (diff) |
remove Utility.Conditional and use IfElse
This drops the >>! and >>? with the nice low fixity. IfElse does have
undocumented >>=>>! and >>=>>? operators, but I deem that too fishy.
Anyway, using whenM and unlessM is easier; I sometimes mixed the operators
up.
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/Bup.hs | 8 | ||||
-rw-r--r-- | Remote/Directory.hs | 4 | ||||
-rw-r--r-- | Remote/Rsync.hs | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/Remote/Bup.hs b/Remote/Bup.hs index 7329167da..9b54d8c85 100644 --- a/Remote/Bup.hs +++ b/Remote/Bup.hs @@ -69,7 +69,7 @@ bupSetup u c = do -- bup init will create the repository. -- (If the repository already exists, bup init again appears safe.) showAction "bup init" - bup "init" buprepo [] >>! error "bup init failed" + unlessM (bup "init" buprepo []) $ error "bup init failed" storeBupUUID u buprepo @@ -167,9 +167,9 @@ storeBupUUID u buprepo = do if Git.repoIsUrl r then do showAction "storing uuid" - onBupRemote r boolSystem "git" - [Params $ "config annex.uuid " ++ v] - >>! error "ssh failed" + unlessM (onBupRemote r boolSystem "git" + [Params $ "config annex.uuid " ++ v]) $ + error "ssh failed" else liftIO $ do r' <- Git.Config.read r let olduuid = Git.Config.get "annex.uuid" "" r' diff --git a/Remote/Directory.hs b/Remote/Directory.hs index 52f426340..85f644607 100644 --- a/Remote/Directory.hs +++ b/Remote/Directory.hs @@ -55,8 +55,8 @@ directorySetup u c = do -- verify configuration is sane let dir = fromMaybe (error "Specify directory=") $ M.lookup "directory" c - liftIO $ doesDirectoryExist dir - >>! error $ "Directory does not exist: " ++ dir + liftIO $ unlessM (doesDirectoryExist dir) $ + error $ "Directory does not exist: " ++ dir c' <- encryptionSetup c -- The directory is stored in git config, not in this remote's diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs index 8de6ba6a7..c7efe4200 100644 --- a/Remote/Rsync.hs +++ b/Remote/Rsync.hs @@ -181,8 +181,8 @@ withRsyncScratchDir a = do liftIO $ createDirectoryIfMissing True tmp nuke tmp `after` a tmp where - nuke d = liftIO $ - doesDirectoryExist d >>? removeDirectoryRecursive d + nuke d = liftIO $ whenM (doesDirectoryExist d) $ + removeDirectoryRecursive d rsyncRemote :: RsyncOpts -> [CommandParam] -> Annex Bool rsyncRemote o params = do |