Documentation ¶
Index ¶
- func AddTestPullRequestTask(doer *models.User, repoID int64, branch string, isSync bool, ...)
- func AddToTaskQueue(pr *models.PullRequest)
- func ChangeTargetBranch(pr *models.PullRequest, doer *models.User, targetBranch string) (err error)
- func CheckFileProtection(oldCommitID, newCommitID string, patterns []glob.Glob, limit int, env []string, ...) ([]string, error)
- func CheckPRReadyToMerge(pr *models.PullRequest, skipProtectedFilesCheck bool) (err error)
- func CheckPrsForBaseBranch(baseRepo *models.Repository, baseBranchName string) error
- func CloseBranchPulls(doer *models.User, repoID int64, branch string) error
- func CloseRepoBranchesPulls(doer *models.User, repo *models.Repository) error
- func CreateCodeComment(doer *models.User, gitRepo *git.Repository, issue *models.Issue, line int64, ...) (*models.Comment, error)
- func DownloadDiffOrPatch(pr *models.PullRequest, w io.Writer, patch bool) error
- func GetCommitMessages(pr *models.PullRequest) string
- func GetDiverging(pr *models.PullRequest) (*git.DivergeObject, error)
- func GetLastCommitStatus(pr *models.PullRequest) (status *models.CommitStatus, err error)
- func GetPullRequestCommitStatusState(pr *models.PullRequest) (structs.CommitStatusState, error)
- func Init() error
- func InitializePullRequests(ctx context.Context)
- func IsCommitStatusContextSuccess(commitStatuses []*models.CommitStatus, requiredContexts []string) bool
- func IsHeadEqualWithBranch(pr *models.PullRequest, branchName string) (bool, error)
- func IsPullCommitStatusPass(pr *models.PullRequest) (bool, error)
- func IsSignedIfRequired(pr *models.PullRequest, doer *models.User) (bool, error)
- func IsUserAllowedToMerge(pr *models.PullRequest, p models.Permission, user *models.User) (bool, error)
- func IsUserAllowedToUpdate(pull *models.PullRequest, user *models.User) (bool, error)
- func LFSPush(tmpBasePath, mergeHeadSHA, mergeBaseSHA string, pr *models.PullRequest) error
- func Merge(pr *models.PullRequest, doer *models.User, baseGitRepo *git.Repository, ...) (err error)
- func MergeRequiredContextsCommitStatus(commitStatuses []*models.CommitStatus, requiredContexts []string) structs.CommitStatusState
- func NewPullRequest(repo *models.Repository, pull *models.Issue, labelIDs []int64, uuids []string, ...) error
- func PushToBaseRepo(pr *models.PullRequest) (err error)
- func SubmitReview(doer *models.User, gitRepo *git.Repository, issue *models.Issue, ...) (*models.Review, *models.Comment, error)
- func TestPatch(pr *models.PullRequest) error
- func Update(pull *models.PullRequest, doer *models.User, message string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddTestPullRequestTask ¶ added in v1.11.0
func AddTestPullRequestTask(doer *models.User, repoID int64, branch string, isSync bool, oldCommitID, newCommitID string)
AddTestPullRequestTask adds new test tasks by given head/base repository and head/base branch, and generate new patch for testing as needed.
func AddToTaskQueue ¶ added in v1.11.0
func AddToTaskQueue(pr *models.PullRequest)
AddToTaskQueue adds itself to pull request test task queue.
func ChangeTargetBranch ¶ added in v1.11.0
ChangeTargetBranch changes the target branch of this pull request, as the given user.
func CheckFileProtection ¶ added in v1.13.0
func CheckFileProtection(oldCommitID, newCommitID string, patterns []glob.Glob, limit int, env []string, repo *git.Repository) ([]string, error)
CheckFileProtection check file Protection
func CheckPRReadyToMerge ¶ added in v1.12.0
func CheckPRReadyToMerge(pr *models.PullRequest, skipProtectedFilesCheck bool) (err error)
CheckPRReadyToMerge checks whether the PR is ready to be merged (reviews and status checks)
func CheckPrsForBaseBranch ¶ added in v1.13.0
func CheckPrsForBaseBranch(baseRepo *models.Repository, baseBranchName string) error
CheckPrsForBaseBranch check all pulls with bseBrannch
func CloseBranchPulls ¶ added in v1.11.0
CloseBranchPulls close all the pull requests who's head branch is the branch
func CloseRepoBranchesPulls ¶ added in v1.11.0
func CloseRepoBranchesPulls(doer *models.User, repo *models.Repository) error
CloseRepoBranchesPulls close all pull requests which head branches are in the given repository
func CreateCodeComment ¶ added in v1.11.0
func CreateCodeComment(doer *models.User, gitRepo *git.Repository, issue *models.Issue, line int64, content string, treePath string, isReview bool, replyReviewID int64, latestCommitID string) (*models.Comment, error)
CreateCodeComment creates a comment on the code line
func DownloadDiffOrPatch ¶ added in v1.11.0
DownloadDiffOrPatch will write the patch for the pr to the writer
func GetCommitMessages ¶ added in v1.12.0
func GetCommitMessages(pr *models.PullRequest) string
GetCommitMessages returns the commit messages between head and merge base (if there is one)
func GetDiverging ¶ added in v1.12.0
func GetDiverging(pr *models.PullRequest) (*git.DivergeObject, error)
GetDiverging determines how many commits a PR is ahead or behind the PR base branch
func GetLastCommitStatus ¶ added in v1.12.0
func GetLastCommitStatus(pr *models.PullRequest) (status *models.CommitStatus, err error)
GetLastCommitStatus returns the last commit status for this pull request.
func GetPullRequestCommitStatusState ¶ added in v1.11.0
func GetPullRequestCommitStatusState(pr *models.PullRequest) (structs.CommitStatusState, error)
GetPullRequestCommitStatusState returns pull request merged commit status state
func Init ¶ added in v1.11.0
func Init() error
Init runs the task queue to test all the checking status pull requests
func InitializePullRequests ¶ added in v1.12.0
InitializePullRequests checks and tests untested patches of pull requests.
func IsCommitStatusContextSuccess ¶
func IsCommitStatusContextSuccess(commitStatuses []*models.CommitStatus, requiredContexts []string) bool
IsCommitStatusContextSuccess returns true if all required status check contexts succeed.
func IsHeadEqualWithBranch ¶ added in v1.12.0
func IsHeadEqualWithBranch(pr *models.PullRequest, branchName string) (bool, error)
IsHeadEqualWithBranch returns if the commits of branchName are available in pull request head
func IsPullCommitStatusPass ¶
func IsPullCommitStatusPass(pr *models.PullRequest) (bool, error)
IsPullCommitStatusPass returns if all required status checks PASS
func IsSignedIfRequired ¶ added in v1.12.0
IsSignedIfRequired check if merge will be signed if required
func IsUserAllowedToMerge ¶ added in v1.12.0
func IsUserAllowedToMerge(pr *models.PullRequest, p models.Permission, user *models.User) (bool, error)
IsUserAllowedToMerge check if user is allowed to merge PR with given permissions and branch protections
func IsUserAllowedToUpdate ¶ added in v1.12.0
IsUserAllowedToUpdate check if user is allowed to update PR with given permissions and branch protections
func LFSPush ¶
func LFSPush(tmpBasePath, mergeHeadSHA, mergeBaseSHA string, pr *models.PullRequest) error
LFSPush pushes lfs objects referred to in new commits in the head repository from the base repository
func Merge ¶
func Merge(pr *models.PullRequest, doer *models.User, baseGitRepo *git.Repository, mergeStyle models.MergeStyle, message string) (err error)
Merge merges pull request to base repository. Caller should check PR is ready to be merged (review and status checks) FIXME: add repoWorkingPull make sure two merges does not happen at same time.
func MergeRequiredContextsCommitStatus ¶ added in v1.11.0
func MergeRequiredContextsCommitStatus(commitStatuses []*models.CommitStatus, requiredContexts []string) structs.CommitStatusState
MergeRequiredContextsCommitStatus returns a commit status state for given required contexts
func NewPullRequest ¶
func NewPullRequest(repo *models.Repository, pull *models.Issue, labelIDs []int64, uuids []string, pr *models.PullRequest, assigneeIDs []int64) error
NewPullRequest creates new pull request with labels for repository.
func PushToBaseRepo ¶ added in v1.11.0
func PushToBaseRepo(pr *models.PullRequest) (err error)
PushToBaseRepo pushes commits from branches of head repository to corresponding branches of base repository. FIXME: Only push branches that are actually updates?
func SubmitReview ¶ added in v1.11.0
func SubmitReview(doer *models.User, gitRepo *git.Repository, issue *models.Issue, reviewType models.ReviewType, content, commitID string) (*models.Review, *models.Comment, error)
SubmitReview creates a review out of the existing pending review or creates a new one if no pending review exist
func TestPatch ¶ added in v1.11.0
func TestPatch(pr *models.PullRequest) error
TestPatch will test whether a simple patch will apply
Types ¶
This section is empty.