From 6f98fd53914b2490e866a2613e86b93f689034bf Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 6 Sep 2011 16:59:53 -0400 Subject: [PATCH] whereis: Show untrusted locations separately and do not include in location count. --- Command/Whereis.hs | 27 ++++++++++++++++++--------- debian/changelog | 7 +++++++ 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Command/Whereis.hs b/Command/Whereis.hs index f80c823b70..d5c090e493 100644 --- a/Command/Whereis.hs +++ b/Command/Whereis.hs @@ -7,11 +7,15 @@ module Command.Whereis where +import Control.Monad +import Data.List + import LocationLog import Command import Messages import Remote import Types +import Trust command :: [Command] command = [repoCommand "whereis" (paramOptional $ paramRepeating paramPath) seek @@ -27,16 +31,21 @@ start file = isAnnexed file $ \(key, _) -> do perform :: Key -> CommandPerform perform key = do - uuids <- keyLocations key - let num = length uuids + locations <- keyLocations key + untrusted <- trustGet UnTrusted + let untrustedlocations = intersect untrusted locations + let safelocations = filter (`notElem` untrusted) locations + let num = length safelocations showNote $ show num ++ " " ++ copiesplural num - if null uuids - then stop - else do - pp <- prettyPrintUUIDs "whereis" uuids - showLongNote pp - showOutput - next $ return True + pp <- prettyPrintUUIDs "whereis" safelocations + unless (null safelocations) $ + showLongNote pp + pp' <- prettyPrintUUIDs "untrusted" untrustedlocations + unless (null untrustedlocations) $ + showLongNote $ untrustedheader ++ pp' + unless (null locations) showOutput + if null safelocations then stop else next $ return True where copiesplural 1 = "copy" copiesplural _ = "copies" + untrustedheader = "The following untrusted locations may also have copies:\n" diff --git a/debian/changelog b/debian/changelog index 0fca41ee5c..d900ab1840 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +git-annex (3.20110907) UNRELEASED; urgency=low + + * whereis: Show untrusted locations separately and do not include in + location count. + + -- Joey Hess Tue, 06 Sep 2011 16:59:15 -0400 + git-annex (3.20110906) unstable; urgency=low * Improve display of newlines around error and warning messages.