|
|
|
@ -881,7 +881,7 @@ func MergePullRequest(ctx *context.APIContext) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// start with merging by checking
|
|
|
|
|
if err := pull_service.CheckPullMergable(ctx, ctx.Doer, &ctx.Repo.Permission, pr, mergeCheckType, form.ForceMerge); err != nil { |
|
|
|
|
if err := pull_service.CheckPullMergeable(ctx, ctx.Doer, &ctx.Repo.Permission, pr, mergeCheckType, form.ForceMerge); err != nil { |
|
|
|
|
if errors.Is(err, pull_service.ErrIsClosed) { |
|
|
|
|
ctx.NotFound() |
|
|
|
|
} else if errors.Is(err, pull_service.ErrUserNotAllowedToMerge) { |
|
|
|
@ -890,7 +890,7 @@ func MergePullRequest(ctx *context.APIContext) { |
|
|
|
|
ctx.Error(http.StatusMethodNotAllowed, "PR already merged", "") |
|
|
|
|
} else if errors.Is(err, pull_service.ErrIsWorkInProgress) { |
|
|
|
|
ctx.Error(http.StatusMethodNotAllowed, "PR is a work in progress", "Work in progress PRs cannot be merged") |
|
|
|
|
} else if errors.Is(err, pull_service.ErrNotMergableState) { |
|
|
|
|
} else if errors.Is(err, pull_service.ErrNotMergeableState) { |
|
|
|
|
ctx.Error(http.StatusMethodNotAllowed, "PR not in mergeable state", "Please try again later") |
|
|
|
|
} else if models.IsErrDisallowedToMerge(err) { |
|
|
|
|
ctx.Error(http.StatusMethodNotAllowed, "PR is not ready to be merged", err) |
|
|
|
|