aboutsummaryrefslogtreecommitdiff
path: root/http_handle_repo_contrib_one.go
diff options
context:
space:
mode:
Diffstat (limited to 'http_handle_repo_contrib_one.go')
-rw-r--r--http_handle_repo_contrib_one.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/http_handle_repo_contrib_one.go b/http_handle_repo_contrib_one.go
index dac58d0..280dca8 100644
--- a/http_handle_repo_contrib_one.go
+++ b/http_handle_repo_contrib_one.go
@@ -29,7 +29,7 @@ func (s *Server) httpHandleRepoContribOne(writer http.ResponseWriter, request *h
mrIDStr = params["mr_id"].(string)
mrIDInt64, err := strconv.ParseInt(mrIDStr, 10, strconv.IntSize)
if err != nil {
- web.ErrorPage400(templates, writer, params, "Merge request ID not an integer")
+ web.ErrorPage400(s.templates, writer, params, "Merge request ID not an integer")
return
}
mrIDInt = int(mrIDInt64)
@@ -38,18 +38,18 @@ func (s *Server) httpHandleRepoContribOne(writer http.ResponseWriter, request *h
"SELECT COALESCE(title, ''), status, source_ref, COALESCE(destination_branch, '') FROM merge_requests WHERE repo_id = $1 AND repo_local_id = $2",
params["repo_id"], mrIDInt,
).Scan(&title, &status, &srcRefStr, &dstBranchStr); err != nil {
- web.ErrorPage500(templates, writer, params, "Error querying merge request: "+err.Error())
+ web.ErrorPage500(s.templates, writer, params, "Error querying merge request: "+err.Error())
return
}
repo = params["repo"].(*git.Repository)
if srcRefHash, err = getRefHash(repo, "branch", srcRefStr); err != nil {
- web.ErrorPage500(templates, writer, params, "Error getting source ref hash: "+err.Error())
+ web.ErrorPage500(s.templates, writer, params, "Error getting source ref hash: "+err.Error())
return
}
if srcCommit, err = repo.CommitObject(srcRefHash); err != nil {
- web.ErrorPage500(templates, writer, params, "Error getting source commit: "+err.Error())
+ web.ErrorPage500(s.templates, writer, params, "Error getting source commit: "+err.Error())
return
}
params["source_commit"] = srcCommit
@@ -61,23 +61,23 @@ func (s *Server) httpHandleRepoContribOne(writer http.ResponseWriter, request *h
dstBranchHash, err = getRefHash(repo, "branch", dstBranchStr)
}
if err != nil {
- web.ErrorPage500(templates, writer, params, "Error getting destination branch hash: "+err.Error())
+ web.ErrorPage500(s.templates, writer, params, "Error getting destination branch hash: "+err.Error())
return
}
if dstCommit, err = repo.CommitObject(dstBranchHash); err != nil {
- web.ErrorPage500(templates, writer, params, "Error getting destination commit: "+err.Error())
+ web.ErrorPage500(s.templates, writer, params, "Error getting destination commit: "+err.Error())
return
}
params["destination_commit"] = dstCommit
if mergeBases, err = srcCommit.MergeBase(dstCommit); err != nil {
- web.ErrorPage500(templates, writer, params, "Error getting merge base: "+err.Error())
+ web.ErrorPage500(s.templates, writer, params, "Error getting merge base: "+err.Error())
return
}
if len(mergeBases) < 1 {
- web.ErrorPage500(templates, writer, params, "No merge base found for this merge request; these two branches do not share any common history")
+ web.ErrorPage500(s.templates, writer, params, "No merge base found for this merge request; these two branches do not share any common history")
// TODO
return
}
@@ -87,12 +87,12 @@ func (s *Server) httpHandleRepoContribOne(writer http.ResponseWriter, request *h
patch, err := mergeBaseCommit.Patch(srcCommit)
if err != nil {
- web.ErrorPage500(templates, writer, params, "Error getting patch: "+err.Error())
+ web.ErrorPage500(s.templates, writer, params, "Error getting patch: "+err.Error())
return
}
params["file_patches"] = makeUsableFilePatches(patch)
params["mr_title"], params["mr_status"], params["mr_source_ref"], params["mr_destination_branch"] = title, status, srcRefStr, dstBranchStr
- renderTemplate(writer, "repo_contrib_one", params)
+ s.renderTemplate(writer, "repo_contrib_one", params)
}