MCPcopy Create free account
hub / github.com/gogs/gogs / ViewPullCommits

Function ViewPullCommits

internal/route/repo/pull.go:249–301  ·  view source on GitHub ↗
(c *context.Context)

Source from the content-addressed store, hash-verified

247}
248
249func ViewPullCommits(c *context.Context) {
250 c.Data["PageIsPullList"] = true
251 c.Data["PageIsPullCommits"] = true
252
253 issue := checkPullInfo(c)
254 if c.Written() {
255 return
256 }
257 pull := issue.PullRequest
258
259 if pull.HeadRepo != nil {
260 c.Data["Username"] = pull.HeadUserName
261 c.Data["Reponame"] = pull.HeadRepo.Name
262 }
263
264 var commits []*git.Commit
265 if pull.HasMerged {
266 PrepareMergedViewPullInfo(c, issue)
267 if c.Written() {
268 return
269 }
270 startCommit, err := c.Repo.GitRepo.CatFileCommit(pull.MergeBase)
271 if err != nil {
272 c.Error(err, "get commit of merge base")
273 return
274 }
275 endCommit, err := c.Repo.GitRepo.CatFileCommit(pull.MergedCommitID)
276 if err != nil {
277 c.Error(err, "get merged commit")
278 return
279 }
280 commits, err = c.Repo.GitRepo.RevList([]string{startCommit.ID.String() + "..." + endCommit.ID.String()})
281 if err != nil {
282 c.Error(err, "list commits")
283 return
284 }
285
286 } else {
287 prInfo := PrepareViewPullInfo(c, issue)
288 if c.Written() {
289 return
290 } else if prInfo == nil {
291 c.NotFound()
292 return
293 }
294 commits = prInfo.Commits
295 }
296
297 c.Data["Commits"] = matchUsersWithCommitEmails(c.Req.Context(), commits)
298 c.Data["CommitsCount"] = len(commits)
299
300 c.Success(tmplRepoPullsCommits)
301}
302
303func ViewPullFiles(c *context.Context) {
304 c.Data["PageIsPullList"] = true

Callers

nothing calls this directly

Calls 8

checkPullInfoFunction · 0.85
PrepareViewPullInfoFunction · 0.85
SuccessMethod · 0.80
NotFoundMethod · 0.65
ErrorMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected