git-annex log --totalsizes
Note that dead repositories are not yet handled so their sizes show as nonzero after they are marked dead. Sponsored-By: unqueued on Patreon
This commit is contained in:
parent
d826dde59a
commit
5d8b8a8ad0
1 changed files with 9 additions and 2 deletions
|
@ -46,6 +46,7 @@ data LogOptions = LogOptions
|
||||||
, allOption :: Bool
|
, allOption :: Bool
|
||||||
, sizesOfOption :: Maybe (DeferredParse UUID)
|
, sizesOfOption :: Maybe (DeferredParse UUID)
|
||||||
, sizesOption :: Bool
|
, sizesOption :: Bool
|
||||||
|
, totalSizesOption :: Bool
|
||||||
, whenOption :: Maybe Duration
|
, whenOption :: Maybe Duration
|
||||||
, rawDateOption :: Bool
|
, rawDateOption :: Bool
|
||||||
, bytesOption :: Bool
|
, bytesOption :: Bool
|
||||||
|
@ -71,6 +72,10 @@ optParser desc = LogOptions
|
||||||
( long "sizes"
|
( long "sizes"
|
||||||
<> help "display history of sizes of all repositories"
|
<> help "display history of sizes of all repositories"
|
||||||
)
|
)
|
||||||
|
<*> switch
|
||||||
|
( long "totalsizes"
|
||||||
|
<> help "display history of total sizes of all repositories"
|
||||||
|
)
|
||||||
<*> optional (option (eitherReader parseDuration)
|
<*> optional (option (eitherReader parseDuration)
|
||||||
( long "when" <> metavar paramTime
|
( long "when" <> metavar paramTime
|
||||||
<> help "when to display changed size"
|
<> help "when to display changed size"
|
||||||
|
@ -108,7 +113,7 @@ seek :: LogOptions -> CommandSeek
|
||||||
seek o = ifM (null <$> Annex.Branch.getUnmergedRefs)
|
seek o = ifM (null <$> Annex.Branch.getUnmergedRefs)
|
||||||
( maybe (pure Nothing) (Just <$$> getParsed) (sizesOfOption o) >>= \case
|
( maybe (pure Nothing) (Just <$$> getParsed) (sizesOfOption o) >>= \case
|
||||||
Just u -> sizeHistoryInfo (Just u) o
|
Just u -> sizeHistoryInfo (Just u) o
|
||||||
Nothing -> if sizesOption o
|
Nothing -> if sizesOption o || totalSizesOption o
|
||||||
then sizeHistoryInfo Nothing o
|
then sizeHistoryInfo Nothing o
|
||||||
else go
|
else go
|
||||||
, giveup "This repository is read-only, and there are unmerged git-annex branches, which prevents displaying location log changes. (Set annex.merge-annex-branches to false to ignore the unmerged git-annex branches.)"
|
, giveup "This repository is read-only, and there are unmerged git-annex branches, which prevents displaying location log changes. (Set annex.merge-annex-branches to false to ignore the unmerged git-annex branches.)"
|
||||||
|
@ -405,7 +410,9 @@ sizeHistoryInfo mu o = do
|
||||||
us = case mu of
|
us = case mu of
|
||||||
Just u -> [u]
|
Just u -> [u]
|
||||||
Nothing -> M.keys uuidmap
|
Nothing -> M.keys uuidmap
|
||||||
sizes = map (\u -> fromMaybe 0 (M.lookup u sizemap)) us
|
sizes
|
||||||
|
| totalSizesOption o = [sum (M.elems sizemap)]
|
||||||
|
| otherwise = map (\u -> fromMaybe 0 (M.lookup u sizemap)) us
|
||||||
dt = maybe 1 durationToPOSIXTime (whenOption o)
|
dt = maybe 1 durationToPOSIXTime (whenOption o)
|
||||||
|
|
||||||
displayts zone t output = putStrLn $ ts ++ "," ++ output
|
displayts zone t output = putStrLn $ ts ++ "," ++ output
|
||||||
|
|
Loading…
Reference in a new issue