diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2022-11-19 09:12:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-19 09:12:33 +0100 |
commit | 044c754ea53f5b81f451451df53aea366f6f700a (patch) | |
tree | 45688c28a84f87f71ec3f99eb0e8456eb7d19c42 /services/agit/agit.go | |
parent | Timeline and color tweaks (#21799) (diff) | |
download | forgejo-044c754ea53f5b81f451451df53aea366f6f700a.tar.xz forgejo-044c754ea53f5b81f451451df53aea366f6f700a.zip |
Add `context.Context` to more methods (#21546)
This PR adds a context parameter to a bunch of methods. Some helper
`xxxCtx()` methods got replaced with the normal name now.
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'services/agit/agit.go')
-rw-r--r-- | services/agit/agit.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/services/agit/agit.go b/services/agit/agit.go index a7e701d6c4..803ff696b0 100644 --- a/services/agit/agit.go +++ b/services/agit/agit.go @@ -96,7 +96,7 @@ func ProcReceive(ctx context.Context, repo *repo_model.Repository, gitRepo *git. headBranch = curentTopicBranch } - pr, err := issues_model.GetUnmergedPullRequest(repo.ID, repo.ID, headBranch, baseBranchName, issues_model.PullRequestFlowAGit) + pr, err := issues_model.GetUnmergedPullRequest(ctx, repo.ID, repo.ID, headBranch, baseBranchName, issues_model.PullRequestFlowAGit) if err != nil { if !issues_model.IsErrPullRequestNotExist(err) { return nil, fmt.Errorf("Failed to get unmerged agit flow pull request in repository: %s/%s Error: %w", ownerName, repoName, err) @@ -159,7 +159,7 @@ func ProcReceive(ctx context.Context, repo *repo_model.Repository, gitRepo *git. } // update exist pull request - if err := pr.LoadBaseRepoCtx(ctx); err != nil { + if err := pr.LoadBaseRepo(ctx); err != nil { return nil, fmt.Errorf("Unable to load base repository for PR[%d] Error: %w", pr.ID, err) } @@ -203,15 +203,15 @@ func ProcReceive(ctx context.Context, repo *repo_model.Repository, gitRepo *git. if err != nil { return nil, fmt.Errorf("Failed to get user. Error: %w", err) } - err = pr.LoadIssue() + err = pr.LoadIssue(ctx) if err != nil { return nil, fmt.Errorf("Failed to load pull issue. Error: %w", err) } comment, err := issues_model.CreatePushPullComment(ctx, pusher, pr, oldCommitID, opts.NewCommitIDs[i]) if err == nil && comment != nil { - notification.NotifyPullRequestPushCommits(pusher, pr, comment) + notification.NotifyPullRequestPushCommits(ctx, pusher, pr, comment) } - notification.NotifyPullRequestSynchronized(pusher, pr) + notification.NotifyPullRequestSynchronized(ctx, pusher, pr) isForcePush := comment != nil && comment.IsForcePush results = append(results, private.HookProcReceiveRefResult{ |