summaryrefslogtreecommitdiff
path: root/UUID.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-06-22 16:02:22 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-06-22 16:02:22 -0400
commit80274f4c92397a88c62bf82459fe0c1a9bf03bf7 (patch)
treecc2acbefc51be921c0a61011f333378771aedac4 /UUID.hs
parentae2be332d463bb2942c5951ffa4acf4d32d63ce2 (diff)
use git-annex branch for uuid.log
Diffstat (limited to 'UUID.hs')
-rw-r--r--UUID.hs16
1 files changed, 5 insertions, 11 deletions
diff --git a/UUID.hs b/UUID.hs
index f222f7a9d..c02f51480 100644
--- a/UUID.hs
+++ b/UUID.hs
@@ -30,11 +30,10 @@ import qualified Data.Map as M
import Data.Maybe
import qualified GitRepo as Git
+import qualified Branch
import Types
import Types.UUID
-import Locations
import qualified Annex
-import Utility
import qualified SysConfig
import Config
@@ -103,26 +102,21 @@ describeUUID :: UUID -> String -> Annex ()
describeUUID uuid desc = do
m <- uuidMap
let m' = M.insert uuid desc m
- logfile <- uuidLog
- liftIO $ safeWriteFile logfile (serialize m')
+ Branch.change uuidLog (serialize m')
where
serialize m = unlines $ map (\(u, d) -> u++" "++d) $ M.toList m
{- Read and parse the uuidLog into a Map -}
uuidMap :: Annex (M.Map UUID String)
uuidMap = do
- logfile <- uuidLog
- s <- liftIO $ catch (readFile logfile) ignoreerror
+ s <- Branch.get uuidLog
return $ M.fromList $ map pair $ lines s
where
pair l =
if 1 < length (words l)
then (head $ words l, unwords $ drop 1 $ words l)
else ("", "")
- ignoreerror _ = return ""
{- Filename of uuid.log. -}
-uuidLog :: Annex FilePath
-uuidLog = do
- g <- Annex.gitRepo
- return $ gitStateDir g ++ "uuid.log"
+uuidLog :: FilePath
+uuidLog = "uuid.log"