Skip to content
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.

Commit

Permalink
PullRequest: prevent generate unnecessary merge event
Browse files Browse the repository at this point in the history
  • Loading branch information
Keesun Baik committed Aug 18, 2014
1 parent d9449d0 commit d0dad20
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/actors/PullRequestActor.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public abstract class PullRequestActor extends UntypedActor {
protected void processPullRequestMerging(PullRequestEventMessage message, PullRequest pullRequest) {
try {
String oldMergeCommitId = pullRequest.mergedCommitIdTo;
boolean wasConflict = pullRequest.isConflict != null ? pullRequest.isConflict : false;

PullRequestMergeResult mergeResult = pullRequest.attemptMerge();

if (mergeResult.hasDiffCommits()) {
Expand All @@ -47,14 +49,14 @@ protected void processPullRequestMerging(PullRequestEventMessage message, PullRe
PullRequestEvent.addFromNotificationEvent(notiEvent, pullRequest);
}

if (mergeResult.conflicts()) {
if (!wasConflict && mergeResult.conflicts()) {
mergeResult.setConflictStateOfPullRequest();
NotificationEvent notiEvent = NotificationEvent.afterMerge(message.getSender(),
pullRequest, mergeResult.getGitConflicts(), State.CONFLICT);
PullRequestEvent.addMergeEvent(notiEvent.getSender(), EventType.PULL_REQUEST_MERGED, State.CONFLICT, pullRequest);
}

if (mergeResult.resolved()) {
if (wasConflict && mergeResult.resolved()) {
mergeResult.setResolvedStateOfPullRequest();
NotificationEvent notiEvent = NotificationEvent.afterMerge(message.getSender(),
pullRequest, mergeResult.getGitConflicts(), State.RESOLVED);
Expand Down

0 comments on commit d0dad20

Please sign in to comment.