drop: suppprt untrusted repos

This commit is contained in:
Joey Hess 2011-01-26 19:35:35 -04:00
parent ff3c127255
commit 1a11085a50
2 changed files with 16 additions and 8 deletions

View file

@ -96,9 +96,10 @@ checkRemoveKey key numcopiesM = do
then return True then return True
else do else do
(remotes, trusteduuids) <- Remotes.keyPossibilities key (remotes, trusteduuids) <- Remotes.keyPossibilities key
untrusted <- reposWithoutUUID remotes trusteduuids untrusteduuids <- trustGet UnTrusted
tocheck <- reposWithoutUUID remotes (trusteduuids++untrusteduuids)
numcopies <- getNumCopies numcopiesM numcopies <- getNumCopies numcopiesM
findcopies numcopies trusteduuids untrusted [] findcopies numcopies trusteduuids tocheck []
where where
findcopies need have [] bad findcopies need have [] bad
| length have >= need = return True | length have >= need = return True
@ -131,11 +132,18 @@ showLocations key exclude = do
g <- Annex.gitRepo g <- Annex.gitRepo
u <- getUUID g u <- getUUID g
uuids <- liftIO $ keyLocations g key uuids <- liftIO $ keyLocations g key
let uuidsf = filter (\l -> l /= u && (not $ elem l exclude)) uuids untrusteduuids <- trustGet UnTrusted
ppuuids <- prettyPrintUUIDs uuidsf let uuidswanted = filteruuids uuids (u:exclude++untrusteduuids)
if null uuidsf let uuidsskipped = filteruuids uuids (u:exclude++uuidswanted)
then showLongNote $ "No other repository is known to contain the file." ppuuidswanted <- prettyPrintUUIDs uuidswanted
else showLongNote $ "Try making some of these repositories available:\n" ++ ppuuids ppuuidsskipped <- prettyPrintUUIDs uuidsskipped
showLongNote $ message ppuuidswanted ppuuidsskipped
where
filteruuids list x = filter (\l -> not $ elem l x) list
message [] [] = "No other repository is known to contain the file."
message rs [] = "Try making some of these repositories available:\n" ++ rs
message [] us = "Also these untrusted repositories may contain the file:\n" ++ us
message rs us = message rs [] ++ message [] us
showTriedRemotes :: [Git.Repo] -> Annex () showTriedRemotes :: [Git.Repo] -> Annex ()
showTriedRemotes [] = return () showTriedRemotes [] = return ()

2
debian/changelog vendored
View file

@ -5,7 +5,7 @@ git-annex (0.19) UNRELEASED; urgency=low
* There are now three levels of repository trust. * There are now three levels of repository trust.
* untrust: Now marks the current repository as untrusted. * untrust: Now marks the current repository as untrusted.
* semitrust: Now restores the default trust level. (What untrust used to do.) * semitrust: Now restores the default trust level. (What untrust used to do.)
* fsck: Take untrusted repositories into account. * fsck, drop: Take untrusted repositories into account.
* bugfix: Files were copied from trusted remotes first even if their * bugfix: Files were copied from trusted remotes first even if their
annex.cost was higher than other remotes. annex.cost was higher than other remotes.