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.
This commit is contained in:
parent
b6ce003843
commit
0c88d9395d
3 changed files with 84 additions and 13 deletions
|
@ -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 =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue