diff --git a/CHANGELOG b/CHANGELOG index 54227f46d8..9dccfb1730 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ git-annex (10.20230803) UNRELEASED; urgency=medium * Fix behavior of onlyingroup. + * info: Added --dead-repositories option. -- Joey Hess Mon, 07 Aug 2023 13:04:13 -0400 diff --git a/Command/Info.hs b/Command/Info.hs index bb232310ee..bfa045e7a5 100644 --- a/Command/Info.hs +++ b/Command/Info.hs @@ -1,6 +1,6 @@ {- git-annex command - - - Copyright 2011-2022 Joey Hess + - Copyright 2011-2023 Joey Hess - - Licensed under the GNU AGPL version 3 or higher. -} @@ -109,6 +109,7 @@ data InfoOptions = InfoOptions , bytesOption :: Bool , batchOption :: BatchMode , autoenableOption :: Bool + , deadrepositoriesOption :: Bool } optParser :: CmdParamsDesc -> Parser InfoOptions @@ -123,6 +124,10 @@ optParser desc = InfoOptions ( long "autoenable" <> help "list special remotes that are configured to autoenable" ) + <*> switch + ( long "dead-repositories" + <> help "list repositories that have been marked as dead" + ) seek :: InfoOptions -> CommandSeek seek o = case batchOption o of @@ -134,7 +139,9 @@ start :: InfoOptions -> [String] -> CommandStart start o [] = do if autoenableOption o then autoenableInfo - else globalInfo o + else if deadrepositoriesOption o + then deadrepositoriesInfo o + else globalInfo o stop start o ps = do mapM_ (\p -> itemInfo o (SeekInput [p], p)) ps @@ -163,6 +170,11 @@ autoenableInfo = showCustom "info" (SeekInput []) $ do showRaw (encodeBS s) return True +deadrepositoriesInfo :: InfoOptions -> Annex () +deadrepositoriesInfo o = showCustom "info" (SeekInput []) $ do + evalStateT (showStat (repo_list DeadTrusted)) (emptyStatInfo o) + return True + itemInfo :: InfoOptions -> (SeekInput, String) -> Annex () itemInfo o (si, p) = ifM (isdir (toRawFilePath p)) ( dirInfo o p si diff --git a/doc/git-annex-dead.mdwn b/doc/git-annex-dead.mdwn index d72d6ccd73..a0f074daca 100644 --- a/doc/git-annex-dead.mdwn +++ b/doc/git-annex-dead.mdwn @@ -12,7 +12,7 @@ This command exists to deal with situations where data has been lost, and you know it has, and you want to stop being reminded of that fact. When a repository is specified, indicates that the repository has -been irretrievably lost, so it will not be listed in eg, `git annex info`. +been irretrievably lost, so it will not be listed in eg, `git annex whereis`. Repositories can be specified using their remote name, their description, or their UUID. (To undo, use `git-annex semitrust`.) diff --git a/doc/git-annex-info.mdwn b/doc/git-annex-info.mdwn index 9a2256b491..aaba7ef182 100644 --- a/doc/git-annex-info.mdwn +++ b/doc/git-annex-info.mdwn @@ -50,6 +50,11 @@ for the local repository and all annexed content. Display a list of special remotes that have been configured to autoenable. +* `--dead-repositories` + + Display a list of repositories that have been marked as dead. + Such repositories are not displayed in other info displays. + * matching options The [[git-annex-matching-options]](1) can be used to select what diff --git a/doc/todo/show_dead_in_info___40__behind_option__63____41__.mdwn b/doc/todo/show_dead_in_info___40__behind_option__63____41__.mdwn index 398bfb8485..ebb40443e3 100644 --- a/doc/todo/show_dead_in_info___40__behind_option__63____41__.mdwn +++ b/doc/todo/show_dead_in_info___40__behind_option__63____41__.mdwn @@ -1 +1,3 @@ Would it be possible for `git annex info` to also show dead remotes (behind an option is fine), to make it easy to find what dead remotes there are? I needed to check what I had done for a service that was going away (AARNET Cloudstor, which used webdav), and was confused as to why it wasn't appearing anywhere. + +> Implemented `git-annex info --dead-repositories` [[done]] --[[Joey]]