Search in sources :

Example 31 with ContentRevision

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

the class SvnCommittedViewTest method printChanges.

private static String printChanges(final Data data, final Collection<Change> changes) {
    final StringBuilder sb = new StringBuilder("Data: ").append(data.myLocalPath).append(" exists: ").append(new File(data.myLocalPath).exists()).append(" Changes: ");
    for (Change change : changes) {
        final ContentRevision cr = change.getAfterRevision() == null ? change.getBeforeRevision() : change.getAfterRevision();
        final File ioFile = cr.getFile().getIOFile();
        sb.append("'").append(ioFile.getAbsolutePath()).append("' exists: ").append(ioFile.exists()).append(" | ");
    }
    return sb.toString();
}
Also used : ContentRevision(com.intellij.openapi.vcs.changes.ContentRevision) Change(com.intellij.openapi.vcs.changes.Change) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)

Example 32 with ContentRevision

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

the class GitChangesCollector method dirtyPaths.

/**
   * Collect dirty file paths
   *
   * @param includeChanges if true, previous changes are included in collection
   * @return the set of dirty paths to check, the paths are automatically collapsed if the summary length more than limit
   */
protected Collection<FilePath> dirtyPaths(boolean includeChanges) {
    final List<String> allPaths = new ArrayList<>();
    for (FilePath p : myDirtyScope.getRecursivelyDirtyDirectories()) {
        addToPaths(p, allPaths);
    }
    for (FilePath p : myDirtyScope.getDirtyFilesNoExpand()) {
        addToPaths(p, allPaths);
    }
    if (includeChanges) {
        for (Change c : myChangeListManager.getChangesIn(myVcsRoot)) {
            switch(c.getType()) {
                case NEW:
                case DELETED:
                case MOVED:
                    ContentRevision afterRevision = c.getAfterRevision();
                    if (afterRevision != null) {
                        addToPaths(afterRevision.getFile(), allPaths);
                    }
                    ContentRevision beforeRevision = c.getBeforeRevision();
                    if (beforeRevision != null) {
                        addToPaths(beforeRevision.getFile(), allPaths);
                    }
                case MODIFICATION:
                default:
            }
        }
    }
    removeCommonParents(allPaths);
    return ContainerUtil.map(allPaths, VcsUtil::getFilePath);
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) ContentRevision(com.intellij.openapi.vcs.changes.ContentRevision) Change(com.intellij.openapi.vcs.changes.Change) VcsUtil(com.intellij.vcsUtil.VcsUtil)

Example 33 with ContentRevision

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

the class GitNewChangesCollector method reportModified.

private void reportModified(String filepath, VcsRevisionNumber head) throws VcsException {
    ContentRevision before = GitContentRevision.createRevision(myVcsRoot, filepath, head, myProject, false, true, false);
    ContentRevision after = GitContentRevision.createRevision(myVcsRoot, filepath, null, myProject, false, false, false);
    reportChange(FileStatus.MODIFIED, before, after);
}
Also used : ContentRevision(com.intellij.openapi.vcs.changes.ContentRevision) GitContentRevision(git4idea.GitContentRevision)

Example 34 with ContentRevision

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

the class GitNewChangesCollector method reportTypeChanged.

private void reportTypeChanged(String filepath, VcsRevisionNumber head) throws VcsException {
    ContentRevision before = GitContentRevision.createRevision(myVcsRoot, filepath, head, myProject, false, true, false);
    ContentRevision after = GitContentRevision.createRevisionForTypeChange(myProject, myVcsRoot, filepath, null, false);
    reportChange(FileStatus.MODIFIED, before, after);
}
Also used : ContentRevision(com.intellij.openapi.vcs.changes.ContentRevision) GitContentRevision(git4idea.GitContentRevision)

Example 35 with ContentRevision

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

the class GitNewChangesCollector method reportDeleted.

private void reportDeleted(String filepath, VcsRevisionNumber head) throws VcsException {
    ContentRevision before = GitContentRevision.createRevision(myVcsRoot, filepath, head, myProject, true, true, false);
    ContentRevision after = null;
    reportChange(FileStatus.DELETED, before, after);
}
Also used : ContentRevision(com.intellij.openapi.vcs.changes.ContentRevision) GitContentRevision(git4idea.GitContentRevision)

Aggregations

ContentRevision (com.intellij.openapi.vcs.changes.ContentRevision)53 Change (com.intellij.openapi.vcs.changes.Change)32 VirtualFile (com.intellij.openapi.vfs.VirtualFile)18 FilePath (com.intellij.openapi.vcs.FilePath)15 NotNull (org.jetbrains.annotations.NotNull)12 VcsException (com.intellij.openapi.vcs.VcsException)9 GitContentRevision (git4idea.GitContentRevision)9 File (java.io.File)9 FileStatus (com.intellij.openapi.vcs.FileStatus)5 Nullable (org.jetbrains.annotations.Nullable)5 ChangeListManager (com.intellij.openapi.vcs.changes.ChangeListManager)4 CurrentContentRevision (com.intellij.openapi.vcs.changes.CurrentContentRevision)4 VcsRevisionNumber (com.intellij.openapi.vcs.history.VcsRevisionNumber)3 GitRevisionNumber (git4idea.GitRevisionNumber)3 AccessToken (com.intellij.openapi.application.AccessToken)2 Project (com.intellij.openapi.project.Project)2 Ref (com.intellij.openapi.util.Ref)2 BinaryContentRevision (com.intellij.openapi.vcs.changes.BinaryContentRevision)2 ByteBackedContentRevision (com.intellij.openapi.vcs.changes.ByteBackedContentRevision)2 ChangeList (com.intellij.openapi.vcs.changes.ChangeList)2