|
|
@@ -12,6 +12,7 @@ import (
|
|
|
"time"
|
|
|
|
|
|
"github.com/Unknwon/com"
|
|
|
+ raven "github.com/getsentry/raven-go"
|
|
|
"github.com/go-xorm/xorm"
|
|
|
"gitlab.com/gitote/git-module"
|
|
|
api "gitlab.com/gitote/go-gitote-client"
|
|
|
@@ -324,11 +325,13 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle
|
|
|
}
|
|
|
|
|
|
if err = MergePullRequestAction(doer, pr.Issue.Repo, pr.Issue); err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(2, "MergePullRequestAction [%d]: %v", pr.ID, err)
|
|
|
}
|
|
|
|
|
|
// Reload pull request information.
|
|
|
if err = pr.LoadAttributes(); err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(2, "LoadAttributes: %v", err)
|
|
|
return nil
|
|
|
}
|
|
|
@@ -339,12 +342,14 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle
|
|
|
Repository: pr.Issue.Repo.APIFormat(nil),
|
|
|
Sender: doer.APIFormat(),
|
|
|
}); err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(2, "PrepareWebhooks: %v", err)
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
l, err := headGitRepo.CommitsBetweenIDs(pr.MergedCommitID, pr.MergeBase)
|
|
|
if err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(2, "CommitsBetweenIDs: %v", err)
|
|
|
return nil
|
|
|
}
|
|
|
@@ -354,6 +359,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle
|
|
|
// to avoid strange diff commits produced.
|
|
|
mergeCommit, err := baseGitRepo.GetBranchCommit(pr.BaseBranch)
|
|
|
if err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(2, "GetBranchCommit: %v", err)
|
|
|
return nil
|
|
|
}
|
|
|
@@ -363,6 +369,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle
|
|
|
|
|
|
commits, err := ListToPushCommits(l).ToApiPayloadCommits(pr.BaseRepo.RepoPath(), pr.BaseRepo.HTMLURL())
|
|
|
if err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(2, "ToApiPayloadCommits: %v", err)
|
|
|
return nil
|
|
|
}
|
|
|
@@ -378,6 +385,7 @@ func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository, mergeStyle
|
|
|
Sender: doer.APIFormat(),
|
|
|
}
|
|
|
if err = PrepareWebhooks(pr.BaseRepo, HOOK_EVENT_PUSH, p); err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(2, "PrepareWebhooks: %v", err)
|
|
|
return nil
|
|
|
}
|
|
|
@@ -483,9 +491,11 @@ func NewPullRequest(repo *Repository, pull *Issue, labelIDs []int64, uuids []str
|
|
|
RepoName: repo.Name,
|
|
|
IsPrivate: repo.IsPrivate,
|
|
|
}); err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(2, "NotifyWatchers: %v", err)
|
|
|
}
|
|
|
if err = pull.MailParticipants(); err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(2, "MailParticipants: %v", err)
|
|
|
}
|
|
|
|
|
|
@@ -498,6 +508,7 @@ func NewPullRequest(repo *Repository, pull *Issue, labelIDs []int64, uuids []str
|
|
|
Repository: repo.APIFormat(nil),
|
|
|
Sender: pull.Poster.APIFormat(),
|
|
|
}); err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(2, "PrepareWebhooks: %v", err)
|
|
|
}
|
|
|
|
|
|
@@ -660,6 +671,7 @@ func (pr *PullRequest) AddToTaskQueue() {
|
|
|
go PullRequestQueue.AddFunc(pr.ID, func() {
|
|
|
pr.Status = PULL_REQUEST_STATUS_CHECKING
|
|
|
if err := pr.UpdateCols("status"); err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(3, "AddToTaskQueue.UpdateCols[%d].(add to queue): %v", pr.ID, err)
|
|
|
}
|
|
|
})
|
|
|
@@ -710,9 +722,11 @@ func addHeadRepoTasks(prs []*PullRequest) {
|
|
|
for _, pr := range prs {
|
|
|
log.Trace("addHeadRepoTasks[%d]: composing new test task", pr.ID)
|
|
|
if err := pr.UpdatePatch(); err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(4, "UpdatePatch: %v", err)
|
|
|
continue
|
|
|
} else if err := pr.PushToBaseRepo(); err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(4, "PushToBaseRepo: %v", err)
|
|
|
continue
|
|
|
}
|
|
|
@@ -727,12 +741,14 @@ func AddTestPullRequestTask(doer *User, repoID int64, branch string, isSync bool
|
|
|
log.Trace("AddTestPullRequestTask [head_repo_id: %d, head_branch: %s]: finding pull requests", repoID, branch)
|
|
|
prs, err := GetUnmergedPullRequestsByHeadInfo(repoID, branch)
|
|
|
if err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(2, "Find pull requests [head_repo_id: %d, head_branch: %s]: %v", repoID, branch, err)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
if isSync {
|
|
|
if err = PullRequestList(prs).LoadAttributes(); err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(2, "PullRequestList.LoadAttributes: %v", err)
|
|
|
}
|
|
|
|
|
|
@@ -740,6 +756,7 @@ func AddTestPullRequestTask(doer *User, repoID int64, branch string, isSync bool
|
|
|
for _, pr := range prs {
|
|
|
pr.Issue.PullRequest = pr
|
|
|
if err = pr.Issue.LoadAttributes(); err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(2, "LoadAttributes: %v", err)
|
|
|
continue
|
|
|
}
|
|
|
@@ -750,6 +767,7 @@ func AddTestPullRequestTask(doer *User, repoID int64, branch string, isSync bool
|
|
|
Repository: pr.Issue.Repo.APIFormat(nil),
|
|
|
Sender: doer.APIFormat(),
|
|
|
}); err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(2, "PrepareWebhooks [pull_id: %v]: %v", pr.ID, err)
|
|
|
continue
|
|
|
}
|
|
|
@@ -762,6 +780,7 @@ func AddTestPullRequestTask(doer *User, repoID int64, branch string, isSync bool
|
|
|
log.Trace("AddTestPullRequestTask [base_repo_id: %d, base_branch: %s]: finding pull requests", repoID, branch)
|
|
|
prs, err = GetUnmergedPullRequestsByBaseInfo(repoID, branch)
|
|
|
if err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(2, "Find pull requests [base_repo_id: %d, base_branch: %s]: %v", repoID, branch, err)
|
|
|
return
|
|
|
}
|
|
|
@@ -789,6 +808,7 @@ func (pr *PullRequest) checkAndUpdateStatus() {
|
|
|
// Make sure there is no waiting test to process before levaing the checking status.
|
|
|
if !PullRequestQueue.Exist(pr.ID) {
|
|
|
if err := pr.UpdateCols("status"); err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(4, "Update[%d]: %v", pr.ID, err)
|
|
|
}
|
|
|
}
|
|
|
@@ -805,11 +825,13 @@ func TestPullRequests() {
|
|
|
pr := bean.(*PullRequest)
|
|
|
|
|
|
if err := pr.LoadAttributes(); err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(3, "LoadAttributes: %v", err)
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
if err := pr.testPatch(); err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(3, "testPatch: %v", err)
|
|
|
return nil
|
|
|
}
|
|
|
@@ -829,9 +851,11 @@ func TestPullRequests() {
|
|
|
|
|
|
pr, err := GetPullRequestByID(com.StrTo(prID).MustInt64())
|
|
|
if err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(4, "GetPullRequestByID[%s]: %v", prID, err)
|
|
|
continue
|
|
|
} else if err = pr.testPatch(); err != nil {
|
|
|
+ raven.CaptureErrorAndWait(err, nil)
|
|
|
log.Error(4, "testPatch[%d]: %v", pr.ID, err)
|
|
|
continue
|
|
|
}
|