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.
This commit is contained in:
parent
1ed5e4d9e3
commit
5bf07b3b5c
2 changed files with 17 additions and 11 deletions
27
Logs/Web.hs
27
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 ()
|
||||
|
|
1
debian/changelog
vendored
1
debian/changelog
vendored
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue