From f17101be0dc8439c7ad51eef40534b10080865ea Mon Sep 17 00:00:00 2001 From: Nurahmadie Date: Thu, 3 Apr 2014 17:39:37 +0000 Subject: [PATCH] Set commit.PullRequest for PullRequestHook --- pkg/handler/gitlab.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/handler/gitlab.go b/pkg/handler/gitlab.go index b2339d591..f22c9d880 100644 --- a/pkg/handler/gitlab.go +++ b/pkg/handler/gitlab.go @@ -181,7 +181,7 @@ func (g *GitlabHandler) Hook(w http.ResponseWriter, r *http.Request) error { _, err = database.GetCommitHash(parsed.After, repo.ID) if err != nil && err != sql.ErrNoRows { - println("commit already exists") + fmt.Println("commit already exists") return RenderText(w, http.StatusText(http.StatusBadGateway), http.StatusBadGateway) } @@ -254,7 +254,7 @@ func (g *GitlabHandler) PullRequestHook(p *gogitlab.HookPayload, repo *Repo, use // Gitlab may trigger multiple hooks upon updating merge requests status // only build when it was just opened and the merge hasn't been checked yet. if !(obj.State == "opened" && obj.MergeStatus == "unchecked") { - println("Ignore GitLab Merge Requests") + fmt.Println("Ignore GitLab Merge Requests") return nil } @@ -271,7 +271,7 @@ func (g *GitlabHandler) PullRequestHook(p *gogitlab.HookPayload, repo *Repo, use _, err = database.GetCommitHash(src.Commit.Id, repo.ID) if err != nil && err != sql.ErrNoRows { - println("commit already exists") + fmt.Println("commit already exists") return err } @@ -281,6 +281,7 @@ func (g *GitlabHandler) PullRequestHook(p *gogitlab.HookPayload, repo *Repo, use commit.Hash = src.Commit.Id commit.Status = "Pending" commit.Created = time.Now().UTC() + commit.PullRequest = strconv.Itoa(obj.IId) commit.Message = src.Commit.Message commit.Timestamp = src.Commit.AuthoredDateRaw