Adding upstream version 3.10.8.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
37e9b6d587
commit
03bfe4079e
356 changed files with 28857 additions and 0 deletions
66
tree/f3/repository.go
Normal file
66
tree/f3/repository.go
Normal file
|
@ -0,0 +1,66 @@
|
|||
// Copyright Earl Warren <contact@earl-warren.org>
|
||||
// Copyright Loïc Dachary <loic@dachary.org>
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package f3
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"code.forgejo.org/f3/gof3/v3/f3"
|
||||
"code.forgejo.org/f3/gof3/v3/path"
|
||||
"code.forgejo.org/f3/gof3/v3/tree/generic"
|
||||
)
|
||||
|
||||
type RepositoryDriverInterface interface {
|
||||
GetRepositoryURL() string
|
||||
GetRepositoryPushURL() string
|
||||
GetRepositoryInternalRefs() []string
|
||||
}
|
||||
|
||||
type RepositoryNodeDriverProxyInterface interface {
|
||||
RepositoryDriverInterface
|
||||
}
|
||||
|
||||
type RepositoryNodeInterface interface {
|
||||
generic.NodeInterface
|
||||
RepositoryNodeDriverProxyInterface
|
||||
}
|
||||
|
||||
type repositoryNode struct {
|
||||
generic.Node
|
||||
}
|
||||
|
||||
func (o *repositoryNode) GetRepositoryURL() string {
|
||||
return o.GetDriver().(RepositoryDriverInterface).GetRepositoryURL()
|
||||
}
|
||||
|
||||
func (o *repositoryNode) GetRepositoryPushURL() string {
|
||||
return o.GetDriver().(RepositoryDriverInterface).GetRepositoryPushURL()
|
||||
}
|
||||
|
||||
func (o *repositoryNode) GetRepositoryInternalRefs() []string {
|
||||
return o.GetDriver().(RepositoryDriverInterface).GetRepositoryInternalRefs()
|
||||
}
|
||||
|
||||
func newRepositoryNode(ctx context.Context, tree generic.TreeInterface) generic.NodeInterface {
|
||||
node := &repositoryNode{}
|
||||
return node.Init(node)
|
||||
}
|
||||
|
||||
func NewRepositoryPath[T, U any](owners string, owner T, project U) path.Path {
|
||||
return generic.NewPathFromString(NewRepositoryPathString(owners, owner, project))
|
||||
}
|
||||
|
||||
func NewRepositoryPathString[T, U any](owners string, owner T, project U) string {
|
||||
return fmt.Sprintf("%s/%v/projects/%v/repositories/vcs", owners, owner, project)
|
||||
}
|
||||
|
||||
func NewRepositoryReference[T, U any](owners string, owner T, project U) *f3.Reference {
|
||||
return f3.NewReference(NewRepositoryPathString(owners, owner, project))
|
||||
}
|
||||
|
||||
func NewPullRequestSameRepositoryReference() *f3.Reference {
|
||||
return f3.NewReference("../../repositories/vcs")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue