refactor
This commit is contained in:
parent
68edd308af
commit
1f3358512a
3 changed files with 10 additions and 8 deletions
|
@ -55,8 +55,5 @@ perform key url = do
|
||||||
perform' :: Key -> URLString -> Annex Bool
|
perform' :: Key -> URLString -> Annex Bool
|
||||||
perform' key url = do
|
perform' key url = do
|
||||||
r <- Remote.claimingUrl url
|
r <- Remote.claimingUrl url
|
||||||
let url' = if Remote.uuid r == webUUID
|
setUrlPresent (Remote.uuid r) key (setDownloader' url r)
|
||||||
then url
|
|
||||||
else setDownloader url OtherDownloader
|
|
||||||
setUrlPresent (Remote.uuid r) key url'
|
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -31,8 +31,5 @@ start (file, url) = flip whenAnnexed file $ \_ key -> do
|
||||||
cleanup :: String -> Key -> CommandCleanup
|
cleanup :: String -> Key -> CommandCleanup
|
||||||
cleanup url key = do
|
cleanup url key = do
|
||||||
r <- Remote.claimingUrl url
|
r <- Remote.claimingUrl url
|
||||||
let url' = if Remote.uuid r == webUUID
|
setUrlMissing (Remote.uuid r) key (setDownloader' url r)
|
||||||
then url
|
|
||||||
else setDownloader url OtherDownloader
|
|
||||||
setUrlMissing (Remote.uuid r) key url'
|
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -15,6 +15,7 @@ module Logs.Web (
|
||||||
Downloader(..),
|
Downloader(..),
|
||||||
getDownloader,
|
getDownloader,
|
||||||
setDownloader,
|
setDownloader,
|
||||||
|
setDownloader',
|
||||||
setTempUrl,
|
setTempUrl,
|
||||||
removeTempUrl,
|
removeTempUrl,
|
||||||
) where
|
) where
|
||||||
|
@ -32,6 +33,8 @@ import Annex.CatFile
|
||||||
import qualified Git
|
import qualified Git
|
||||||
import qualified Git.LsFiles
|
import qualified Git.LsFiles
|
||||||
import Utility.Url
|
import Utility.Url
|
||||||
|
import Annex.UUID
|
||||||
|
import qualified Types.Remote as Remote
|
||||||
|
|
||||||
{- Gets all urls that a key might be available from. -}
|
{- Gets all urls that a key might be available from. -}
|
||||||
getUrls :: Key -> Annex [URLString]
|
getUrls :: Key -> Annex [URLString]
|
||||||
|
@ -108,6 +111,11 @@ setDownloader u WebDownloader = u
|
||||||
setDownloader u QuviDownloader = "quvi:" ++ u
|
setDownloader u QuviDownloader = "quvi:" ++ u
|
||||||
setDownloader u OtherDownloader = ":" ++ u
|
setDownloader u OtherDownloader = ":" ++ u
|
||||||
|
|
||||||
|
setDownloader' :: URLString -> Remote -> String
|
||||||
|
setDownloader' u r
|
||||||
|
| Remote.uuid r == webUUID = setDownloader u WebDownloader
|
||||||
|
| otherwise = setDownloader u OtherDownloader
|
||||||
|
|
||||||
getDownloader :: URLString -> (URLString, Downloader)
|
getDownloader :: URLString -> (URLString, Downloader)
|
||||||
getDownloader u = case separate (== ':') u of
|
getDownloader u = case separate (== ':') u of
|
||||||
("quvi", u') -> (u', QuviDownloader)
|
("quvi", u') -> (u', QuviDownloader)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue