
pullrequest: remove pullrequest initialize
@8598f1d9b5697dec736b788a048ea7c5d5f67921
--- app/Global.java
+++ app/Global.java
... | ... | @@ -80,8 +80,6 @@ |
80 | 80 |
} |
81 | 81 |
|
82 | 82 |
PullRequest.regulateNumbers(); |
83 |
- PullRequest.initPullRequestCommit(); |
|
84 |
- PullRequest.initPullRequestMergeResult(); |
|
85 | 83 |
|
86 | 84 |
NotificationMail.startSchedule(); |
87 | 85 |
} |
--- app/models/PullRequest.java
+++ app/models/PullRequest.java
... | ... | @@ -673,67 +673,6 @@ |
673 | 673 |
|
674 | 674 |
return pullRequestMergeResult; |
675 | 675 |
} |
676 |
- |
|
677 |
- /** |
|
678 |
- * pull request의 커밋정보를 초기화한다. |
|
679 |
- * |
|
680 |
- * pull request의 커밋정보를 DB에 저장하는 것으로 구조가 변경되어 기존 pull request의 커밋을 모두 저장한다. |
|
681 |
- */ |
|
682 |
- public static void initPullRequestCommit() { |
|
683 |
- |
|
684 |
- String sql = "SELECT pull.id FROM pull_request pull LEFT JOIN pull_request_commit commit ON pull.id = commit.pull_request_id WHERE commit.id IS NULL"; |
|
685 |
- SqlQuery sqlQuery = Ebean.createSqlQuery(sql); |
|
686 |
- List<SqlRow> sqlRows = sqlQuery.findList(); |
|
687 |
- |
|
688 |
- for (SqlRow sqlRow : sqlRows) { |
|
689 |
- PullRequest pullRequest = PullRequest.finder.byId(sqlRow.getLong("id")); |
|
690 |
- if (pullRequest.pullRequestCommits.isEmpty()) { |
|
691 |
- List<GitCommit> commitList = new ArrayList<GitCommit>(); |
|
692 |
- if(pullRequest.isClosed()) { |
|
693 |
- commitList = GitRepository.diffCommits(pullRequest); |
|
694 |
- } else { |
|
695 |
- commitList = GitRepository.getPullingCommits(pullRequest); |
|
696 |
- } |
|
697 |
- |
|
698 |
- for(GitCommit commit : commitList) { |
|
699 |
- PullRequestCommit pullRequestCommit = PullRequestCommit.bindPullRequestCommit(commit, pullRequest); |
|
700 |
- pullRequestCommit.save(); |
|
701 |
- } |
|
702 |
- } |
|
703 |
- } |
|
704 |
- } |
|
705 |
- |
|
706 |
- /** |
|
707 |
- * 열려 있는 pull request에 대한 merge 결과를 초기화한다. |
|
708 |
- * |
|
709 |
- * 유지보수와 관련된 코드로 서버 구동시 한번만 수행되며 DB에 merge 결과가 저장되지 않은 pull request에 대해서만 처리된다. |
|
710 |
- * |
|
711 |
- */ |
|
712 |
- public static void initPullRequestMergeResult() { |
|
713 |
- List<PullRequest> pullRequests = PullRequest.finder.where().isNull("isConflict").findList(); |
|
714 |
- |
|
715 |
- for (PullRequest pullRequest : pullRequests) { |
|
716 |
- |
|
717 |
- if (!pullRequest.isClosed()) { |
|
718 |
- PullRequestMergeResult mergeResult = pullRequest.attemptMerge(); |
|
719 |
- |
|
720 |
- if (mergeResult.getGitConflicts() != null) { |
|
721 |
- pullRequest.isConflict = true; |
|
722 |
- pullRequest.conflictFiles = mergeResult.getConflictFilesToString(); |
|
723 |
- } else { |
|
724 |
- pullRequest.isConflict = false; |
|
725 |
- } |
|
726 |
- |
|
727 |
- mergeResult.save(); |
|
728 |
- |
|
729 |
- } else { |
|
730 |
- pullRequest.isConflict = false; |
|
731 |
- pullRequest.setPatch(GitRepository.getPatch(pullRequest)); |
|
732 |
- pullRequest.update(); |
|
733 |
- } |
|
734 |
- |
|
735 |
- } |
|
736 |
- } |
|
737 | 676 |
|
738 | 677 |
/** |
739 | 678 |
* project/branch와 연관된 보낸코드들의 상태를 병합중으로 수정한다. |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?