diff options
author | Alexander Foremny <aforemny@posteo.de> | 2023-10-17 12:34:58 +0200 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2023-10-17 12:34:58 +0200 |
commit | 8c374417d9ca0ee4c4d75ee171d8b4e2f150bf78 (patch) | |
tree | 1c28eb3ba9cf4e8ef088e622b1ea3546c7332aff /app/History.hs | |
parent | 08f75854a59c2ebc4cf6685d5d5f7041d7ef29e3 (diff) |
add `log` command
Diffstat (limited to 'app/History.hs')
-rw-r--r-- | app/History.hs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/app/History.hs b/app/History.hs index fee1f2e..36dc1fc 100644 --- a/app/History.hs +++ b/app/History.hs @@ -1,4 +1,10 @@ -module History (getIssues, listIssues) where +module History + ( getIssues, + listIssues, + listEvents, + IssueEvent (..), + ) +where import Control.Exception (Exception, catch, handle, throw) import Data.Aeson (eitherDecode) @@ -28,6 +34,18 @@ import TreeGrepper.Result qualified as G import Prelude hiding (id, lines) import Prelude qualified as Prelude +listEvents :: IO [[IssueEvent]] +listEvents = do + commitHashes <- fmap reverse getCommitHashes + case commitHashes of + [] -> pure [] + hashFirst : hashesRest -> do + issuesInitial <- cached (append hashFirst (pack ".all")) (\_ -> getIssuesCommitAll hashFirst) + commitInfos <- mapM (\hash -> cached (append hash (pack ".changed")) (\_ -> getCommitInfo hash)) hashesRest + commitInfoWorkingTree <- getCommitInfoWorkingTree [] + let eventses = getEvents hashFirst issuesInitial (commitInfos ++ [commitInfoWorkingTree]) + pure eventses + listIssues :: [Sort] -> [Filter] -> [FilePath] -> IO [Issue] listIssues sort filters paths = do commitHashes <- fmap reverse getCommitHashes |