repository

package
v1.16.1 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2022 License: MIT Imports: 28 Imported by: 31

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 *repo_model.Repository) (*repo_model.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 CreateRepository added in v1.12.0

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

CreateRepository creates a repository for the user/organization.

func GenerateGitContent added in v1.12.0

func GenerateGitContent(ctx context.Context, templateRepo, generateRepo *repo_model.Repository) error

GenerateGitContent generates git content from a template repository

func GenerateRepository added in v1.12.0

func GenerateRepository(ctx context.Context, doer, owner *user_model.User, templateRepo *repo_model.Repository, opts models.GenerateRepoOptions) (_ *repo_model.Repository, err error)

GenerateRepository generates a repository from a template

func IsForcePush added in v1.14.0

func IsForcePush(opts *PushUpdateOptions) (bool, error)

IsForcePush detect if a push is a force push

func MigrateRepositoryGitData

func MigrateRepositoryGitData(ctx context.Context, u *user_model.User,
	repo *repo_model.Repository, opts migration.MigrateOptions,
	httpTransport *http.Transport,
) (*repo_model.Repository, error)

MigrateRepositoryGitData starts migrating git related data after created migrating repository

func PushUpdateAddTag added in v1.12.0

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

PushUpdateAddTag must be called for any push actions to add tag

func StoreMissingLfsObjectsInRepository added in v1.15.0

func StoreMissingLfsObjectsInRepository(ctx context.Context, repo *repo_model.Repository, gitRepo *git.Repository, lfsClient lfs.Client) error

StoreMissingLfsObjectsInRepository downloads missing LFS objects

func SyncReleasesWithTags

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

SyncReleasesWithTags synchronizes release table with repository tags

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 {
	Commits    []*PushCommit
	HeadCommit *PushCommit
	CompareURL string
	Len        int
	// contains filtered or unexported fields
}

PushCommits represents list of commits in a push operation.

func GitToPushCommits added in v1.16.0

func GitToPushCommits(gitCommits []*git.Commit) *PushCommits

GitToPushCommits transforms a list of git.Commits 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, *api.PayloadCommit, error)

ToAPIPayloadCommits converts a PushCommits object to api.PayloadCommit format. It returns all converted commits and, if provided, the head commit or an error otherwise.

type PushUpdateOptions added in v1.14.0

type PushUpdateOptions struct {
	PusherID     int64
	PusherName   string
	RepoUserName string
	RepoName     string
	RefFullName  string // branch, tag or other name to push
	OldCommitID  string
	NewCommitID  string
}

PushUpdateOptions defines the push update options

func (*PushUpdateOptions) BranchName added in v1.14.0

func (opts *PushUpdateOptions) BranchName() string

BranchName returns simple branch name if it's an operation to branch

func (*PushUpdateOptions) IsBranch added in v1.14.0

func (opts *PushUpdateOptions) IsBranch() bool

IsBranch return true if it's a push to branch

func (*PushUpdateOptions) IsDelBranch added in v1.14.0

func (opts *PushUpdateOptions) IsDelBranch() bool

IsDelBranch return true if it's a deletion to a branch

func (*PushUpdateOptions) IsDelRef added in v1.14.0

func (opts *PushUpdateOptions) IsDelRef() bool

IsDelRef return true if it's a deletion to a branch or tag

func (*PushUpdateOptions) IsDelTag added in v1.14.0

func (opts *PushUpdateOptions) IsDelTag() bool

IsDelTag return true if it's a deletion to a tag

func (*PushUpdateOptions) IsNewBranch added in v1.14.0

func (opts *PushUpdateOptions) IsNewBranch() bool

IsNewBranch return true if it's the first-time push to a branch

func (*PushUpdateOptions) IsNewRef added in v1.14.0

func (opts *PushUpdateOptions) IsNewRef() bool

IsNewRef return true if it's a first-time push to a branch, tag or etc.

func (*PushUpdateOptions) IsNewTag added in v1.14.0

func (opts *PushUpdateOptions) IsNewTag() bool

IsNewTag return true if it's a creation to a tag

func (*PushUpdateOptions) IsTag added in v1.14.0

func (opts *PushUpdateOptions) IsTag() bool

IsTag return true if it's an operation to a tag

func (*PushUpdateOptions) IsUpdateBranch added in v1.14.0

func (opts *PushUpdateOptions) IsUpdateBranch() bool

IsUpdateBranch return true if it's not the first push to a branch

func (*PushUpdateOptions) IsUpdateRef added in v1.14.0

func (opts *PushUpdateOptions) IsUpdateRef() bool

IsUpdateRef return true if it's an update operation

func (*PushUpdateOptions) RefName added in v1.14.0

func (opts *PushUpdateOptions) RefName() string

RefName returns simple name for ref

func (*PushUpdateOptions) RepoFullName added in v1.14.0

func (opts *PushUpdateOptions) RepoFullName() string

RepoFullName returns repo full name

func (*PushUpdateOptions) TagName added in v1.14.0

func (opts *PushUpdateOptions) TagName() string

TagName returns simple tag name if it's an operation to a tag

Jump to

Keyboard shortcuts

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