mirror of
https://code.sup39.dev/repos/Wqawg
synced 2024-12-29 00:54:52 +09:00
C2S: applyC: Implement the missing support for patching Git repos
This commit is contained in:
parent
8186e64a26
commit
b18c0cb255
1 changed files with 8 additions and 2 deletions
|
@ -112,6 +112,7 @@ import Vervis.ActorKey
|
||||||
import Vervis.Darcs
|
import Vervis.Darcs
|
||||||
import Vervis.FedURI
|
import Vervis.FedURI
|
||||||
import Vervis.Foundation
|
import Vervis.Foundation
|
||||||
|
import Vervis.Git
|
||||||
import Vervis.Model
|
import Vervis.Model
|
||||||
import Vervis.Model.Ident
|
import Vervis.Model.Ident
|
||||||
import Vervis.Model.Role
|
import Vervis.Model.Role
|
||||||
|
@ -372,7 +373,7 @@ applyC (Entity pidUser personUser) sharerUser summary audience muCap (Apply uObj
|
||||||
mapplied <- case target of
|
mapplied <- case target of
|
||||||
Right _u -> return Nothing
|
Right _u -> return Nothing
|
||||||
|
|
||||||
Left (shrTarget, rpTarget, mb) -> Just <$> do
|
Left (shrTarget, rpTarget, mbranch) -> Just <$> do
|
||||||
|
|
||||||
-- Find the target repo in DB
|
-- Find the target repo in DB
|
||||||
mrepo <- lift $ runDB $ runMaybeT $ do
|
mrepo <- lift $ runDB $ runMaybeT $ do
|
||||||
|
@ -496,8 +497,13 @@ applyC (Entity pidUser personUser) sharerUser summary audience muCap (Apply uObj
|
||||||
|
|
||||||
-- Apply patches
|
-- Apply patches
|
||||||
case repoVcs repoTarget of
|
case repoVcs repoTarget of
|
||||||
VCSGit -> error "Patching a Git repo unsupported yet"
|
VCSGit -> do
|
||||||
|
branch <- fromMaybeE mbranch "Apply target is a Git repo, but branch not specified"
|
||||||
|
unless (all ((== PatchMediaTypeGit) . fst) patches) $
|
||||||
|
throwE "Trying to apply non-Git patch to a Git repo"
|
||||||
|
applyGitPatches shrTarget rpTarget branch $ NE.map snd patches
|
||||||
VCSDarcs -> do
|
VCSDarcs -> do
|
||||||
|
verifyNothingE mbranch "Apply target is a branch of a Darcs repo"
|
||||||
patch <-
|
patch <-
|
||||||
case patches of
|
case patches of
|
||||||
_ :| (_ : _) -> throwE "Darcs repo given multiple patch bundles"
|
_ :| (_ : _) -> throwE "Darcs repo given multiple patch bundles"
|
||||||
|
|
Loading…
Reference in a new issue