aboutsummaryrefslogtreecommitdiffstats
path: root/app/History.hs
blob: 6247108085a9001449711c054ddf90a9e818b6ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
module History
  ( getHistory,
  )
where

import History.CommitHash (CommitHash)
import History.CommitInfo (CommitInfo (..), fromPartialCommitInfos, issueEvents)
import History.IssueEvent (IssueEvent (..))
import History.PartialCommitInfo (getPartialCommitInfos)
import Issue (Issue)
import Tuple ()
import Prelude hiding (id, lines)

-- TODO Reduce cached data size
--
-- Right now we are caching complete `Issue` instances, which
-- contain the full issue title and description.  For a fast
-- lookup it may already be enough to only store the issue's
--
-- \* filename
-- \* start position
-- \* end position
--
-- With this information we can use git to quickly look up the
-- complete issue text and parse it.
--
-- @topic caching
-- @backlog

getHistory :: IO [(CommitHash, [IssueEvent], [Issue])]
getHistory = do
  commitInfos <- fromPartialCommitInfos <$> getPartialCommitInfos
  let commitHashes = map (.hash) commitInfos
      issueEventses = map (._2) $ issueEvents commitInfos
      issueses = map (.issues) commitInfos
  pure (zip3 commitHashes issueEventses issueses)