refactor git-annex branch log filename code into central location

Having one module that knows about all the filenames used on the branch
allows working back from an arbitrary filename to enough information about
it to implement dropping dead remotes and doing other log file compacting
as part of a forget transition.
This commit is contained in:
Joey Hess 2013-08-29 18:51:22 -04:00
parent 6147652cc6
commit 62beaa1a86
12 changed files with 136 additions and 74 deletions

View file

@ -12,9 +12,9 @@ import qualified Git
import qualified Git.Command
import qualified Git.Ref
import qualified Annex.Branch
import Logs.Location
import Annex.Content
import Utility.Tmp
import Logs
olddir :: Git.Repo -> FilePath
olddir g
@ -47,7 +47,7 @@ upgrade = do
e <- liftIO $ doesDirectoryExist old
when e $ do
mapM_ (\(k, f) -> inject f $ logFile k) =<< locationLogs
mapM_ (\(k, f) -> inject f $ locationLogFile k) =<< locationLogs
mapM_ (\f -> inject f f) =<< logFiles old
saveState False
@ -73,7 +73,7 @@ locationLogs = do
where
tryDirContents d = catchDefaultIO [] $ dirContents d
islogfile f = maybe Nothing (\k -> Just (k, f)) $
logFileKey $ takeFileName f
locationLogFileKey f
inject :: FilePath -> FilePath -> Annex ()
inject source dest = do