Only check for conflicts/merging if the PR has not been merged in the interim (#10132)
* Only check for merging if the PR has not been merged in the interim
* fixup! Only check for merging if the PR has not been merged in the interim
* Try to fix test failure
* Use PR2 not PR1 in tests as PR1 merges automatically
* return already merged error
* enforce locking
* enforce locking - fix-test
* enforce locking - fix-testx2
* enforce locking - fix-testx3
* move pullrequest checking to after merge
This might improve the chance that the race does not affect us but does not prevent it.
* Remove minor race with getting merge commit id
* fixup
* move check pr after merge
* Remove unnecessary prepareTestEnv - onGiteaRun does this for us
* Add information about when merging occuring
* fix fmt
* More logging
* Attempt to fix mysql
* Try MySQL fix again
* try again
* Try again?!
* Try again?!
* Sigh
* remove the count - perhaps that will help
* next remove the update id
* next remove the update id - make it updated_unix instead
* On failure to merge ensure that the pr is rechecked for conflict errors
* On failure to merge ensure that the pr is rechecked for conflict errors
* Update models/pull.go
* Update models/pull.go
Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
* Apply suggestions from code review
Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
log.Error("git checkout base prior to merge post staging rebase [%s:%s -> %s:%s]: %v\n%s\n%s",pr.HeadRepo.FullName(),pr.HeadBranch,pr.BaseRepo.FullName(),pr.BaseBranch,err,outbuf.String(),errbuf.String())
returnfmt.Errorf("git checkout base prior to merge post staging rebase [%s:%s -> %s:%s]: %v\n%s\n%s",pr.HeadRepo.FullName(),pr.HeadBranch,pr.BaseRepo.FullName(),pr.BaseBranch,err,outbuf.String(),errbuf.String())
return"",fmt.Errorf("git checkout base prior to merge post staging rebase [%s:%s -> %s:%s]: %v\n%s\n%s",pr.HeadRepo.FullName(),pr.HeadBranch,pr.BaseRepo.FullName(),pr.BaseBranch,err,outbuf.String(),errbuf.String())
log.Error("git rebase staging on to base [%s:%s -> %s:%s]: %v\n%s\n%s",pr.HeadRepo.FullName(),pr.HeadBranch,pr.BaseRepo.FullName(),pr.BaseBranch,err,outbuf.String(),errbuf.String())
returnfmt.Errorf("git rebase staging on to base [%s:%s -> %s:%s]: %v\n%s\n%s",pr.HeadRepo.FullName(),pr.HeadBranch,pr.BaseRepo.FullName(),pr.BaseBranch,err,outbuf.String(),errbuf.String())
return"",fmt.Errorf("git rebase staging on to base [%s:%s -> %s:%s]: %v\n%s\n%s",pr.HeadRepo.FullName(),pr.HeadBranch,pr.BaseRepo.FullName(),pr.BaseBranch,err,outbuf.String(),errbuf.String())
}
log.Debug("RebaseConflict at %s [%s:%s -> %s:%s]: %v\n%s\n%s",strings.TrimSpace(string(commitShaBytes)),pr.HeadRepo.FullName(),pr.HeadBranch,pr.BaseRepo.FullName(),pr.BaseBranch,err,outbuf.String(),errbuf.String())
log.Error("git rebase staging on to base [%s:%s -> %s:%s]: %v\n%s\n%s",pr.HeadRepo.FullName(),pr.HeadBranch,pr.BaseRepo.FullName(),pr.BaseBranch,err,outbuf.String(),errbuf.String())
returnfmt.Errorf("git rebase staging on to base [%s:%s -> %s:%s]: %v\n%s\n%s",pr.HeadRepo.FullName(),pr.HeadBranch,pr.BaseRepo.FullName(),pr.BaseBranch,err,outbuf.String(),errbuf.String())
return"",fmt.Errorf("git rebase staging on to base [%s:%s -> %s:%s]: %v\n%s\n%s",pr.HeadRepo.FullName(),pr.HeadBranch,pr.BaseRepo.FullName(),pr.BaseBranch,err,outbuf.String(),errbuf.String())
log.Error("git checkout base prior to merge post staging rebase [%s:%s -> %s:%s]: %v\n%s\n%s",pr.HeadRepo.FullName(),pr.HeadBranch,pr.BaseRepo.FullName(),pr.BaseBranch,err,outbuf.String(),errbuf.String())
returnfmt.Errorf("git checkout base prior to merge post staging rebase [%s:%s -> %s:%s]: %v\n%s\n%s",pr.HeadRepo.FullName(),pr.HeadBranch,pr.BaseRepo.FullName(),pr.BaseBranch,err,outbuf.String(),errbuf.String())
return"",fmt.Errorf("git checkout base prior to merge post staging rebase [%s:%s -> %s:%s]: %v\n%s\n%s",pr.HeadRepo.FullName(),pr.HeadBranch,pr.BaseRepo.FullName(),pr.BaseBranch,err,outbuf.String(),errbuf.String())