summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Command/Whereis.hs27
-rw-r--r--debian/changelog7
2 files changed, 25 insertions, 9 deletions
diff --git a/Command/Whereis.hs b/Command/Whereis.hs
index f80c823b7..d5c090e49 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 0fca41ee5..d900ab184 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 <joeyh@debian.org> Tue, 06 Sep 2011 16:59:15 -0400
+
git-annex (3.20110906) unstable; urgency=low
* Improve display of newlines around error and warning messages.