summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-01-02 14:20:20 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-01-02 14:20:20 -0400
commitaa0882691bb2aa64fb13f0df85be0469fd33d98d (patch)
tree365eff7f04e32c88d0c5fbe09fe206be3532aad9 /Annex
parent50ebfd265fca5271772ea35ed0aad834a8299298 (diff)
Added remote.name.annex-web-options configuration setting, which can be used to provide parameters to whichever of wget or curl git-annex uses (depends on which is available, but most of their important options suitable for use here are the same).
Diffstat (limited to 'Annex')
-rw-r--r--Annex/Content.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs
index 3f1db37b5..1713b5e12 100644
--- a/Annex/Content.hs
+++ b/Annex/Content.hs
@@ -20,7 +20,8 @@ module Annex.Content (
fromAnnex,
moveBad,
getKeysPresent,
- saveState
+ saveState,
+ downloadUrl,
) where
import System.IO.Error (try)
@@ -36,6 +37,7 @@ import qualified Annex.Queue
import qualified Annex.Branch
import Utility.StatFS
import Utility.FileMode
+import qualified Utility.Url as Url
import Types.Key
import Utility.DataUnits
import Config
@@ -281,3 +283,10 @@ saveState :: Annex ()
saveState = do
Annex.Queue.flush False
Annex.Branch.commit "update"
+
+{- Downloads content from any of a list of urls. -}
+downloadUrl :: [Url.URLString] -> FilePath -> Annex Bool
+downloadUrl urls file = do
+ g <- gitRepo
+ o <- map Param . words <$> getConfig g "web-options" ""
+ liftIO $ anyM (\u -> Url.download u o file) urls