|
|
|
@ -34,7 +34,6 @@ import ( |
|
|
|
|
|
|
|
|
|
// 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 Merge(pr *models.PullRequest, doer *user_model.User, baseGitRepo *git.Repository, mergeStyle repo_model.MergeStyle, expectedHeadCommitID, message string) error { |
|
|
|
|
if err := pr.LoadHeadRepo(); err != nil { |
|
|
|
|
log.Error("LoadHeadRepo: %v", err) |
|
|
|
@ -44,6 +43,9 @@ func Merge(pr *models.PullRequest, doer *user_model.User, baseGitRepo *git.Repos |
|
|
|
|
return fmt.Errorf("LoadBaseRepo: %v", err) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pullWorkingPool.CheckIn(fmt.Sprint(pr.ID)) |
|
|
|
|
defer pullWorkingPool.CheckOut(fmt.Sprint(pr.ID)) |
|
|
|
|
|
|
|
|
|
prUnit, err := pr.BaseRepo.GetUnit(unit.TypePullRequests) |
|
|
|
|
if err != nil { |
|
|
|
|
log.Error("pr.BaseRepo.GetUnit(unit.TypePullRequests): %v", err) |
|
|
|
@ -726,6 +728,9 @@ func CheckPullBranchProtections(ctx context.Context, pr *models.PullRequest, ski |
|
|
|
|
|
|
|
|
|
// MergedManually mark pr as merged manually
|
|
|
|
|
func MergedManually(pr *models.PullRequest, doer *user_model.User, baseGitRepo *git.Repository, commitID string) error { |
|
|
|
|
pullWorkingPool.CheckIn(fmt.Sprint(pr.ID)) |
|
|
|
|
defer pullWorkingPool.CheckOut(fmt.Sprint(pr.ID)) |
|
|
|
|
|
|
|
|
|
if err := db.WithTx(func(ctx context.Context) error { |
|
|
|
|
prUnit, err := pr.BaseRepo.GetUnitCtx(ctx, unit.TypePullRequests) |
|
|
|
|
if err != nil { |
|
|
|
|