whereis: New subcommand to show where a file's content has gotten to.

This commit is contained in:
Joey Hess 2011-03-05 17:23:55 -04:00
parent 41d5c4acf6
commit 0de3005c64
4 changed files with 49 additions and 0 deletions

41
Command/Whereis.hs Normal file
View file

@ -0,0 +1,41 @@
{- git-annex command
-
- Copyright 2010 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Command.Whereis where
import Control.Monad.State (liftIO)
import qualified Annex
import LocationLog
import Command
import Content
import Messages
import UUID
import Types
command :: [Command]
command = [Command "whereis" (paramOptional $ paramRepeating paramPath) seek
"lists repositories that have file content"]
seek :: [CommandSeek]
seek = [withFilesInGit start]
start :: CommandStartString
start file = isAnnexed file $ \(key, _) -> do
showStart "whereis" file
return $ Just $ perform key
perform :: Key -> CommandPerform
perform key = do
g <- Annex.gitRepo
uuids <- liftIO $ keyLocations g key
pp <- prettyPrintUUIDs uuids
showLongNote $ pp
showProgress
if null $ uuids
then return Nothing
else return $ Just $ return True

View file

@ -34,6 +34,7 @@ import qualified Command.Unlock
import qualified Command.Lock
import qualified Command.PreCommit
import qualified Command.Find
import qualified Command.Whereis
import qualified Command.Migrate
import qualified Command.Uninit
import qualified Command.Trust
@ -66,6 +67,7 @@ cmds = concat
, Command.Unused.command
, Command.DropUnused.command
, Command.Find.command
, Command.Whereis.command
, Command.Migrate.command
, Command.Map.command
]

1
debian/changelog vendored
View file

@ -1,6 +1,7 @@
git-annex (0.23) UNRELEASED; urgency=low
* Support ssh remotes with a port specified.
* whereis: New subcommand to show where a file's content has gotten to.
-- Joey Hess <joeyh@debian.org> Sat, 05 Mar 2011 15:39:13 -0400

View file

@ -154,6 +154,11 @@ Many git-annex commands will stage changes for later `git commit` by you.
With no parameters, defaults to finding all files in the current directory
and its subdirectories.
* whereis [path ...]
Displays a list of repositories known to contain the content of the
specified file or files.
* migrate [path ...]
Changes the specified annexed files to store their content in the