UI: Fix and re-enable getRepoCommitsR (i.e. repo history view)
This commit is contained in:
parent
91cdbf51ab
commit
b66bab4295
5 changed files with 37 additions and 58 deletions
|
@ -17,9 +17,9 @@
|
||||||
module Vervis.Darcs
|
module Vervis.Darcs
|
||||||
( --readSourceView
|
( --readSourceView
|
||||||
--, readWikiView
|
--, readWikiView
|
||||||
--, readChangesView
|
readChangesView
|
||||||
--, lastChange
|
--, lastChange
|
||||||
readPatch
|
, readPatch
|
||||||
, writePostApplyHooks
|
, writePostApplyHooks
|
||||||
--, applyDarcsPatch
|
--, applyDarcsPatch
|
||||||
)
|
)
|
||||||
|
@ -220,7 +220,6 @@ readWikiView isPage isMain path dir = do
|
||||||
for mpage $ \ (load, mmtitle) -> mkview mmtitle <$> load
|
for mpage $ \ (load, mmtitle) -> mkview mmtitle <$> load
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-
|
|
||||||
readChangesView
|
readChangesView
|
||||||
:: FilePath
|
:: FilePath
|
||||||
-- ^ Repository path
|
-- ^ Repository path
|
||||||
|
@ -261,7 +260,6 @@ lastChange path now = fmap maybeRight $ runExceptT $ do
|
||||||
intervalToEventTime $
|
intervalToEventTime $
|
||||||
FriendlyConvert $
|
FriendlyConvert $
|
||||||
now `diffUTCTime` piTime pi
|
now `diffUTCTime` piTime pi
|
||||||
-}
|
|
||||||
|
|
||||||
data Change
|
data Change
|
||||||
= AddFile FilePath
|
= AddFile FilePath
|
||||||
|
|
|
@ -16,9 +16,9 @@
|
||||||
|
|
||||||
module Vervis.Git
|
module Vervis.Git
|
||||||
( --readSourceView
|
( --readSourceView
|
||||||
--, readChangesView
|
readChangesView
|
||||||
--, listRefs
|
, listRefs
|
||||||
readPatch
|
, readPatch
|
||||||
--, lastCommitTime
|
--, lastCommitTime
|
||||||
, writePostReceiveHooks
|
, writePostReceiveHooks
|
||||||
--, applyGitPatches
|
--, applyGitPatches
|
||||||
|
@ -171,6 +171,7 @@ readSourceView path ref dir = do
|
||||||
G.withRepo (fromString path) $ \ git -> loadSourceView git ref dir
|
G.withRepo (fromString path) $ \ git -> loadSourceView git ref dir
|
||||||
let toTexts = S.mapMonotonic $ T.pack . refNameRaw
|
let toTexts = S.mapMonotonic $ T.pack . refNameRaw
|
||||||
return (toTexts bs, toTexts ts, renderSources dir <$> msv)
|
return (toTexts bs, toTexts ts, renderSources dir <$> msv)
|
||||||
|
-}
|
||||||
|
|
||||||
readChangesView
|
readChangesView
|
||||||
:: FilePath
|
:: FilePath
|
||||||
|
@ -213,7 +214,6 @@ readChangesView path ref off lim = G.withRepo (fromString path) $ \ git -> do
|
||||||
listRefs :: FilePath -> IO (Set Text, Set Text)
|
listRefs :: FilePath -> IO (Set Text, Set Text)
|
||||||
listRefs path = G.withRepo (fromString path) $ \ git ->
|
listRefs path = G.withRepo (fromString path) $ \ git ->
|
||||||
(,) <$> listBranches git <*> listTags git
|
(,) <$> listBranches git <*> listTags git
|
||||||
-}
|
|
||||||
|
|
||||||
patch :: [Edit] -> Commit SHA1 -> P.Patch
|
patch :: [Edit] -> Commit SHA1 -> P.Patch
|
||||||
patch edits c = P.Patch
|
patch edits c = P.Patch
|
||||||
|
|
|
@ -111,7 +111,7 @@ import Text.Pandoc.Highlighting
|
||||||
import Yesod.Auth
|
import Yesod.Auth
|
||||||
import Yesod.Core hiding (joinPath)
|
import Yesod.Core hiding (joinPath)
|
||||||
import Yesod.Core.Content
|
import Yesod.Core.Content
|
||||||
import Yesod.Core.Handler (lookupPostParam, redirect, notFound)
|
import Yesod.Core.Handler
|
||||||
import Yesod.Form.Functions (runFormPost)
|
import Yesod.Form.Functions (runFormPost)
|
||||||
import Yesod.Form.Types (FormResult (..))
|
import Yesod.Form.Types (FormResult (..))
|
||||||
import Yesod.Persist.Core
|
import Yesod.Persist.Core
|
||||||
|
@ -379,24 +379,19 @@ getRepoCommitsR repoHash = do
|
||||||
repoID <- decodeKeyHashid404 repoHash
|
repoID <- decodeKeyHashid404 repoHash
|
||||||
repo <- runDB $ get404 repoID
|
repo <- runDB $ get404 repoID
|
||||||
case repoVcs repo of
|
case repoVcs repo of
|
||||||
VCSDarcs ->
|
VCSDarcs -> getDarcsRepoChanges repoHash
|
||||||
error "Temporarily disabled"
|
VCSGit -> selectRep $ do
|
||||||
--getDarcsRepoHeadChanges repoHash
|
AP.provideAP (notFound :: Handler ())
|
||||||
VCSGit ->
|
provideRepType typeHtml
|
||||||
error "Temporarily disabled"
|
((redirect $ RepoBranchCommitsR repoHash $ repoMainBranch repo) :: Handler ())
|
||||||
--getGitRepoHeadChanges repo repoHash
|
|
||||||
|
|
||||||
getRepoBranchCommitsR :: KeyHashid Repo -> Text -> Handler TypedContent
|
getRepoBranchCommitsR :: KeyHashid Repo -> Text -> Handler TypedContent
|
||||||
getRepoBranchCommitsR repoHash branch = do
|
getRepoBranchCommitsR repoHash branch = do
|
||||||
repoID <- decodeKeyHashid404 repoHash
|
repoID <- decodeKeyHashid404 repoHash
|
||||||
repo <- runDB $ get404 repoID
|
repo <- runDB $ get404 repoID
|
||||||
case repoVcs repo of
|
case repoVcs repo of
|
||||||
VCSDarcs ->
|
VCSDarcs -> notFound
|
||||||
error "Temporarily disabled"
|
VCSGit -> getGitRepoChanges repoHash branch
|
||||||
--getDarcsRepoChanges repoHash branch
|
|
||||||
VCSGit ->
|
|
||||||
error "Temporarily disabled"
|
|
||||||
--getGitRepoChanges repoHash branch
|
|
||||||
|
|
||||||
getRepoCommitR :: KeyHashid Repo -> Text -> Handler TypedContent
|
getRepoCommitR :: KeyHashid Repo -> Text -> Handler TypedContent
|
||||||
getRepoCommitR repoHash ref = do
|
getRepoCommitR repoHash ref = do
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{- This file is part of Vervis.
|
{- This file is part of Vervis.
|
||||||
-
|
-
|
||||||
- Written in 2016, 2018, 2019, 2020 by fr33domlover <fr33domlover@riseup.net>.
|
- Written in 2016, 2018, 2019, 2020, 2022
|
||||||
|
- by fr33domlover <fr33domlover@riseup.net>.
|
||||||
-
|
-
|
||||||
- ♡ Copying is an act of love. Please copy, reuse and share.
|
- ♡ Copying is an act of love. Please copy, reuse and share.
|
||||||
-
|
-
|
||||||
|
@ -15,9 +16,8 @@
|
||||||
|
|
||||||
module Vervis.Web.Darcs
|
module Vervis.Web.Darcs
|
||||||
( --getDarcsRepoSource
|
( --getDarcsRepoSource
|
||||||
--, getDarcsRepoHeadChanges
|
getDarcsRepoChanges
|
||||||
--, getDarcsRepoChanges
|
, getDarcsPatch
|
||||||
getDarcsPatch
|
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@ import Vervis.SourceTree
|
||||||
import Vervis.Style
|
import Vervis.Style
|
||||||
import Vervis.Time
|
import Vervis.Time
|
||||||
import Vervis.Web.Repo
|
import Vervis.Web.Repo
|
||||||
|
import Vervis.Widget.Repo
|
||||||
|
|
||||||
import qualified Vervis.Darcs as D
|
import qualified Vervis.Darcs as D
|
||||||
|
|
||||||
|
@ -101,11 +102,10 @@ getDarcsRepoSource (mproject, repository) user repo dir = do
|
||||||
(return $ repoFollowers repository)
|
(return $ repoFollowers repository)
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-
|
getDarcsRepoChanges :: KeyHashid Repo -> Handler TypedContent
|
||||||
getDarcsRepoHeadChanges :: ShrIdent -> RpIdent -> Handler TypedContent
|
getDarcsRepoChanges repo = do
|
||||||
getDarcsRepoHeadChanges shar repo = do
|
path <- askRepoDir repo
|
||||||
path <- askRepoDir shar repo
|
let here = RepoCommitsR repo
|
||||||
let here = RepoHeadChangesR shar repo
|
|
||||||
encodeRouteLocal <- getEncodeRouteLocal
|
encodeRouteLocal <- getEncodeRouteLocal
|
||||||
encodeRouteHome <- getEncodeRouteHome
|
encodeRouteHome <- getEncodeRouteHome
|
||||||
encodeRoutePageLocal <- getEncodeRoutePageLocal
|
encodeRoutePageLocal <- getEncodeRoutePageLocal
|
||||||
|
@ -149,20 +149,14 @@ getDarcsRepoHeadChanges shar repo = do
|
||||||
else Nothing
|
else Nothing
|
||||||
, collectionPageStartIndex = Nothing
|
, collectionPageStartIndex = Nothing
|
||||||
, collectionPageItems =
|
, collectionPageItems =
|
||||||
map (encodeRouteHome . RepoCommitR shar repo . leHash)
|
map (encodeRouteHome . RepoCommitR repo . leHash)
|
||||||
items
|
items
|
||||||
}
|
}
|
||||||
feed = changeFeed shar repo Nothing VCSDarcs items
|
feed = changeFeed repo Nothing VCSDarcs items
|
||||||
in provideHtmlFeedAndAP page feed $
|
in provideHtmlFeedAndAP page feed $
|
||||||
let changes = changesW shar repo items
|
let changes = changesW repo items
|
||||||
pageNav = navWidget navModel
|
pageNav = navWidget navModel
|
||||||
in $(widgetFile "repo/changes-darcs")
|
in $(widgetFile "repo/changes-darcs")
|
||||||
-}
|
|
||||||
|
|
||||||
{-
|
|
||||||
getDarcsRepoChanges :: ShrIdent -> RpIdent -> Text -> Handler TypedContent
|
|
||||||
getDarcsRepoChanges shar repo tag = notFound
|
|
||||||
-}
|
|
||||||
|
|
||||||
getDarcsPatch :: KeyHashid Repo -> Text -> Handler TypedContent
|
getDarcsPatch :: KeyHashid Repo -> Text -> Handler TypedContent
|
||||||
getDarcsPatch hash ref = do
|
getDarcsPatch hash ref = do
|
||||||
|
|
|
@ -16,10 +16,9 @@
|
||||||
|
|
||||||
module Vervis.Web.Git
|
module Vervis.Web.Git
|
||||||
( --getGitRepoSource
|
( --getGitRepoSource
|
||||||
--, getGitRepoHeadChanges
|
|
||||||
--, getGitRepoBranch
|
--, getGitRepoBranch
|
||||||
--, getGitRepoChanges
|
getGitRepoChanges
|
||||||
getGitPatch
|
, getGitPatch
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
|
@ -89,6 +88,7 @@ import Vervis.SourceTree
|
||||||
import Vervis.Style
|
import Vervis.Style
|
||||||
import Vervis.Time (showDate)
|
import Vervis.Time (showDate)
|
||||||
import Vervis.Web.Repo
|
import Vervis.Web.Repo
|
||||||
|
import Vervis.Widget.Repo
|
||||||
|
|
||||||
import qualified Data.ByteString.Lazy as BL (ByteString)
|
import qualified Data.ByteString.Lazy as BL (ByteString)
|
||||||
import qualified Vervis.Git as G
|
import qualified Vervis.Git as G
|
||||||
|
@ -119,12 +119,6 @@ getGitRepoSource (mproject, repository) user repo ref dir = do
|
||||||
(return $ repoFollowers repository)
|
(return $ repoFollowers repository)
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-
|
|
||||||
getGitRepoHeadChanges :: Repo -> ShrIdent -> RpIdent -> Handler TypedContent
|
|
||||||
getGitRepoHeadChanges repository shar repo =
|
|
||||||
getGitRepoChanges shar repo $ repoMainBranch repository
|
|
||||||
-}
|
|
||||||
|
|
||||||
{-
|
{-
|
||||||
getGitRepoBranch :: ShrIdent -> RpIdent -> Text -> Handler TypedContent
|
getGitRepoBranch :: ShrIdent -> RpIdent -> Text -> Handler TypedContent
|
||||||
getGitRepoBranch shar repo ref = do
|
getGitRepoBranch shar repo ref = do
|
||||||
|
@ -143,14 +137,13 @@ getGitRepoBranch shar repo ref = do
|
||||||
else notFound
|
else notFound
|
||||||
-}
|
-}
|
||||||
|
|
||||||
{-
|
getGitRepoChanges :: KeyHashid Repo -> Text -> Handler TypedContent
|
||||||
getGitRepoChanges :: ShrIdent -> RpIdent -> Text -> Handler TypedContent
|
getGitRepoChanges repo ref = do
|
||||||
getGitRepoChanges shar repo ref = do
|
path <- askRepoDir repo
|
||||||
path <- askRepoDir shar repo
|
|
||||||
(branches, tags) <- liftIO $ G.listRefs path
|
(branches, tags) <- liftIO $ G.listRefs path
|
||||||
unless (ref `S.member` branches || ref `S.member` tags)
|
unless (ref `S.member` branches || ref `S.member` tags)
|
||||||
notFound
|
notFound
|
||||||
let here = RepoChangesR shar repo ref
|
let here = RepoBranchCommitsR repo ref
|
||||||
encodeRouteLocal <- getEncodeRouteLocal
|
encodeRouteLocal <- getEncodeRouteLocal
|
||||||
encodeRouteHome <- getEncodeRouteHome
|
encodeRouteHome <- getEncodeRouteHome
|
||||||
encodeRoutePageLocal <- getEncodeRoutePageLocal
|
encodeRoutePageLocal <- getEncodeRoutePageLocal
|
||||||
|
@ -190,16 +183,15 @@ getGitRepoChanges shar repo ref = do
|
||||||
else Nothing
|
else Nothing
|
||||||
, collectionPageStartIndex = Nothing
|
, collectionPageStartIndex = Nothing
|
||||||
, collectionPageItems =
|
, collectionPageItems =
|
||||||
map (encodeRouteHome . RepoCommitR shar repo . leHash)
|
map (encodeRouteHome . RepoCommitR repo . leHash)
|
||||||
items
|
items
|
||||||
}
|
}
|
||||||
feed = changeFeed shar repo (Just ref) VCSGit items
|
feed = changeFeed repo (Just ref) VCSGit items
|
||||||
in provideHtmlFeedAndAP page feed $
|
in provideHtmlFeedAndAP page feed $
|
||||||
let refSelect = refSelectW shar repo branches tags
|
let refSelect = refSelectW repo branches tags
|
||||||
changes = changesW shar repo items
|
changes = changesW repo items
|
||||||
pageNav = navWidget navModel
|
pageNav = navWidget navModel
|
||||||
in $(widgetFile "repo/changes-git")
|
in $(widgetFile "repo/changes-git")
|
||||||
-}
|
|
||||||
|
|
||||||
getGitPatch :: KeyHashid Repo -> Text -> Handler TypedContent
|
getGitPatch :: KeyHashid Repo -> Text -> Handler TypedContent
|
||||||
getGitPatch hash ref = do
|
getGitPatch hash ref = do
|
||||||
|
|
Loading…
Reference in a new issue