Search in sources :

Example 1 with EventAction

use of org.jetbrains.idea.svn.api.EventAction in project intellij-community by JetBrains.

the class UpdateOutputLineConverter method parseNormalString.

@Nullable
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 StatusType contentsStatus = CommandUtil.getStatusType(first);
    final char second = line.charAt(1);
    final StatusType propertiesStatus = CommandUtil.getStatusType(second);
    // dont know what to do with stolen lock info
    final char lock = line.charAt(2);
    if (' ' != lock && 'B' != lock)
        return null;
    final char treeConflict = line.charAt(3);
    if (' ' != treeConflict && 'C' != treeConflict)
        return null;
    final boolean haveTreeConflict = 'C' == treeConflict;
    final String path = line.substring(4).trim();
    if (StringUtil.isEmptyOrSpaces(path))
        return null;
    final File file = SvnUtil.resolvePath(myBase, path);
    if (StatusType.STATUS_OBSTRUCTED.equals(contentsStatus)) {
        // obstructed
        return new ProgressEvent(file, -1, contentsStatus, propertiesStatus, EventAction.UPDATE_SKIP_OBSTRUCTION, null, null);
    }
    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 = EventAction.UPDATE_UPDATE;
    }
    action = expectedAction;
    if (haveTreeConflict) {
        action = EventAction.TREE_CONFLICT;
    }
    return new ProgressEvent(file, -1, contentsStatus, propertiesStatus, action, null, null);
}
Also used : StatusType(org.jetbrains.idea.svn.status.StatusType) EventAction(org.jetbrains.idea.svn.api.EventAction) ProgressEvent(org.jetbrains.idea.svn.api.ProgressEvent) File(java.io.File) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

File (java.io.File)1 Nullable (org.jetbrains.annotations.Nullable)1 EventAction (org.jetbrains.idea.svn.api.EventAction)1 ProgressEvent (org.jetbrains.idea.svn.api.ProgressEvent)1 StatusType (org.jetbrains.idea.svn.status.StatusType)1