Search in sources :

Example 1 with VcsUtil

use of com.intellij.vcsUtil.VcsUtil 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)

Aggregations

FilePath (com.intellij.openapi.vcs.FilePath)1 Change (com.intellij.openapi.vcs.changes.Change)1 ContentRevision (com.intellij.openapi.vcs.changes.ContentRevision)1 VcsUtil (com.intellij.vcsUtil.VcsUtil)1