From 4e88f7e9af6a776347649047f2473e470a729ed9 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 11 Dec 2014 14:09:57 -0400 Subject: Revert "let url claims optionally include a suggested filename" This reverts commit bc0bf97b20c48e1d1a35d25e2e76a311c102438c. Putting filename in the claim was a bad idea. --- Command/AddUrl.hs | 15 +++++++-------- Command/ReKey.hs | 3 +-- Command/RmUrl.hs | 3 +-- Command/Whereis.hs | 3 +-- 4 files changed, 10 insertions(+), 14 deletions(-) (limited to 'Command') diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs index 27c8359b0..76095d6e4 100644 --- a/Command/AddUrl.hs +++ b/Command/AddUrl.hs @@ -21,7 +21,6 @@ import qualified Annex.Url as Url import qualified Backend.URL import qualified Remote import qualified Types.Remote as Remote -import Annex.URLClaim import Annex.Content import Logs.Web import Types.Key @@ -59,23 +58,23 @@ seek ps = do start :: Bool -> Maybe FilePath -> Maybe Int -> String -> CommandStart start relaxed optfile pathdepth s = do - (r, claim) <- urlClaim s + r <- Remote.claimingUrl s if Remote.uuid r == webUUID then startWeb relaxed optfile pathdepth s - else startRemote r claim relaxed optfile pathdepth s + else startRemote r relaxed optfile pathdepth s -startRemote :: Remote -> URLClaim -> Bool -> Maybe FilePath -> Maybe Int -> String -> CommandStart -startRemote r claim relaxed optfile pathdepth s = do +startRemote :: Remote -> Bool -> Maybe FilePath -> Maybe Int -> String -> CommandStart +startRemote r relaxed optfile pathdepth s = do url <- case Url.parseURIRelaxed s of Nothing -> error $ "bad uri " ++ s Just u -> pure u pathmax <- liftIO $ fileNameLengthLimit "." - let file = flip fromMaybe optfile $ case claim of - URLClaimedAs f -> f - URLClaimed -> url2file url pathdepth pathmax + let file = choosefile $ url2file url pathdepth pathmax showStart "addurl" file showNote $ "using " ++ Remote.name r next $ performRemote r relaxed s file + where + choosefile = flip fromMaybe optfile performRemote :: Remote -> Bool -> URLString -> FilePath -> CommandPerform performRemote r relaxed uri file = ifAnnexed file adduri geturi diff --git a/Command/ReKey.hs b/Command/ReKey.hs index a0348d858..5dadf4e60 100644 --- a/Command/ReKey.hs +++ b/Command/ReKey.hs @@ -16,7 +16,6 @@ import qualified Command.Add import Logs.Web import Logs.Location import Utility.CopyFile -import Annex.URLClaim import qualified Remote cmd :: [Command] @@ -64,7 +63,7 @@ cleanup file oldkey newkey = do -- the new key as well. urls <- getUrls oldkey forM_ urls $ \url -> do - r <- fst <$> urlClaim url + r <- Remote.claimingUrl url setUrlPresent (Remote.uuid r) newkey url -- Update symlink to use the new key. diff --git a/Command/RmUrl.hs b/Command/RmUrl.hs index 737c935c5..570004266 100644 --- a/Command/RmUrl.hs +++ b/Command/RmUrl.hs @@ -10,7 +10,6 @@ module Command.RmUrl where import Common.Annex import Command import Logs.Web -import Annex.URLClaim import qualified Remote cmd :: [Command] @@ -28,7 +27,7 @@ start (file, url) = flip whenAnnexed file $ \_ key -> do cleanup :: String -> Key -> CommandCleanup cleanup url key = do - r <- fst <$> urlClaim url + r <- Remote.claimingUrl url let url' = if Remote.uuid r == webUUID then url else setDownloader url OtherDownloader diff --git a/Command/Whereis.hs b/Command/Whereis.hs index 5f75badde..314c204be 100644 --- a/Command/Whereis.hs +++ b/Command/Whereis.hs @@ -14,7 +14,6 @@ import Command import Remote import Logs.Trust import Logs.Web -import Annex.URLClaim cmd :: [Command] cmd = [noCommit $ withOptions (jsonOption : keyOptions) $ @@ -72,4 +71,4 @@ performRemote key remote = do . filter (\(_, d) -> d == OtherDownloader) . map getDownloader <$> getUrls key - filterM (\u -> (==) <$> pure remote <*> (fst <$> urlClaim u)) us + filterM (\u -> (==) <$> pure remote <*> claimingUrl u) us -- cgit v1.2.3