, sizesOfOption :: Maybe (DeferredParse UUID)
, sizesOption :: Bool
, totalSizesOption :: Bool
- , whenOption :: Maybe Duration
+ , intervalOption :: Maybe Duration
+ , receivedOption :: Bool
, rawDateOption :: Bool
, bytesOption :: Bool
, gourceOption :: Bool
( long "interval" <> metavar paramTime
<> help "minimum time between displays of changed size"
))
+ <*> switch
+ ( long "received"
+ <> help "display received data per interval rather than repository sizes"
+ )
<*> switch
( long "raw-date"
<> help "display seconds from unix epoch"
uuidmap <- getuuidmap
zone <- liftIO getCurrentTimeZone
liftIO $ displayheader uuidmap
- let dispst = (zone, False, epoch, Nothing)
+ let dispst = (zone, False, epoch, Nothing, mempty)
(l, cleanup) <- getlog
g <- Annex.gitRepo
liftIO $ catObjectStream g $ \feeder closer reader -> do
combinedlog = PLog.compactLog (oldlog ++ newlog)
combinedlocs = S.fromList (presentlocs combinedlog)
addedlocs = S.difference combinedlocs oldlocs
- removedlocs = S.difference oldlocs combinedlocs
+ removedlocs
+ | receivedOption o = S.empty
+ | otherwise = S.difference oldlocs combinedlocs
addnew k sizemap locmap newlog =
( updatesize sizemap (ksz k) locs
(M.elems uuidmap)
| otherwise = return ()
- displaysizes (zone, displayedyet, prevt, prevoutput) trustlog uuidmap sizemap t
- | t - prevt >= dt
- && (displayedyet || any (/= 0) sizes)
- && (prevoutput /= Just output) = do
+ displaysizes (zone, displayedyet, prevt, prevoutput, prevsizemap) trustlog uuidmap sizemap t
+ | t - prevt >= dt && changedoutput = do
displayts zone t output
- return (zone, True, t, Just output)
- | t < prevt = return (zone, displayedyet, t, Just output)
- | otherwise = return (zone, displayedyet, prevt, Just output)
+ return (zone, True, t, Just output, sizemap')
+ | t < prevt = return (zone, displayedyet, t, Just output, prevsizemap)
+ | otherwise = return (zone, displayedyet, prevt, prevoutput, prevsizemap)
where
output = intercalate "," (map showsize sizes)
us = case mu of
Just u -> [u]
Nothing -> M.keys uuidmap
sizes
- | totalSizesOption o = [sum (M.elems sizemap')]
- | otherwise = map (\u -> fromMaybe 0 (M.lookup u sizemap')) us
- dt = maybe 1 durationToPOSIXTime (whenOption o)
+ | totalSizesOption o = [sum (M.elems sizedisplaymap)]
+ | otherwise = map (\u -> fromMaybe 0 (M.lookup u sizedisplaymap)) us
+ dt = maybe 1 durationToPOSIXTime (intervalOption o)
+
+ changedoutput
+ | receivedOption o =
+ any (/= 0) sizes
+ || prevoutput /= Just output
+ | otherwise =
+ (displayedyet || any (/= 0) sizes)
+ && (prevoutput /= Just output)
+
+ sizedisplaymap
+ | receivedOption o =
+ M.unionWith posminus sizemap' prevsizemap
+ | otherwise = sizemap'
+
+ posminus a b = max 0 (a - b)
-- A verison of sizemap where uuids that are currently dead
-- have 0 size.
then rawTimeStamp t
else showTimeStamp zone "%Y-%m-%dT%H:%M:%S" t
- displayendsizes (zone , _, _, Just output) = do
+ displayendsizes (zone , _, _, Just output, _) = do
now <- getPOSIXTime
displayts zone now output
displayendsizes _ = return ()
* `--sizesof=repository`
Displays a history of the total size of the annexed files in a repository
- as it changed over time from the creation of the repository to the present.
+ over time from the creation of the repository to the present.
The repository can be "here" for the current repository, or the name of a
remote, or a repository description or uuid.
When using `--sizesof`, `--sizes`, and `--totalsizes`, this
controls the minimum interval between displays of the size.
- The default is to display each recorded change to the size.
+ The default is to display each new recorded size.
The time is of the form "30d" or "1y".
-* `--since=date`, `--after=date`, `--until=date`, `--before=date`, `--max-count=N`
+* `--received`
- These options are passed through to `git log`, and can be used to limit
- how far back to search for location log changes.
-
- For example: `--since "1 month ago"`
-
- These options do not have an affect when using `--sizesof`, `--sizes`,
- and `--totalsizes`.
+ Combine this option with `--sizesof` or `--sizes` to display
+ the amount of data received into repositories since the last
+ line was output.
* `--bytes`
Rather than the normal display of a date in the local time zone,
displays seconds since the unix epoch.
+* `--since=date`, `--after=date`, `--until=date`, `--before=date`, `--max-count=N`
+
+ These options are passed through to `git log`, and can be used to limit
+ how far back to search for location log changes.
+
+ For example: `--since "1 month ago"`
+
+ These options do not have an affect when using `--sizesof`, `--sizes`,
+ and `--totalsizes`.
+
* `--gource`
Generates output suitable for the `gource` visualization program.