[git] IDEA-71600 better identify conflict during unstash

This commit is contained in:
Kirill Likhodedov
2015-10-21 19:21:01 +03:00
parent da5e17071e
commit b2f9ce2f84
@@ -16,39 +16,41 @@
package git4idea.commands;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.annotations.NotNull;
/**
* @author Kirill Likhodedov
*/
public class GitSimpleEventDetector implements GitLineHandlerListener {
private final Event myEvent;
@NotNull private final Event myEvent;
private boolean myHappened;
public enum Event {
CHERRY_PICK_CONFLICT("fter resolving the conflicts"), // a is uppercase in 1.7.0.5 and lowercase in 1.7.9.2
CHERRY_PICK_CONFLICT("after resolving the conflicts"),
LOCAL_CHANGES_OVERWRITTEN_BY_CHERRY_PICK("would be overwritten by merge"),
UNMERGED_PREVENTING_CHECKOUT("you need to resolve your current index first"),
UNMERGED_PREVENTING_MERGE("is not possible because you have unmerged files"),
BRANCH_NOT_FULLY_MERGED("is not fully merged"),
MERGE_CONFLICT("Automatic merge failed; fix conflicts and then commit the result"),
MERGE_CONFLICT_ON_UNSTASH("Merge conflict"),
MERGE_CONFLICT_ON_UNSTASH("conflict"),
ALREADY_UP_TO_DATE("Already up-to-date");
private final String myDetectionString;
private Event(String detectionString) {
Event(@NotNull String detectionString) {
myDetectionString = detectionString;
}
}
public GitSimpleEventDetector(Event event) {
public GitSimpleEventDetector(@NotNull Event event) {
myEvent = event;
}
@Override
public void onLineAvailable(String line, Key outputType) {
if (line.contains(myEvent.myDetectionString)) {
public void onLineAvailable(@NotNull String line, Key outputType) {
if (StringUtil.containsIgnoreCase(line, myEvent.myDetectionString)) {
myHappened = true;
}
}