123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- package gitutil
- import (
- "github.com/gogs/git-module"
- )
- type Moduler interface {
-
- RepoAddRemote(repoPath, name, url string, opts ...git.AddRemoteOptions) error
-
-
- RepoDiffNameOnly(repoPath, base, head string, opts ...git.DiffNameOnlyOptions) ([]string, error)
-
-
- RepoLog(repoPath, rev string, opts ...git.LogOptions) ([]*git.Commit, error)
-
-
- RepoMergeBase(repoPath, base, head string, opts ...git.MergeBaseOptions) (string, error)
-
- RepoRemoveRemote(repoPath, name string, opts ...git.RemoveRemoteOptions) error
-
- RepoTags(repoPath string, opts ...git.TagsOptions) ([]string, error)
- Utiler
- }
- type Utiler interface {
-
- PullRequestMeta(headPath, basePath, headBranch, baseBranch string) (*PullRequestMeta, error)
-
- ListTagsAfter(repoPath, after string, limit int) (*TagsPage, error)
- }
- type moduler struct{}
- func (moduler) RepoAddRemote(repoPath, name, url string, opts ...git.AddRemoteOptions) error {
- if MockModule.RepoAddRemote != nil {
- return MockModule.RepoAddRemote(repoPath, name, url, opts...)
- }
- return git.RepoAddRemote(repoPath, name, url, opts...)
- }
- func (moduler) RepoDiffNameOnly(repoPath, base, head string, opts ...git.DiffNameOnlyOptions) ([]string, error) {
- if MockModule.RepoDiffNameOnly != nil {
- return MockModule.RepoDiffNameOnly(repoPath, base, head, opts...)
- }
- return git.RepoDiffNameOnly(repoPath, base, head, opts...)
- }
- func (moduler) RepoLog(repoPath, rev string, opts ...git.LogOptions) ([]*git.Commit, error) {
- if MockModule.RepoLog != nil {
- return MockModule.RepoLog(repoPath, rev, opts...)
- }
- return git.RepoLog(repoPath, rev, opts...)
- }
- func (moduler) RepoMergeBase(repoPath, base, head string, opts ...git.MergeBaseOptions) (string, error) {
- if MockModule.RepoMergeBase != nil {
- return MockModule.RepoMergeBase(repoPath, base, head, opts...)
- }
- return git.RepoMergeBase(repoPath, base, head, opts...)
- }
- func (moduler) RepoRemoveRemote(repoPath, name string, opts ...git.RemoveRemoteOptions) error {
- if MockModule.RepoRemoveRemote != nil {
- return MockModule.RepoRemoveRemote(repoPath, name, opts...)
- }
- return git.RepoRemoveRemote(repoPath, name, opts...)
- }
- func (moduler) RepoTags(repoPath string, opts ...git.TagsOptions) ([]string, error) {
- if MockModule.RepoTags != nil {
- return MockModule.RepoTags(repoPath, opts...)
- }
- return git.RepoTags(repoPath, opts...)
- }
- var Module Moduler = moduler{}
|