info: Added --dead-repositories option
I considered a more wide-ranging config option to make other commands also show dead repositories. But it would be difficult to implement that because Remote.keyLocations is used to get locations, filtering out dead repos, and commands like get then try to use those locations. So a config setting would make dead repos sometimes be acted on by commands. Sponsored-by: unqueued on Patreon
This commit is contained in:
parent
27a9915a67
commit
3efad7f5f4
5 changed files with 23 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
||||||
git-annex (10.20230803) UNRELEASED; urgency=medium
|
git-annex (10.20230803) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
* Fix behavior of onlyingroup.
|
* Fix behavior of onlyingroup.
|
||||||
|
* info: Added --dead-repositories option.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Mon, 07 Aug 2023 13:04:13 -0400
|
-- Joey Hess <id@joeyh.name> Mon, 07 Aug 2023 13:04:13 -0400
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{- git-annex command
|
{- git-annex command
|
||||||
-
|
-
|
||||||
- Copyright 2011-2022 Joey Hess <id@joeyh.name>
|
- Copyright 2011-2023 Joey Hess <id@joeyh.name>
|
||||||
-
|
-
|
||||||
- Licensed under the GNU AGPL version 3 or higher.
|
- Licensed under the GNU AGPL version 3 or higher.
|
||||||
-}
|
-}
|
||||||
|
@ -109,6 +109,7 @@ data InfoOptions = InfoOptions
|
||||||
, bytesOption :: Bool
|
, bytesOption :: Bool
|
||||||
, batchOption :: BatchMode
|
, batchOption :: BatchMode
|
||||||
, autoenableOption :: Bool
|
, autoenableOption :: Bool
|
||||||
|
, deadrepositoriesOption :: Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
optParser :: CmdParamsDesc -> Parser InfoOptions
|
optParser :: CmdParamsDesc -> Parser InfoOptions
|
||||||
|
@ -123,6 +124,10 @@ optParser desc = InfoOptions
|
||||||
( long "autoenable"
|
( long "autoenable"
|
||||||
<> help "list special remotes that are configured to 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 :: InfoOptions -> CommandSeek
|
||||||
seek o = case batchOption o of
|
seek o = case batchOption o of
|
||||||
|
@ -134,7 +139,9 @@ start :: InfoOptions -> [String] -> CommandStart
|
||||||
start o [] = do
|
start o [] = do
|
||||||
if autoenableOption o
|
if autoenableOption o
|
||||||
then autoenableInfo
|
then autoenableInfo
|
||||||
else globalInfo o
|
else if deadrepositoriesOption o
|
||||||
|
then deadrepositoriesInfo o
|
||||||
|
else globalInfo o
|
||||||
stop
|
stop
|
||||||
start o ps = do
|
start o ps = do
|
||||||
mapM_ (\p -> itemInfo o (SeekInput [p], p)) ps
|
mapM_ (\p -> itemInfo o (SeekInput [p], p)) ps
|
||||||
|
@ -163,6 +170,11 @@ autoenableInfo = showCustom "info" (SeekInput []) $ do
|
||||||
showRaw (encodeBS s)
|
showRaw (encodeBS s)
|
||||||
return True
|
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 :: InfoOptions -> (SeekInput, String) -> Annex ()
|
||||||
itemInfo o (si, p) = ifM (isdir (toRawFilePath p))
|
itemInfo o (si, p) = ifM (isdir (toRawFilePath p))
|
||||||
( dirInfo o p si
|
( dirInfo o p si
|
||||||
|
|
|
@ -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.
|
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
|
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
|
Repositories can be specified using their remote name, their
|
||||||
description, or their UUID. (To undo, use `git-annex semitrust`.)
|
description, or their UUID. (To undo, use `git-annex semitrust`.)
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,11 @@ for the local repository and all annexed content.
|
||||||
Display a list of special remotes that have been configured to
|
Display a list of special remotes that have been configured to
|
||||||
autoenable.
|
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
|
* matching options
|
||||||
|
|
||||||
The [[git-annex-matching-options]](1) can be used to select what
|
The [[git-annex-matching-options]](1) can be used to select what
|
||||||
|
|
|
@ -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.
|
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]]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue