summaryrefslogtreecommitdiff
path: root/Remote/Rsync.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-03-15 20:39:25 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-03-15 20:39:25 -0400
commitc0c9991c9f5322aef05f4c97d2c3f3bdc3101e46 (patch)
tree9cdd4f7913659329283e8d909fa7c4f98cc567f0 /Remote/Rsync.hs
parentff8b6c1bab519f243b67219cc2b43d037b3fa4e2 (diff)
nukes another 15 lines thanks to ifM
Diffstat (limited to 'Remote/Rsync.hs')
-rw-r--r--Remote/Rsync.hs24
1 files changed, 10 insertions, 14 deletions
diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs
index 577ea0b04..03c9911d7 100644
--- a/Remote/Rsync.hs
+++ b/Remote/Rsync.hs
@@ -113,20 +113,16 @@ retrieve o k f = untilTrue (rsyncUrls o k) $ \u -> rsyncRemote o
]
retrieveCheap :: RsyncOpts -> Key -> FilePath -> Annex Bool
-retrieveCheap o k f = do
- ok <- preseedTmp k f
- if ok
- then retrieve o k f
- else return False
+retrieveCheap o k f = ifM (preseedTmp k f) ( retrieve o k f , return False )
retrieveEncrypted :: RsyncOpts -> (Cipher, Key) -> Key -> FilePath -> Annex Bool
retrieveEncrypted o (cipher, enck) _ f = withTmp enck $ \tmp -> do
- res <- retrieve o enck tmp
- if res
- then liftIO $ catchBoolIO $ do
+ ifM (retrieve o enck tmp)
+ ( liftIO $ catchBoolIO $ do
withDecryptedContent cipher (L.readFile tmp) $ L.writeFile f
return True
- else return res
+ , return False
+ )
remove :: RsyncOpts -> Key -> Annex Bool
remove o k = withRsyncScratchDir $ \tmp -> liftIO $ do
@@ -188,12 +184,12 @@ withRsyncScratchDir a = do
rsyncRemote :: RsyncOpts -> [CommandParam] -> Annex Bool
rsyncRemote o params = do
showOutput -- make way for progress bar
- res <- liftIO $ rsync $ rsyncOptions o ++ defaultParams ++ params
- if res
- then return res
- else do
+ ifM (liftIO $ rsync $ rsyncOptions o ++ defaultParams ++ params)
+ ( return True
+ , do
showLongNote "rsync failed -- run git annex again to resume file transfer"
- return res
+ return False
+ )
where
defaultParams = [Params "--progress"]