diff options
author | Joey Hess <joey@kitenet.net> | 2011-03-05 17:23:55 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-03-05 17:23:55 -0400 |
commit | 0de3005c648400e67ce4bfe88ac7999e56e3b56e (patch) | |
tree | 7afefc6d0079611928706fee9e7a59012ce774d6 | |
parent | 41d5c4acf6810966bdef25e2fc7a4cfb78b6f972 (diff) |
whereis: New subcommand to show where a file's content has gotten to.
-rw-r--r-- | Command/Whereis.hs | 41 | ||||
-rw-r--r-- | GitAnnex.hs | 2 | ||||
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | doc/git-annex.mdwn | 5 |
4 files changed, 49 insertions, 0 deletions
diff --git a/Command/Whereis.hs b/Command/Whereis.hs new file mode 100644 index 000000000..de5192385 --- /dev/null +++ b/Command/Whereis.hs @@ -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 diff --git a/GitAnnex.hs b/GitAnnex.hs index b26714a59..da91f6e74 100644 --- a/GitAnnex.hs +++ b/GitAnnex.hs @@ -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 ] diff --git a/debian/changelog b/debian/changelog index 6d77caf4c..e8b094607 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn index 76f1a577b..4998a6491 100644 --- a/doc/git-annex.mdwn +++ b/doc/git-annex.mdwn @@ -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 |