aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-11-29 17:01:07 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-11-29 17:01:07 -0400
commit3a69632859e929d3d2292da9528a89346b1602a2 (patch)
treec34884d1d1326cfe78f2209dde2d7377a5daf49f
parentd2ef4f93d1f4426f93020e56aeaea5e2ac8267c6 (diff)
dropping from web
-rw-r--r--Logs/Web.hs23
-rw-r--r--Remote/Web.hs6
-rw-r--r--debian/changelog3
-rw-r--r--doc/bugs/dropping_and_re-adding_from_web_remotes_doesn__39__t_work.mdwn8
4 files changed, 24 insertions, 16 deletions
diff --git a/Logs/Web.hs b/Logs/Web.hs
index c2a4deb7d..7cfad8648 100644
--- a/Logs/Web.hs
+++ b/Logs/Web.hs
@@ -8,9 +8,9 @@
module Logs.Web (
URLString,
webUUID,
- setUrl,
+ getUrls,
setUrlPresent,
- getUrls
+ setUrlMissing,
) where
import Common.Annex
@@ -45,16 +45,13 @@ getUrls key = go $ urlLog key : oldurlLogs key
then go ls
else return us
-{- Records a change in an url for a key. -}
-setUrl :: Key -> URLString -> LogStatus -> Annex ()
-setUrl key url status = do
+setUrlPresent :: Key -> URLString -> Annex ()
+setUrlPresent key url = do
us <- getUrls key
- unless (status == InfoPresent && url `elem` us) $ do
- addLog (urlLog key) =<< logNow status url
-
- -- update location log to indicate that the web has the key, or not
- us' <- getUrls key
- logChange key webUUID (if null us' then InfoMissing else InfoPresent)
+ unless (url `elem` us) $ do
+ addLog (urlLog key) =<< logNow InfoPresent url
+ -- update location log to indicate that the web has the key
+ logChange key webUUID InfoPresent
-setUrlPresent :: Key -> URLString -> Annex ()
-setUrlPresent key url = setUrl key url InfoPresent
+setUrlMissing :: Key -> URLString -> Annex ()
+setUrlMissing key url = addLog (urlLog key) =<< logNow InfoMissing url
diff --git a/Remote/Web.hs b/Remote/Web.hs
index d722374ed..e51a73901 100644
--- a/Remote/Web.hs
+++ b/Remote/Web.hs
@@ -72,9 +72,9 @@ uploadKey _ _ _ = do
return False
dropKey :: Key -> Annex Bool
-dropKey _ = do
- warning "removal from web not supported"
- return False
+dropKey k = do
+ mapM_ (setUrlMissing k) =<< getUrls k
+ return True
checkKey :: Key -> Annex (Either String Bool)
checkKey key = do
diff --git a/debian/changelog b/debian/changelog
index 66c29a634..2a68d50c2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,6 +8,9 @@ git-annex (3.20121128) UNRELEASED; urgency=low
* watch: Avoid leaving hard links to files behind in .git/annex/tmp
if a file is deleted or moved while it's being quarantined in preparation
to being added to the annex.
+ * Allow `git annex drop --from web`; of course this does not remove
+ any file from the web, but it does make git-annex remove all urls
+ associated with a file.
-- Joey Hess <joeyh@debian.org> Wed, 28 Nov 2012 13:31:07 -0400
diff --git a/doc/bugs/dropping_and_re-adding_from_web_remotes_doesn__39__t_work.mdwn b/doc/bugs/dropping_and_re-adding_from_web_remotes_doesn__39__t_work.mdwn
index f0eb90555..30327ba1f 100644
--- a/doc/bugs/dropping_and_re-adding_from_web_remotes_doesn__39__t_work.mdwn
+++ b/doc/bugs/dropping_and_re-adding_from_web_remotes_doesn__39__t_work.mdwn
@@ -129,3 +129,11 @@ When re-adding the URL, I expect the file to be re-added to the web remote. (not
#Please provide any additional information below.
This seems to be a corner case, and would probably have minimal impact on most people.
+
+> Yeah, dropping from the web is pretty weird.
+>
+> I guess it makes sense to do if a website stops having a file and you don't
+> want git-annex to try to download from it anymore. So, I've made dropping
+> from the web remove all urls associated with the file, rather than failing.
+>
+> [[done]] --[[Joey]]