|
|
@ -598,7 +598,7 @@ func (pr *PullRequest) testPatch(e Engine) (err error) { |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
for i := range patchConflicts { |
|
|
|
for i := range patchConflicts { |
|
|
|
if strings.Contains(stderr, patchConflicts[i]) { |
|
|
|
if strings.Contains(stderr, patchConflicts[i]) { |
|
|
|
log.Trace("PullRequest[%d].testPatch (apply): has conflict", pr.ID) |
|
|
|
log.Trace("PullRequest[%d].testPatch (apply): has conflict: %s", pr.ID, stderr) |
|
|
|
const prefix = "error: patch failed:" |
|
|
|
const prefix = "error: patch failed:" |
|
|
|
pr.Status = PullRequestStatusConflict |
|
|
|
pr.Status = PullRequestStatusConflict |
|
|
|
pr.ConflictedFiles = make([]string, 0, 5) |
|
|
|
pr.ConflictedFiles = make([]string, 0, 5) |
|
|
@ -661,14 +661,17 @@ func NewPullRequest(repo *Repository, pull *Issue, labelIDs []int64, uuids []str |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pr.Index = pull.Index |
|
|
|
pr.Index = pull.Index |
|
|
|
|
|
|
|
pr.BaseRepo = repo |
|
|
|
|
|
|
|
pr.Status = PullRequestStatusChecking |
|
|
|
|
|
|
|
if len(patch) > 0 { |
|
|
|
if err = repo.savePatch(sess, pr.Index, patch); err != nil { |
|
|
|
if err = repo.savePatch(sess, pr.Index, patch); err != nil { |
|
|
|
return fmt.Errorf("SavePatch: %v", err) |
|
|
|
return fmt.Errorf("SavePatch: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pr.BaseRepo = repo |
|
|
|
|
|
|
|
if err = pr.testPatch(sess); err != nil { |
|
|
|
if err = pr.testPatch(sess); err != nil { |
|
|
|
return fmt.Errorf("testPatch: %v", err) |
|
|
|
return fmt.Errorf("testPatch: %v", err) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
// No conflict appears after test means mergeable.
|
|
|
|
// No conflict appears after test means mergeable.
|
|
|
|
if pr.Status == PullRequestStatusChecking { |
|
|
|
if pr.Status == PullRequestStatusChecking { |
|
|
|
pr.Status = PullRequestStatusMergeable |
|
|
|
pr.Status = PullRequestStatusMergeable |
|
|
|