repository

package
v1.13.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2021 License: MIT Imports: 25 Imported by: 31

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdoptRepository added in v1.13.0

func AdoptRepository(doer, u *models.User, opts models.CreateRepoOptions) (*models.Repository, error)

AdoptRepository adopts a repository for the user/organization.

func CacheRef added in v1.13.0

func CacheRef(repo *models.Repository, gitRepo *git.Repository, fullRefName string) error

CacheRef cachhe last commit information of the branch or the tag

func CheckDelegateHooks added in v1.12.0

func CheckDelegateHooks(repoPath string) ([]string, error)

CheckDelegateHooks checks the hooks scripts for the repo

func CleanUpMigrateInfo

func CleanUpMigrateInfo(repo *models.Repository) (*models.Repository, error)

CleanUpMigrateInfo finishes migrating repository and/or wiki with things that don't need to be done for mirrors.

func CreateDelegateHooks added in v1.12.0

func CreateDelegateHooks(repoPath string) error

CreateDelegateHooks creates all the hooks scripts for the repo

func CreateNewBranch added in v1.12.0

func CreateNewBranch(doer *models.User, repo *models.Repository, oldBranchName, branchName string) (err error)

CreateNewBranch creates a new repository branch

func CreateNewBranchFromCommit added in v1.12.0

func CreateNewBranchFromCommit(doer *models.User, repo *models.Repository, commit, branchName string) (err error)

CreateNewBranchFromCommit creates a new repository branch

func CreateRepository added in v1.12.0

func CreateRepository(doer, u *models.User, opts models.CreateRepoOptions) (*models.Repository, error)

CreateRepository creates a repository for the user/organization.

func DeleteMissingRepositories added in v1.12.0

func DeleteMissingRepositories(ctx context.Context, doer *models.User) error

DeleteMissingRepositories deletes all repository records that lost Git files.

func DeleteUnadoptedRepository added in v1.13.0

func DeleteUnadoptedRepository(doer, u *models.User, repoName string) error

DeleteUnadoptedRepository deletes unadopted repository files from the filesystem

func ForkRepository added in v1.12.0

func ForkRepository(doer, owner *models.User, oldRepo *models.Repository, name, desc string) (_ *models.Repository, err error)

ForkRepository forks a repository

func GenerateGitContent added in v1.12.0

func GenerateGitContent(ctx models.DBContext, templateRepo, generateRepo *models.Repository) error

GenerateGitContent generates git content from a template repository

func GenerateRepository added in v1.12.0

func GenerateRepository(ctx models.DBContext, doer, owner *models.User, templateRepo *models.Repository, opts models.GenerateRepoOptions) (_ *models.Repository, err error)

GenerateRepository generates a repository from a template

func GetBranch added in v1.12.0

func GetBranch(repo *models.Repository, branch string) (*git.Branch, error)

GetBranch returns a branch by its name

func GetBranches added in v1.12.0

func GetBranches(repo *models.Repository) ([]*git.Branch, error)

GetBranches returns all the branches of a repository

func GitFsck added in v1.12.0

func GitFsck(ctx context.Context, timeout time.Duration, args []string) error

GitFsck calls 'git fsck' to check repository health.

func GitGcRepos added in v1.12.0

func GitGcRepos(ctx context.Context, timeout time.Duration, args ...string) error

GitGcRepos calls 'git gc' to remove unnecessary files and optimize the local repository

func ListUnadoptedRepositories added in v1.13.0

func ListUnadoptedRepositories(query string, opts *models.ListOptions) ([]string, int, error)

ListUnadoptedRepositories lists all the unadopted repositories that match the provided query

func MigrateRepositoryGitData

func MigrateRepositoryGitData(ctx context.Context, u *models.User, repo *models.Repository, opts migration.MigrateOptions) (*models.Repository, error)

MigrateRepositoryGitData starts migrating git related data after created migrating repository

func PushUpdateAddDeleteTags added in v1.12.0

func PushUpdateAddDeleteTags(repo *models.Repository, gitRepo *git.Repository, addTags, delTags []string) error

PushUpdateAddDeleteTags updates a number of added and delete tags

func PushUpdateAddTag added in v1.12.0

func PushUpdateAddTag(repo *models.Repository, gitRepo *git.Repository, tagName string) error

PushUpdateAddTag must be called for any push actions to add tag

func ReinitMissingRepositories added in v1.12.0

func ReinitMissingRepositories(ctx context.Context) error

ReinitMissingRepositories reinitializes all repository records that lost Git files.

func SyncReleasesWithTags

func SyncReleasesWithTags(repo *models.Repository, gitRepo *git.Repository) error

SyncReleasesWithTags synchronizes release table with repository tags

func SyncRepositoryHooks added in v1.12.0

func SyncRepositoryHooks(ctx context.Context) error

SyncRepositoryHooks rewrites all repositories' pre-receive, update and post-receive hooks to make sure the binary and custom conf path are up-to-date.

func WikiRemoteURL added in v1.13.0

func WikiRemoteURL(remote string) string

WikiRemoteURL returns accessible repository URL for wiki if exists. Otherwise, it returns an empty string.

Types

type PushCommit added in v1.12.0

type PushCommit struct {
	Sha1           string
	Message        string
	AuthorEmail    string
	AuthorName     string
	CommitterEmail string
	CommitterName  string
	Timestamp      time.Time
}

PushCommit represents a commit in a push operation.

func CommitToPushCommit added in v1.12.0

func CommitToPushCommit(commit *git.Commit) *PushCommit

CommitToPushCommit transforms a git.Commit to PushCommit type.

type PushCommits added in v1.12.0

type PushCommits struct {
	Len        int
	Commits    []*PushCommit
	CompareURL string
	// contains filtered or unexported fields
}

PushCommits represents list of commits in a push operation.

func ListToPushCommits added in v1.12.0

func ListToPushCommits(l *list.List) *PushCommits

ListToPushCommits transforms a list.List to PushCommits type.

func NewPushCommits added in v1.12.0

func NewPushCommits() *PushCommits

NewPushCommits creates a new PushCommits object.

func (pc *PushCommits) AvatarLink(email string) string

AvatarLink tries to match user in database with e-mail in order to show custom avatar, and falls back to general avatar link.

func (*PushCommits) ToAPIPayloadCommits added in v1.12.0

func (pc *PushCommits) ToAPIPayloadCommits(repoPath, repoLink string) ([]*api.PayloadCommit, error)

ToAPIPayloadCommits converts a PushCommits object to api.PayloadCommit format.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL