{"modulePath":"github.com/RedAFD/code-core","version":"v1.14.0-rc8","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package pull\n\n## Functions\n\n```go\nfunc AddTestPullRequestTask(doer *models.User, repoID int64, branch string, isSync bool, oldCommitID, newCommitID string)\n```\nAddTestPullRequestTask adds new test tasks by given head/base repository and head/base branch, and generate new patch for testing as needed.\n\n```go\nfunc AddToTaskQueue(pr *models.PullRequest)\n```\nAddToTaskQueue adds itself to pull request test task queue.\n\n```go\nfunc ChangeTargetBranch(pr *models.PullRequest, doer *models.User, targetBranch string) (err error)\n```\nChangeTargetBranch changes the target branch of this pull request, as the given user.\n\n```go\nfunc CheckFileProtection(oldCommitID, newCommitID string, patterns []glob.Glob, limit int, env []string, repo *git.Repository) ([]string, error)\n```\nCheckFileProtection check file Protection\n\n```go\nfunc CheckPRReadyToMerge(pr *models.PullRequest, skipProtectedFilesCheck bool) (err error)\n```\nCheckPRReadyToMerge checks whether the PR is ready to be merged (reviews and status checks)\n\n```go\nfunc CheckPrsForBaseBranch(baseRepo *models.Repository, baseBranchName string) error\n```\nCheckPrsForBaseBranch check all pulls with bseBrannch\n\n```go\nfunc CloseBranchPulls(doer *models.User, repoID int64, branch string) error\n```\nCloseBranchPulls close all the pull requests who's head branch is the branch\n\n```go\nfunc CloseRepoBranchesPulls(doer *models.User, repo *models.Repository) error\n```\nCloseRepoBranchesPulls close all pull requests which head branches are in the given repository, but only whose base repo is not in the given repository\n\n```go\nfunc 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)\n```\nCreateCodeComment creates a comment on the code line\n\n```go\nfunc DismissReview(reviewID int64, message string, doer *models.User, isDismiss bool) (comment *models.Comment, err error)\n```\nDismissReview dismissing stale review by repo admin\n\n```go\nfunc DownloadDiffOrPatch(pr *models.PullRequest, w io.Writer, patch bool) error\n```\nDownloadDiffOrPatch will write the patch for the pr to the writer\n\n```go\nfunc GetDiverging(pr *models.PullRequest) (*git.DivergeObject, error)\n```\nGetDiverging determines how many commits a PR is ahead or behind the PR base branch\n\n```go\nfunc GetLastCommitStatus(pr *models.PullRequest) (status []*models.CommitStatus, err error)\n```\nGetLastCommitStatus returns list of commit statuses for latest commit on this pull request.\n\n```go\nfunc GetPullRequestCommitStatusState(pr *models.PullRequest) (structs.CommitStatusState, error)\n```\nGetPullRequestCommitStatusState returns pull request merged commit status state\n\n```go\nfunc GetSquashMergeCommitMessages(pr *models.PullRequest) string\n```\nGetSquashMergeCommitMessages returns the commit messages between head and merge base (if there is one)\n\n```go\nfunc Init() error\n```\nInit runs the task queue to test all the checking status pull requests\n\n```go\nfunc InitializePullRequests(ctx context.Context)\n```\nInitializePullRequests checks and tests untested patches of pull requests.\n\n```go\nfunc IsCommitStatusContextSuccess(commitStatuses []*models.CommitStatus, requiredContexts []string) bool\n```\nIsCommitStatusContextSuccess returns true if all required status check contexts succeed.\n\n```go\nfunc IsHeadEqualWithBranch(pr *models.PullRequest, branchName string) (bool, error)\n```\nIsHeadEqualWithBranch returns if the commits of branchName are available in pull request head\n\n```go\nfunc IsPullCommitStatusPass(pr *models.PullRequest) (bool, error)\n```\nIsPullCommitStatusPass returns if all required status checks PASS\n\n```go\nfunc IsSignedIfRequired(pr *models.PullRequest, doer *models.User) (bool, error)\n```\nIsSignedIfRequired check if merge will be signed if required\n\n```go\nfunc IsUserAllowedToMerge(pr *models.PullRequest, p models.Permission, user *models.User) (bool, error)\n```\nIsUserAllowedToMerge check if user is allowed to merge PR with given permissions and branch protections\n\n```go\nfunc IsUserAllowedToUpdate(pull *models.PullRequest, user *models.User) (bool, error)\n```\nIsUserAllowedToUpdate check if user is allowed to update PR with given permissions and branch protections\n\n```go\nfunc LFSPush(tmpBasePath, mergeHeadSHA, mergeBaseSHA string, pr *models.PullRequest) error\n```\nLFSPush pushes lfs objects referred to in new commits in the head repository from the base repository\n\n```go\nfunc Merge(pr *models.PullRequest, doer *models.User, baseGitRepo *git.Repository, mergeStyle models.MergeStyle, message string) (err error)\n```\nMerge 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.\n\n```go\nfunc MergeRequiredContextsCommitStatus(commitStatuses []*models.CommitStatus, requiredContexts []string) structs.CommitStatusState\n```\nMergeRequiredContextsCommitStatus returns a commit status state for given required contexts\n\n```go\nfunc MergedManually(pr *models.PullRequest, doer *models.User, baseGitRepo *git.Repository, commitID string) (err error)\n```\nMergedManually mark pr as merged manually\n\n```go\nfunc NewPullRequest(repo *models.Repository, pull *models.Issue, labelIDs []int64, uuids []string, pr *models.PullRequest, assigneeIDs []int64) error\n```\nNewPullRequest creates new pull request with labels for repository.\n\n```go\nfunc PushToBaseRepo(pr *models.PullRequest) (err error)\n```\nPushToBaseRepo pushes commits from branches of head repository to corresponding branches of base repository. FIXME: Only push branches that are actually updates?\n\n```go\nfunc SubmitReview(doer *models.User, gitRepo *git.Repository, issue *models.Issue, reviewType models.ReviewType, content, commitID string) (*models.Review, *models.Comment, error)\n```\nSubmitReview creates a review out of the existing pending review or creates a new one if no pending review exist\n\n```go\nfunc TestPatch(pr *models.PullRequest) error\n```\nTestPatch will test whether a simple patch will apply\n\n```go\nfunc Update(pull *models.PullRequest, doer *models.User, message string) error\n```\nUpdate updates pull request with base branch.\n\n","path":"github.com/RedAFD/code-core/services/pull","name":"pull","synopsis":"","isRedistributable":true}
