summaryrefslogtreecommitdiff
path: root/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/UpdateOutputLineConverter.java
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/UpdateOutputLineConverter.java')
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/UpdateOutputLineConverter.java59
1 files changed, 24 insertions, 35 deletions
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/UpdateOutputLineConverter.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/UpdateOutputLineConverter.java
index a5a1ab80b75b..602a6e8c460e 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/UpdateOutputLineConverter.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/UpdateOutputLineConverter.java
@@ -18,12 +18,11 @@ package org.jetbrains.idea.svn.commandLine;
import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.SvnUtil;
+import org.jetbrains.idea.svn.api.EventAction;
+import org.jetbrains.idea.svn.api.ProgressEvent;
+import org.jetbrains.idea.svn.status.StatusType;
import org.tmatesoft.svn.core.SVNErrorCode;
import org.tmatesoft.svn.core.SVNErrorMessage;
-import org.tmatesoft.svn.core.SVNNodeKind;
-import org.tmatesoft.svn.core.wc.SVNEvent;
-import org.tmatesoft.svn.core.wc.SVNEventAction;
-import org.tmatesoft.svn.core.wc.SVNStatusType;
import java.io.File;
import java.util.Arrays;
@@ -80,7 +79,7 @@ public class UpdateOutputLineConverter {
myCurrentFile = base;
}
- public SVNEvent convert(final String line) {
+ public ProgressEvent convert(final String line) {
// TODO: Add direct processing of "Summary of conflicts" lines at the end of "svn update" output (if there are conflicts).
// TODO: Now it works ok because parseNormalLine could not determine necessary statuses from that and further lines
if (StringUtil.isEmptyOrSpaces(line)) return null;
@@ -89,23 +88,19 @@ public class UpdateOutputLineConverter {
return null;
} else if (line.startsWith(UPDATING)) {
myCurrentFile = parseForPath(line);
- return new SVNEvent(myCurrentFile, myCurrentFile == null ? null : (myCurrentFile.isDirectory() ? SVNNodeKind.DIR : SVNNodeKind.FILE),
- null, -1, null, null, null, null, SVNEventAction.UPDATE_NONE, SVNEventAction.UPDATE_NONE, null, null, null, null, null);
+ return new ProgressEvent(myCurrentFile, -1, null, null, EventAction.UPDATE_NONE, null, null);
} else if (line.startsWith(RESTORED)) {
myCurrentFile = parseForPath(line);
- return new SVNEvent(myCurrentFile, myCurrentFile == null ? null : (myCurrentFile.isDirectory() ? SVNNodeKind.DIR : SVNNodeKind.FILE),
- null, -1, null, null, null, null, SVNEventAction.RESTORE, SVNEventAction.RESTORE, null, null, null, null, null);
+ return new ProgressEvent(myCurrentFile, -1, null, null, EventAction.RESTORE, null, null);
} else if (line.startsWith(SKIPPED)) {
// called, for instance, when folder is not working copy
myCurrentFile = parseForPath(line);
final String comment = parseComment(line);
- return new SVNEvent(myCurrentFile, myCurrentFile == null ? null : (myCurrentFile.isDirectory() ? SVNNodeKind.DIR : SVNNodeKind.FILE),
- null, -1, null, null, null, null, SVNEventAction.SKIP, SVNEventAction.SKIP,
- comment == null ? null : SVNErrorMessage.create(SVNErrorCode.WC_OBSTRUCTED_UPDATE, comment), null, null, null, null);
+ return new ProgressEvent(myCurrentFile, -1, null, null, EventAction.SKIP,
+ comment == null ? null : SVNErrorMessage.create(SVNErrorCode.WC_OBSTRUCTED_UPDATE, comment), null);
} else if (line.startsWith(FETCHING_EXTERNAL)) {
myCurrentFile = parseForPath(line);
- return new SVNEvent(myCurrentFile, myCurrentFile == null ? null : (myCurrentFile.isDirectory() ? SVNNodeKind.DIR : SVNNodeKind.FILE),
- null, -1, null, null, null, null, SVNEventAction.UPDATE_EXTERNAL, SVNEventAction.UPDATE_EXTERNAL, null, null, null, null, null);
+ return new ProgressEvent(myCurrentFile, -1, null, null, EventAction.UPDATE_EXTERNAL, null, null);
}
for (int i = 0; i < ourCompletePatterns.length; i++) {
@@ -114,10 +109,7 @@ public class UpdateOutputLineConverter {
if (revision != -1) {
// TODO: seems that myCurrentFile will not always be correct - complete update message could be right after complete externals update
// TODO: check this and use Stack instead
- return new SVNEvent(myCurrentFile,
- myCurrentFile == null ? null : (myCurrentFile.isDirectory() ? SVNNodeKind.DIR : SVNNodeKind.FILE),
- null, revision, null, null, null, null, SVNEventAction.UPDATE_COMPLETED, SVNEventAction.UPDATE_COMPLETED, null,
- null, null, null, null);
+ return new ProgressEvent(myCurrentFile, revision, null, null, EventAction.UPDATE_COMPLETED, null, null);
}
}
@@ -127,13 +119,13 @@ public class UpdateOutputLineConverter {
private final static Set<Character> ourActions = new HashSet<Character>(Arrays.asList(new Character[] {'A', 'D', 'U', 'C', 'G', 'E', 'R'}));
@Nullable
- private SVNEvent parseNormalString(final String line) {
+ private ProgressEvent parseNormalString(final String line) {
if (line.length() < 5) return null;
final char first = line.charAt(0);
if (' ' != first && ! ourActions.contains(first)) return null;
- final SVNStatusType contentsStatus = CommandUtil.getStatusType(first);
+ final StatusType contentsStatus = CommandUtil.getStatusType(first);
final char second = line.charAt(1);
- final SVNStatusType propertiesStatus = CommandUtil.getStatusType(second);
+ final StatusType propertiesStatus = CommandUtil.getStatusType(second);
final char lock = line.charAt(2); // dont know what to do with stolen lock info
if (' ' != lock && 'B' != lock) return null;
final char treeConflict = line.charAt(3);
@@ -143,29 +135,26 @@ public class UpdateOutputLineConverter {
final String path = line.substring(4).trim();
if (StringUtil.isEmptyOrSpaces(path)) return null;
final File file = createFile(path);
- if (SVNStatusType.STATUS_OBSTRUCTED.equals(contentsStatus)) {
+ if (StatusType.STATUS_OBSTRUCTED.equals(contentsStatus)) {
// obstructed
- return new SVNEvent(file, file.isDirectory() ? SVNNodeKind.DIR : SVNNodeKind.FILE,
- null, -1, contentsStatus, propertiesStatus, null, null, SVNEventAction.UPDATE_SKIP_OBSTRUCTION, SVNEventAction.UPDATE_ADD,
- null, null, null, null, null);
+ return new ProgressEvent(file, -1, contentsStatus, propertiesStatus, EventAction.UPDATE_SKIP_OBSTRUCTION, null, null);
}
- SVNEventAction action;
- SVNEventAction expectedAction;
- if (SVNStatusType.STATUS_ADDED.equals(contentsStatus)) {
- expectedAction = SVNEventAction.UPDATE_ADD;
- } else if (SVNStatusType.STATUS_DELETED.equals(contentsStatus)) {
- expectedAction = SVNEventAction.UPDATE_DELETE;
+ EventAction action;
+ EventAction expectedAction;
+ if (StatusType.STATUS_ADDED.equals(contentsStatus)) {
+ expectedAction = EventAction.UPDATE_ADD;
+ } else if (StatusType.STATUS_DELETED.equals(contentsStatus)) {
+ expectedAction = EventAction.UPDATE_DELETE;
} else {
- expectedAction = SVNEventAction.UPDATE_UPDATE;
+ expectedAction = EventAction.UPDATE_UPDATE;
}
action = expectedAction;
if (haveTreeConflict) {
- action = SVNEventAction.TREE_CONFLICT;
+ action = EventAction.TREE_CONFLICT;
}
- return new SVNEvent(file, file.isDirectory() ? SVNNodeKind.DIR : SVNNodeKind.FILE, null, -1, contentsStatus, propertiesStatus, null,
- null, action, expectedAction, null, null, null, null, null);
+ return new ProgressEvent(file, -1, contentsStatus, propertiesStatus, action, null, null);
}
private File createFile(String path) {