diff options
Diffstat (limited to 'app/History/CommitInfo.hs')
-rw-r--r-- | app/History/CommitInfo.hs | 56 |
1 files changed, 27 insertions, 29 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. |