Search in sources :

Example 1 with StatusType

use of org.jetbrains.idea.svn.status.StatusType in project intellij-community by JetBrains.

the class SvnChangeProviderContext method processStatus.

void processStatus(@NotNull FilePath filePath, @NotNull Status status) throws SVNException {
    WorkingCopyFormat format = myVcs.getWorkingCopyFormat(filePath.getIOFile());
    if (!WorkingCopyFormat.UNKNOWN.equals(format) && format.less(WorkingCopyFormat.ONE_DOT_SEVEN)) {
        loadEntriesFile(filePath);
    }
    FileStatus fStatus = SvnStatusConvertor.convertStatus(status);
    final StatusType statusType = status.getContentsStatus();
    if (status.is(StatusType.STATUS_UNVERSIONED, StatusType.UNKNOWN)) {
        final VirtualFile file = filePath.getVirtualFile();
        if (file != null) {
            myChangelistBuilder.processUnversionedFile(file);
        }
    } else if (status.is(StatusType.STATUS_ADDED)) {
        processChangeInList(null, CurrentContentRevision.create(filePath), fStatus, status);
    } else if (status.is(StatusType.STATUS_CONFLICTED, StatusType.STATUS_MODIFIED, StatusType.STATUS_REPLACED) || status.isProperty(StatusType.STATUS_MODIFIED, StatusType.STATUS_CONFLICTED)) {
        processChangeInList(SvnContentRevision.createBaseRevision(myVcs, filePath, status), CurrentContentRevision.create(filePath), fStatus, status);
        checkSwitched(filePath, status, fStatus);
    } else if (status.is(StatusType.STATUS_DELETED)) {
        processChangeInList(SvnContentRevision.createBaseRevision(myVcs, filePath, status), null, fStatus, status);
    } else if (status.is(StatusType.STATUS_MISSING)) {
        myChangelistBuilder.processLocallyDeletedFile(new SvnLocallyDeletedChange(filePath, getState(status)));
    } else if (status.is(StatusType.STATUS_IGNORED)) {
        VirtualFile file = filePath.getVirtualFile();
        if (file == null) {
            file = LocalFileSystem.getInstance().refreshAndFindFileByPath(filePath.getPath());
        }
        if (file == null) {
            LOG.error("No virtual file for ignored file: " + filePath.getPresentableUrl() + ", isNonLocal: " + filePath.isNonLocal());
        } else if (!myVcs.isWcRoot(filePath)) {
            myChangelistBuilder.processIgnoredFile(filePath.getVirtualFile());
        }
    } else if ((fStatus == FileStatus.NOT_CHANGED || fStatus == FileStatus.SWITCHED) && statusType != StatusType.STATUS_NONE) {
        VirtualFile file = filePath.getVirtualFile();
        if (file != null && FileDocumentManager.getInstance().isFileModified(file)) {
            processChangeInList(SvnContentRevision.createBaseRevision(myVcs, filePath, status), CurrentContentRevision.create(filePath), FileStatus.MODIFIED, status);
        } else if (status.getTreeConflict() != null) {
            myChangelistBuilder.processChange(createChange(SvnContentRevision.createBaseRevision(myVcs, filePath, status), CurrentContentRevision.create(filePath), FileStatus.MODIFIED, status), SvnVcs.getKey());
        }
        checkSwitched(filePath, status, fStatus);
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) FileStatus(com.intellij.openapi.vcs.FileStatus) StatusType(org.jetbrains.idea.svn.status.StatusType)

Example 2 with StatusType

use of org.jetbrains.idea.svn.status.StatusType 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

StatusType (org.jetbrains.idea.svn.status.StatusType)2 FileStatus (com.intellij.openapi.vcs.FileStatus)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 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