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 url = do
|
||||
r <- Remote.claimingUrl url
|
||||
let url' = if Remote.uuid r == webUUID
|
||||
then url
|
||||
else setDownloader url OtherDownloader
|
||||
setUrlPresent (Remote.uuid r) key url'
|
||||
setUrlPresent (Remote.uuid r) key (setDownloader' url r)
|
||||
return True
|
||||
|
|
|
@ -31,8 +31,5 @@ start (file, url) = flip whenAnnexed file $ \_ key -> do
|
|||
cleanup :: String -> Key -> CommandCleanup
|
||||
cleanup url key = do
|
||||
r <- Remote.claimingUrl url
|
||||
let url' = if Remote.uuid r == webUUID
|
||||
then url
|
||||
else setDownloader url OtherDownloader
|
||||
setUrlMissing (Remote.uuid r) key url'
|
||||
setUrlMissing (Remote.uuid r) key (setDownloader' url r)
|
||||
return True
|
||||
|
|
|
@ -15,6 +15,7 @@ module Logs.Web (
|
|||
Downloader(..),
|
||||
getDownloader,
|
||||
setDownloader,
|
||||
setDownloader',
|
||||
setTempUrl,
|
||||
removeTempUrl,
|
||||
) where
|
||||
|
@ -32,6 +33,8 @@ import Annex.CatFile
|
|||
import qualified Git
|
||||
import qualified Git.LsFiles
|
||||
import Utility.Url
|
||||
import Annex.UUID
|
||||
import qualified Types.Remote as Remote
|
||||
|
||||
{- Gets all urls that a key might be available from. -}
|
||||
getUrls :: Key -> Annex [URLString]
|
||||
|
@ -108,6 +111,11 @@ setDownloader u WebDownloader = u
|
|||
setDownloader u QuviDownloader = "quvi:" ++ 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 u = case separate (== ':') u of
|
||||
("quvi", u') -> (u', QuviDownloader)
|
||||
|
|
Loading…
Reference in a new issue