add a UUID type

Should have done this a long time ago.
This commit is contained in:
Joey Hess 2011-11-07 14:46:01 -04:00
parent b08f7c428b
commit 63a292324d
18 changed files with 67 additions and 55 deletions

View file

@ -29,16 +29,15 @@ import Logs.Presence
{- Log a change in the presence of a key's value in a repository. -}
logChange :: Git.Repo -> Key -> UUID -> LogStatus -> Annex ()
logChange repo key u s
| null u = error $
"unknown UUID for " ++ Git.repoDescribe repo ++
" (have you run git annex init there?)"
| otherwise = addLog (logFile key) =<< logNow s u
logChange _ key (UUID u) s = addLog (logFile key) =<< logNow s u
logChange repo _ NoUUID _ = error $
"unknown UUID for " ++ Git.repoDescribe repo ++
" (have you run git annex init there?)"
{- Returns a list of repository UUIDs that, according to the log, have
- the value of a key. -}
keyLocations :: Key -> Annex [UUID]
keyLocations = currentLog . logFile
keyLocations key = map read <$> (currentLog . logFile) key
{- Finds all keys that have location log information.
- (There may be duplicate keys in the list.) -}