diff options
author | Joey Hess <joey@kitenet.net> | 2012-10-10 13:52:24 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-10-10 13:54:40 -0400 |
commit | a5c3a2fbf523a22fbfcc7b7d419a56b88e6d8d12 (patch) | |
tree | f6e8474444dca5938ab991136932ba71d6873561 /Logs/UUIDBased.hs | |
parent | cf30e43a0d5d0c3c76d25daca678ec8cc80dc814 (diff) |
standard preferred content settings for client, transfer, backup, and archive repositories
I've designed these to work well together, I hope. If I get it wrong,
I can just change the code in one place, since these expressions
won't be stored in the git-annex branch.
Diffstat (limited to 'Logs/UUIDBased.hs')
-rw-r--r-- | Logs/UUIDBased.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Logs/UUIDBased.hs b/Logs/UUIDBased.hs index 847d49923..674ac2184 100644 --- a/Logs/UUIDBased.hs +++ b/Logs/UUIDBased.hs @@ -17,6 +17,7 @@ module Logs.UUIDBased ( LogEntry(..), TimeStamp(..), parseLog, + parseLogWithUUID, showLog, changeLog, addLog, @@ -56,15 +57,18 @@ showLog shower = unlines . map showpair . M.toList unwords [fromUUID k, shower v] parseLog :: (String -> Maybe a) -> String -> Log a -parseLog parser = M.fromListWith best . mapMaybe parse . lines +parseLog = parseLogWithUUID . const + +parseLogWithUUID :: (UUID -> String -> Maybe a) -> String -> Log a +parseLogWithUUID parser = M.fromListWith best . mapMaybe parse . lines where parse line | null ws = Nothing - | otherwise = parser (unwords info) >>= makepair + | otherwise = parser u (unwords info) >>= makepair where - makepair v = Just (toUUID u, LogEntry ts v) + makepair v = Just (u, LogEntry ts v) ws = words line - u = Prelude.head ws + u = toUUID $ Prelude.head ws t = Prelude.last ws ts | tskey `isPrefixOf` t = |