diff options
author | 2016-03-29 14:39:16 -0400 | |
---|---|---|
committer | 2016-03-29 14:39:16 -0400 | |
commit | 3d7b8ab9a31b0fe50b602efade89b390f471d562 (patch) | |
tree | 3bb4668eba093a527750e152920f8a50f1e4ba5c | |
parent | 278f84fe6458a2ac8e12ecab8f2b4f4bb7d0122c (diff) |
log --raw-date: Use to display seconds from unix epoch.
-rw-r--r-- | Command/Log.hs | 16 | ||||
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | doc/git-annex-log.mdwn | 5 | ||||
-rw-r--r-- | doc/todo/wishlist__58___Unix_time_in_git_annex_log.mdwn | 1 | ||||
-rw-r--r-- | doc/todo/wishlist__58___Unix_time_in_git_annex_log/comment_1_e13341ff3713716e595f2d2d3ed110d0._comment | 8 |
5 files changed, 26 insertions, 5 deletions
diff --git a/Command/Log.hs b/Command/Log.hs index 4a680111e..808b86b70 100644 --- a/Command/Log.hs +++ b/Command/Log.hs @@ -44,6 +44,7 @@ cmd = withGlobalOptions annexedMatchingOptions $ data LogOptions = LogOptions { logFiles :: CmdParams + , rawDateOption :: Bool , gourceOption :: Bool , passthruOptions :: [CommandParam] } @@ -52,6 +53,10 @@ optParser :: CmdParamsDesc -> Parser LogOptions optParser desc = LogOptions <$> cmdParams desc <*> switch + ( long "raw-date" + <> help "display seconds from unix epoch" + ) + <*> switch ( long "gource" <> help "format output for gource" ) @@ -92,8 +97,9 @@ start m zone o file key = do stop where output - | (gourceOption o) = gourceOutput lookupdescription file - | otherwise = normalOutput lookupdescription file zone + | rawDateOption o = normalOutput lookupdescription file show + | gourceOption o = gourceOutput lookupdescription file + | otherwise = normalOutput lookupdescription file (showTimeStamp zone) lookupdescription u = fromMaybe (fromUUID u) $ M.lookup u m showLog :: Outputter -> [RefChange] -> Annex () @@ -109,11 +115,11 @@ showLog outputter ps = do get ref = map toUUID . Logs.Presence.getLog . L.unpack <$> catObject ref -normalOutput :: (UUID -> String) -> FilePath -> TimeZone -> Outputter -normalOutput lookupdescription file zone present ts us = +normalOutput :: (UUID -> String) -> FilePath -> (POSIXTime -> String) -> Outputter +normalOutput lookupdescription file formattime present ts us = liftIO $ mapM_ (putStrLn . format) us where - time = showTimeStamp zone ts + time = formattime ts addel = if present then "+" else "-" format u = unwords [ addel, time, file, "|", fromUUID u ++ " -- " ++ lookupdescription u ] diff --git a/debian/changelog b/debian/changelog index 82e18dafd..f4542b7dd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,7 @@ git-annex (6.20160319) UNRELEASED; urgency=medium * ddar remote: fix ssh calls Thanks, Robie Basak * log: Display time with time zone. + * log --raw-date: Use to display seconds from unix epoch. -- Joey Hess <id@joeyh.name> Wed, 23 Mar 2016 11:42:36 -0400 diff --git a/doc/git-annex-log.mdwn b/doc/git-annex-log.mdwn index bfae593d9..9575e3719 100644 --- a/doc/git-annex-log.mdwn +++ b/doc/git-annex-log.mdwn @@ -20,6 +20,11 @@ showing each repository they were added to ("+") and removed from ("-"). For example: `--since "1 month ago"` +* `--raw-date` + + Rather than the normal display of a date in the local time zone, + displays seconds since the unix epoch. + * `--gource` Generates output suitable for the `gource` visualization program. diff --git a/doc/todo/wishlist__58___Unix_time_in_git_annex_log.mdwn b/doc/todo/wishlist__58___Unix_time_in_git_annex_log.mdwn index 706686f62..27540c088 100644 --- a/doc/todo/wishlist__58___Unix_time_in_git_annex_log.mdwn +++ b/doc/todo/wishlist__58___Unix_time_in_git_annex_log.mdwn @@ -12,3 +12,4 @@ If the timestamp were in Unix time, it would be easier to process in a mechanica + 1414368018 ev-2014.pdf | 50083bd6-7e20-4356-a32f-a1dde07de441 -- penn ``` +> [[done]] --[[Joey]] diff --git a/doc/todo/wishlist__58___Unix_time_in_git_annex_log/comment_1_e13341ff3713716e595f2d2d3ed110d0._comment b/doc/todo/wishlist__58___Unix_time_in_git_annex_log/comment_1_e13341ff3713716e595f2d2d3ed110d0._comment new file mode 100644 index 000000000..02cd1cca3 --- /dev/null +++ b/doc/todo/wishlist__58___Unix_time_in_git_annex_log/comment_1_e13341ff3713716e595f2d2d3ed110d0._comment @@ -0,0 +1,8 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2016-03-29T18:35:26Z" + content=""" +I don't think that's a good default, but I will add the time zone to the +date displayed. And add a --raw-date option for epoch. +"""]] |