Search in sources :

Example 26 with FileStatus

use of com.intellij.openapi.vcs.FileStatus in project intellij-community by JetBrains.

the class CmdDiffClient method createChange.

@NotNull
private Change createChange(@NotNull SvnTarget target1, @NotNull SvnTarget target2, @NotNull DiffPath diffPath) throws SvnBindException {
    // TODO: 1) Unify logic of creating Change instance with SvnDiffEditor and SvnChangeProviderContext
    // TODO: 2) If some directory is switched, files inside it are returned as modified in "svn diff --summarize", even if they are equal
    // TODO: to branch files by content - possibly add separate processing of all switched files
    // TODO: 3) Properties change is currently not added as part of result change like in SvnChangeProviderContext.patchWithPropertyChange
    SvnTarget subTarget1 = SvnUtil.append(target1, diffPath.path, true);
    String relativePath = SvnUtil.getRelativeUrl(SvnUtil.toDecodedString(target1), SvnUtil.toDecodedString(subTarget1));
    if (relativePath == null) {
        throw new SvnBindException("Could not get relative path for " + target1 + " and " + subTarget1);
    }
    SvnTarget subTarget2 = SvnUtil.append(target2, FileUtil.toSystemIndependentName(relativePath));
    FilePath target1Path = createFilePath(subTarget1, diffPath.isDirectory());
    FilePath target2Path = createFilePath(subTarget2, diffPath.isDirectory());
    FileStatus status = SvnStatusConvertor.convertStatus(SvnStatusHandler.getStatus(diffPath.itemStatus), SvnStatusHandler.getStatus(diffPath.propertiesStatus));
    // statuses determine changes needs to be done to "target1" to get "target2" state
    ContentRevision beforeRevision = status == FileStatus.ADDED ? null : createRevision(target1Path, target2Path, target1.getPegRevision(), status);
    ContentRevision afterRevision = status == FileStatus.DELETED ? null : createRevision(target2Path, target1Path, target2.getPegRevision(), status);
    return createChange(status, beforeRevision, afterRevision);
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) FileStatus(com.intellij.openapi.vcs.FileStatus) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) CurrentContentRevision(com.intellij.openapi.vcs.changes.CurrentContentRevision) SvnRepositoryContentRevision(org.jetbrains.idea.svn.history.SvnRepositoryContentRevision) ContentRevision(com.intellij.openapi.vcs.changes.ContentRevision) NotNull(org.jetbrains.annotations.NotNull)

Example 27 with FileStatus

use of com.intellij.openapi.vcs.FileStatus in project intellij-community by JetBrains.

the class SvnDiffEditor method addDir.

public void addDir(String path, String copyFromPath, long copyFromRevision) throws SVNException {
    FileStatus status = FileStatus.ADDED;
    if (myChanges.containsKey(path) && myChanges.get(path).getFileStatus() == FileStatus.DELETED) {
        // replaced file
        myChanges.remove(path);
        status = FileStatus.MODIFIED;
    }
    Change change = createChange(path, status);
    myChanges.put(path, change);
}
Also used : FileStatus(com.intellij.openapi.vcs.FileStatus) Change(com.intellij.openapi.vcs.changes.Change)

Example 28 with FileStatus

use of com.intellij.openapi.vcs.FileStatus in project intellij-community by JetBrains.

the class SvnDiffEditor method addFile.

public void addFile(String path, String copyFromPath, long copyFromRevision) throws SVNException {
    FileStatus status = FileStatus.ADDED;
    if (myChanges.containsKey(path) && myChanges.get(path).getFileStatus() == FileStatus.DELETED) {
        // replaced file
        myChanges.remove(path);
        status = FileStatus.MODIFIED;
    }
    Change change = createChange(path, status);
    myChanges.put(path, change);
}
Also used : FileStatus(com.intellij.openapi.vcs.FileStatus) Change(com.intellij.openapi.vcs.changes.Change)

Example 29 with FileStatus

use of com.intellij.openapi.vcs.FileStatus in project intellij-community by JetBrains.

the class FormNode method getFileStatus.

@Override
public FileStatus getFileStatus() {
    for (BasePsiNode<? extends PsiElement> child : myChildren) {
        final PsiElement value = child.getValue();
        if (value == null || !value.isValid())
            continue;
        final FileStatus fileStatus = NavigationItemFileStatus.get(child);
        if (fileStatus != FileStatus.NOT_CHANGED) {
            return fileStatus;
        }
    }
    return FileStatus.NOT_CHANGED;
}
Also used : FileStatus(com.intellij.openapi.vcs.FileStatus) NavigationItemFileStatus(com.intellij.navigation.NavigationItemFileStatus) PsiElement(com.intellij.psi.PsiElement)

Aggregations

FileStatus (com.intellij.openapi.vcs.FileStatus)29 VirtualFile (com.intellij.openapi.vfs.VirtualFile)9 Change (com.intellij.openapi.vcs.changes.Change)7 NotNull (org.jetbrains.annotations.NotNull)6 FilePath (com.intellij.openapi.vcs.FilePath)5 ContentRevision (com.intellij.openapi.vcs.changes.ContentRevision)5 SimpleTextAttributes (com.intellij.ui.SimpleTextAttributes)4 FileStatusManager (com.intellij.openapi.vcs.FileStatusManager)3 ArrayList (java.util.ArrayList)3 PsiElement (com.intellij.psi.PsiElement)2 GitContentRevision (git4idea.GitContentRevision)2 RefElement (com.intellij.codeInspection.reference.RefElement)1 RefEntity (com.intellij.codeInspection.reference.RefEntity)1 NavigationItemFileStatus (com.intellij.navigation.NavigationItemFileStatus)1 Application (com.intellij.openapi.application.Application)1 FilePatch (com.intellij.openapi.diff.impl.patch.FilePatch)1 TextAttributes (com.intellij.openapi.editor.markup.TextAttributes)1 DumbAwareRunnable (com.intellij.openapi.project.DumbAwareRunnable)1 Project (com.intellij.openapi.project.Project)1 InvalidDataException (com.intellij.openapi.util.InvalidDataException)1