aboutsummaryrefslogtreecommitdiffstats
path: root/app/History
diff options
context:
space:
mode:
Diffstat (limited to 'app/History')
-rw-r--r--app/History/CommitInfo.hs56
-rw-r--r--app/History/PartialCommitInfo.hs3
2 files changed, 29 insertions, 30 deletions
diff --git a/app/History/CommitInfo.hs b/app/History/CommitInfo.hs
index e260ce6..8e9f3b9 100644
--- a/app/History/CommitInfo.hs
+++ b/app/History/CommitInfo.hs
@@ -9,14 +9,14 @@ where
import Data.Binary (Binary)
import Data.Function (on)
import Data.List (deleteFirstsBy, find)
-import Data.Maybe (catMaybes, isJust)
+import Data.Maybe (isJust)
import GHC.Generics (Generic)
import History.CommitHash (CommitHash)
import History.IssueEvent (IssueEvent (..))
import History.PartialCommitInfo (PartialCommitInfo (..))
-import Issue (Issue (..), id)
+import Issue (Issue (..))
import Issue.Provenance qualified as I
-import Prelude hiding (id)
+import Prelude
-- TODO Change `CommitInfo` -> `CommitIssuesAll`
data CommitInfo = CommitInfo
@@ -38,35 +38,33 @@ fromPartialCommitInfos (partialCommitInfo : partialCommitInfos) =
propagate oldInfo newInfo@(PartialCommitInfo {..}) =
CommitInfo
{ issues =
- catMaybes $
- mergeListsBy
- eq
- ( \old new ->
- Just
- new
- { provenance =
- I.Provenance
- { first = old.provenance.first,
- last =
- if ((/=) `on` (.rawText)) old new
- then new.provenance.last
- else old.provenance.last
- }
- }
- )
- ( \old ->
- if elemBy eq old newInfo.issues
- || not (old.file `elem` newInfo.filesChanged)
- then Just old
- else Nothing
- )
- (\new -> Just new)
- oldInfo.issues
- newInfo.issues,
+ mergeListsBy
+ eq
+ ( \old new ->
+ new
+ { provenance =
+ I.Provenance
+ { first = old.provenance.first,
+ last =
+ if ((/=) `on` (.rawText)) old new
+ then new.provenance.last
+ else old.provenance.last
+ }
+ }
+ )
+ ( \old ->
+ if elemBy eq old newInfo.issues
+ || not (old.file `elem` newInfo.filesChanged)
+ then old
+ else old {closed = True}
+ )
+ id
+ oldInfo.issues
+ newInfo.issues,
..
}
- eq = (==) `on` id
+ eq = (==) `on` (.id)
-- | We assume that [CommitInfo] is sorted starting with the oldest
-- commits.
diff --git a/app/History/PartialCommitInfo.hs b/app/History/PartialCommitInfo.hs
index f973938..48b631e 100644
--- a/app/History/PartialCommitInfo.hs
+++ b/app/History/PartialCommitInfo.hs
@@ -102,7 +102,8 @@ fromComment cwd comment = do
markers = markers,
rawText = rawText,
commentStyle = commentStyle,
- comments = comments
+ comments = comments,
+ closed = False
}
else Nothing
)