summaryrefslogtreecommitdiffstats
path: root/cmd/serve.go
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-10-24 03:36:47 -0400
committerUnknwon <u@gogs.io>2015-10-24 03:36:47 -0400
commit0fbb8c8826771e92e890fb1c72b356d3e62c7b01 (patch)
tree2695707e4789a6611fa35393b06631848657469a /cmd/serve.go
parente0aab4a7f6c1f1b5cc7fa40e2c09623b635bc4a6 (diff)
downloadgitea-0fbb8c8826771e92e890fb1c72b356d3e62c7b01.tar.gz
gitea-0fbb8c8826771e92e890fb1c72b356d3e62c7b01.zip
New push to head repo of head branch: regenerate patch and retest apply
Diffstat (limited to 'cmd/serve.go')
-rw-r--r--cmd/serve.go40
1 files changed, 21 insertions, 19 deletions
diff --git a/cmd/serve.go b/cmd/serve.go
index 34ebe9fbd1..5f0362744b 100644
--- a/cmd/serve.go
+++ b/cmd/serve.go
@@ -200,32 +200,34 @@ func runServ(c *cli.Context) {
}
if requestedMode == models.ACCESS_MODE_WRITE {
- tasks, err := models.GetUpdateTasksByUuid(uuid)
+ task, err := models.GetUpdateTaskByUUID(uuid)
if err != nil {
- log.GitLogger.Fatal(2, "GetUpdateTasksByUuid: %v", err)
+ log.GitLogger.Fatal(2, "GetUpdateTaskByUUID: %v", err)
}
- for _, task := range tasks {
- err = models.Update(task.RefName, task.OldCommitId, task.NewCommitId,
- user.Name, repoUserName, repoName, user.Id)
- if err != nil {
- log.GitLogger.Error(2, "Failed to update: %v", err)
- }
+ if err = models.Update(task.RefName, task.OldCommitID, task.NewCommitID,
+ user.Name, repoUserName, repoName, user.Id); err != nil {
+ log.GitLogger.Error(2, "Update: %v", err)
}
- if err = models.DelUpdateTasksByUuid(uuid); err != nil {
- log.GitLogger.Fatal(2, "DelUpdateTasksByUuid: %v", err)
+ if err = models.DeleteUpdateTaskByUUID(uuid); err != nil {
+ log.GitLogger.Fatal(2, "DeleteUpdateTaskByUUID: %v", err)
}
- }
- // Send deliver hook request.
- reqURL := setting.AppUrl + repoUserName + "/" + repoName + "/hooks/trigger"
- resp, err := httplib.Head(reqURL).Response()
- if err == nil {
- resp.Body.Close()
- log.GitLogger.Trace("Trigger hook: %s", reqURL)
- } else {
- log.GitLogger.Error(2, "Fail to trigger hook: %v", err)
+ // Ask for running deliver hook and test pull request tasks.
+ reqURL := setting.AppUrl + repoUserName + "/" + repoName + "/tasks/trigger?branch=" +
+ strings.TrimPrefix(task.RefName, "refs/heads/")
+ log.GitLogger.Trace("Trigger task: %s", reqURL)
+
+ resp, err := httplib.Head(reqURL).Response()
+ if err == nil {
+ resp.Body.Close()
+ if resp.StatusCode/100 != 2 {
+ log.GitLogger.Error(2, "Fail to trigger task: not 2xx response code")
+ }
+ } else {
+ log.GitLogger.Error(2, "Fail to trigger task: %v", err)
+ }
}
// Update user key activity.