Cache PullRequest Divergence (#10914)
* Cache PullRequest Divergence * only re-calc divergence if AddTestPullRequestTask() is exec * migrate already open pulls * finalize * take care of closed¬-merged+deleted-branch pull requests * fix nil pointer exeption Signed-off-by: 6543 <6543@obermui.de> * try this * no error its a warn * init gitea-repositories-meta * dont use gitDivergence type * CI.restart() * CI.restart() * CI.restart() * CI.restart() * check IsUserAllowedToUpdate independend from CommitsBehind
This commit is contained in:
parent
c571c5bb28
commit
10e2f29144
7 changed files with 122 additions and 12 deletions
|
@ -399,8 +399,6 @@ func PrepareViewPullInfo(ctx *context.Context, issue *models.Issue) *git.Compare
|
|||
var headBranchSha string
|
||||
// HeadRepo may be missing
|
||||
if pull.HeadRepo != nil {
|
||||
var err error
|
||||
|
||||
headGitRepo, err := git.OpenRepository(pull.HeadRepo.RepoPath())
|
||||
if err != nil {
|
||||
ctx.ServerError("OpenRepository", err)
|
||||
|
@ -420,19 +418,11 @@ func PrepareViewPullInfo(ctx *context.Context, issue *models.Issue) *git.Compare
|
|||
}
|
||||
|
||||
if headBranchExist {
|
||||
allowUpdate, err := pull_service.IsUserAllowedToUpdate(pull, ctx.User)
|
||||
ctx.Data["UpdateAllowed"], err = pull_service.IsUserAllowedToUpdate(pull, ctx.User)
|
||||
if err != nil {
|
||||
ctx.ServerError("IsUserAllowedToUpdate", err)
|
||||
return nil
|
||||
}
|
||||
ctx.Data["UpdateAllowed"] = allowUpdate
|
||||
|
||||
divergence, err := pull_service.GetDiverging(pull)
|
||||
if err != nil {
|
||||
ctx.ServerError("GetDiverging", err)
|
||||
return nil
|
||||
}
|
||||
ctx.Data["Divergence"] = divergence
|
||||
ctx.Data["GetCommitMessages"] = pull_service.GetCommitMessages(pull)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue