From f83b424bf70b7b14b0268aeeafe1b3483fced49f Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Thu, 21 Mar 2024 05:35:00 +0100 Subject: chore: Git -> Backend --- app/History/IssueEvents.hs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'app/History/IssueEvents.hs') diff --git a/app/History/IssueEvents.hs b/app/History/IssueEvents.hs index 176d660..fc7bdcf 100644 --- a/app/History/IssueEvents.hs +++ b/app/History/IssueEvents.hs @@ -3,6 +3,7 @@ module History.IssueEvents ) where +import Backend qualified import Data.Binary (Binary) import Data.Function (on) import Data.List @@ -12,7 +13,6 @@ import Data.Maybe (fromMaybe) import Data.Ord (comparing) import Data.Proxy (Proxy) import GHC.Generics (Generic) -import Git qualified import History.Plan (Id, Planable, Proto, assume, propagate, protoOf) import History.Scramble (Scramble (..), getIssuesOfFile) import Issue (Issue (..)) @@ -20,17 +20,17 @@ import IssueEvent (IssueEvent (..)) import IssueEvent qualified as E data IssueEvents = IssueEvents - { commitHash :: Git.CommitHash, + { commitHash :: Backend.CommitHash, issueEvents :: [E.IssueEvent] } deriving (Show, Generic, Binary) instance Planable IssueEvents where - type Id IssueEvents = Git.CommitHash + type Id IssueEvents = Backend.CommitHash type Proto IssueEvents = Scramble - protoOf :: Proxy IssueEvents -> Git.CommitHash -> IO Scramble - protoOf _ commitHash@Git.WorkingTree = do - filesChanged <- Git.getFilesOf commitHash + protoOf :: Proxy IssueEvents -> Backend.CommitHash -> IO Scramble + protoOf _ commitHash@Backend.WorkingTree = do + filesChanged <- Backend.getFilesOf commitHash issues <- concat <$> mapM (getIssuesOfFile commitHash) filesChanged pure $ Scramble @@ -40,8 +40,8 @@ instance Planable IssueEvents where ], .. } - protoOf _ commitHash@(Git.Commit _) = do - filesChanged <- Git.getChangedFilesOf commitHash + protoOf _ commitHash@(Backend.Commit _) = do + filesChanged <- Backend.getChangedFilesOf commitHash issues <- concat <$> mapM (getIssuesOfFile commitHash) filesChanged pure $ Scramble @@ -63,7 +63,7 @@ instance Planable IssueEvents where } propagate :: - [Git.CommitHash] -> + [Backend.CommitHash] -> IssueEvents -> Scramble -> IssueEvents @@ -96,7 +96,7 @@ instance Planable IssueEvents where -- So, in the case `issue-1` has been re-opened, we cannot track its deletion at `commit-b`, because whether it was re-opened or originally created at `commit-b` depends on whether `issue-1` is present in the bottom `commit-a`, that we process only later. Thus, the scramble of commit `commit-b` cannot safely advance the issue's original commit, and we use this information to track re-opening of commits at later commits. -- -- Note that in the whole process, issue change events and issue deletion events can never be bottom-most/latest events, as they would depend on information not yet known, ie. the first commit can neither change nor delete an issue. -propagateIssueEvents :: [Git.CommitHash] -> IssueEvents -> Scramble -> IssueEvents +propagateIssueEvents :: [Backend.CommitHash] -> IssueEvents -> Scramble -> IssueEvents propagateIssueEvents log topIssueEvents bottomScramble = IssueEvents { commitHash = bottomScramble.commitHash, -- cgit v1.2.3