diff options
author | 2011-10-15 16:36:56 -0400 | |
---|---|---|
committer | 2011-10-15 16:36:56 -0400 | |
commit | ec169f84b1cc140b6d4c316fbd0e8407297d038a (patch) | |
tree | b28d538df9249c7f03581696d23a9371e7ec9ffb /Command | |
parent | b4015064e1492c6591f69499d8d745989999ba53 (diff) |
migrate: Copy url logs for keys when migrating.
Diffstat (limited to 'Command')
-rw-r--r-- | Command/AddUrl.hs | 7 | ||||
-rw-r--r-- | Command/Migrate.hs | 9 |
2 files changed, 12 insertions, 4 deletions
diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs index 4447dee81..2756af880 100644 --- a/Command/AddUrl.hs +++ b/Command/AddUrl.hs @@ -13,12 +13,11 @@ import Common.Annex import Command import qualified Backend import qualified Utility.Url as Url -import qualified Remote.Web import qualified Command.Add import qualified Annex import qualified Backend.URL import Annex.Content -import Logs.Presence +import Logs.Web command :: [Command] command = [repoCommand "addurl" (paramRepeating paramUrl) seek @@ -58,14 +57,14 @@ download url file = do Nothing -> stop Just (key, _) -> do moveAnnex key tmp - Remote.Web.setUrl key url InfoPresent + setUrlPresent key url next $ Command.Add.cleanup file key True else stop nodownload :: String -> FilePath -> CommandPerform nodownload url file = do let key = Backend.URL.fromUrl url - Remote.Web.setUrl key url InfoPresent + setUrlPresent key url next $ Command.Add.cleanup file key False diff --git a/Command/Migrate.hs b/Command/Migrate.hs index 23ed6fd16..8167ac96e 100644 --- a/Command/Migrate.hs +++ b/Command/Migrate.hs @@ -14,6 +14,7 @@ import qualified Types.Key import Annex.Content import qualified Command.Add import Backend +import Logs.Web command :: [Command] command = [repoCommand "migrate" paramPaths seek @@ -65,6 +66,14 @@ perform file oldkey newbackend = do then do -- Update symlink to use the new key. liftIO $ removeFile file + + -- If the old key had some + -- associated urls, record them for + -- the new key as well. + urls <- getUrls oldkey + when (not $ null urls) $ + mapM_ (setUrlPresent newkey) urls + next $ Command.Add.cleanup file newkey True else stop where |