summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-02-17 23:15:29 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-02-17 23:15:29 -0400
commit5bf07b3b5c9a798c3a50a775f42888e497f48732 (patch)
tree4387bfee5cf49da02f3d168dcbe11487b45548c1
parent1ed5e4d9e3084f5371eb318c500254e1547240e7 (diff)
Store web special remote url info in a more efficient location.
storing it in remotes/web/xx/yy/foo.log meant lots of extra directory objects in git. Now I use xx/yy/foo.log.web, which is just as unique, but more efficient since foo.log is there anyway. Of course, it still looks in the old location too.
-rw-r--r--Logs/Web.hs27
-rw-r--r--debian/changelog1
2 files changed, 17 insertions, 11 deletions
diff --git a/Logs/Web.hs b/Logs/Web.hs
index 62656b7ed..bd8777250 100644
--- a/Logs/Web.hs
+++ b/Logs/Web.hs
@@ -23,21 +23,26 @@ type URLString = String
webUUID :: UUID
webUUID = UUID "00000000-0000-0000-0000-000000000001"
-{- The urls for a key are stored in remote/web/hash/key.log
- - in the git-annex branch. -}
urlLog :: Key -> FilePath
-urlLog key = "remote/web" </> hashDirLower key </> keyFile key ++ ".log"
-oldurlLog :: Key -> FilePath
-{- A bug used to store the urls elsewhere. -}
-oldurlLog key = "remote/web" </> hashDirLower key </> show key ++ ".log"
+urlLog key = hashDirLower key </> keyFile key ++ ".log.web"
+
+{- Used to store the urls elsewhere. -}
+oldurlLogs :: Key -> [FilePath]
+oldurlLogs key =
+ [ "remote/web" </> hashDirLower key </> show key ++ ".log"
+ , "remote/web" </> hashDirLower key </> keyFile key ++ ".log"
+ ]
{- Gets all urls that a key might be available from. -}
getUrls :: Key -> Annex [URLString]
-getUrls key = do
- us <- currentLog (urlLog key)
- if null us
- then currentLog (oldurlLog key)
- else return us
+getUrls key = go $ urlLog key : oldurlLogs key
+ where
+ go [] = return []
+ go (l:ls) = do
+ us <- currentLog l
+ if null us
+ then go ls
+ else return us
{- Records a change in an url for a key. -}
setUrl :: Key -> URLString -> LogStatus -> Annex ()
diff --git a/debian/changelog b/debian/changelog
index 3315f8513..46d65df38 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -32,6 +32,7 @@ git-annex (3.20120124) UNRELEASED; urgency=low
* addurl: Add --pathdepth option.
* rekey: New plumbing level command, can be used to change the keys used
for files en masse.
+ * Store web special remote url info in a more efficient location.
-- Joey Hess <joeyh@debian.org> Tue, 24 Jan 2012 16:21:55 -0400