summaryrefslogtreecommitdiff
path: root/Logs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-03-31 13:29:51 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-03-31 13:30:13 -0400
commit23e90f6f3cb5a570e8bf9eb3d2798c27a5ba2537 (patch)
tree6d6eab72231cb43bce52f0b332315b044b91341f /Logs
parent41f7627baee212ce4a4a75126109d9569c790dd0 (diff)
importfeed: Avoid downloading a redundant item from a feed whose guid has been downloaded before, even when the url has changed.
To support this, always store itemid in metadata; before this was only done when annex.genmetadata was set.
Diffstat (limited to 'Logs')
-rw-r--r--Logs/Web.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/Logs/Web.hs b/Logs/Web.hs
index ed2f575bd..02d60170f 100644
--- a/Logs/Web.hs
+++ b/Logs/Web.hs
@@ -21,7 +21,6 @@ module Logs.Web (
import qualified Data.ByteString.Lazy.Char8 as L
import qualified Data.Map as M
-import Data.Tuple.Utils
import Common.Annex
import qualified Annex
@@ -70,7 +69,7 @@ setUrlMissing uuid key url = do
logChange key uuid InfoMissing
{- Finds all known urls. -}
-knownUrls :: Annex [URLString]
+knownUrls :: Annex [(Key, URLString)]
knownUrls = do
{- Ensure the git-annex branch's index file is up-to-date and
- any journaled changes are reflected in it, since we're going
@@ -80,10 +79,13 @@ knownUrls = do
Annex.Branch.withIndex $ do
top <- fromRepo Git.repoPath
(l, cleanup) <- inRepo $ Git.LsFiles.stagedDetails [top]
- r <- mapM (geturls . snd3) $ filter (isUrlLog . fst3) l
+ r <- mapM getkeyurls l
void $ liftIO cleanup
return $ concat r
where
+ getkeyurls (f, s, _) = case urlLogFileKey f of
+ Just k -> zip (repeat k) <$> geturls s
+ Nothing -> return []
geturls Nothing = return []
geturls (Just logsha) = getLog . L.unpack <$> catObject logsha