dropping from web
This commit is contained in:
parent
67e82b1c3d
commit
ea5d7292e6
4 changed files with 25 additions and 17 deletions
25
Logs/Web.hs
25
Logs/Web.hs
|
@ -8,9 +8,9 @@
|
||||||
module Logs.Web (
|
module Logs.Web (
|
||||||
URLString,
|
URLString,
|
||||||
webUUID,
|
webUUID,
|
||||||
setUrl,
|
getUrls,
|
||||||
setUrlPresent,
|
setUrlPresent,
|
||||||
getUrls
|
setUrlMissing,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Common.Annex
|
import Common.Annex
|
||||||
|
@ -45,16 +45,13 @@ getUrls key = go $ urlLog key : oldurlLogs key
|
||||||
then go ls
|
then go ls
|
||||||
else return us
|
else return us
|
||||||
|
|
||||||
{- Records a change in an url for a key. -}
|
|
||||||
setUrl :: Key -> URLString -> LogStatus -> Annex ()
|
|
||||||
setUrl key url status = 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)
|
|
||||||
|
|
||||||
setUrlPresent :: Key -> URLString -> Annex ()
|
setUrlPresent :: Key -> URLString -> Annex ()
|
||||||
setUrlPresent key url = setUrl key url InfoPresent
|
setUrlPresent key url = do
|
||||||
|
us <- getUrls key
|
||||||
|
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
|
||||||
|
|
||||||
|
setUrlMissing :: Key -> URLString -> Annex ()
|
||||||
|
setUrlMissing key url = addLog (urlLog key) =<< logNow InfoMissing url
|
||||||
|
|
|
@ -72,9 +72,9 @@ uploadKey _ _ _ = do
|
||||||
return False
|
return False
|
||||||
|
|
||||||
dropKey :: Key -> Annex Bool
|
dropKey :: Key -> Annex Bool
|
||||||
dropKey _ = do
|
dropKey k = do
|
||||||
warning "removal from web not supported"
|
mapM_ (setUrlMissing k) =<< getUrls k
|
||||||
return False
|
return True
|
||||||
|
|
||||||
checkKey :: Key -> Annex (Either String Bool)
|
checkKey :: Key -> Annex (Either String Bool)
|
||||||
checkKey key = do
|
checkKey key = do
|
||||||
|
|
3
debian/changelog
vendored
3
debian/changelog
vendored
|
@ -8,6 +8,9 @@ git-annex (3.20121128) UNRELEASED; urgency=low
|
||||||
* watch: Avoid leaving hard links to files behind in .git/annex/tmp
|
* 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
|
if a file is deleted or moved while it's being quarantined in preparation
|
||||||
to being added to the annex.
|
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
|
-- Joey Hess <joeyh@debian.org> Wed, 28 Nov 2012 13:31:07 -0400
|
||||||
|
|
||||||
|
|
|
@ -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.
|
#Please provide any additional information below.
|
||||||
|
|
||||||
This seems to be a corner case, and would probably have minimal impact on most people.
|
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]]
|
||||||
|
|
Loading…
Reference in a new issue