Search in sources :

Example 1 with StatusClient

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

the class CmdCheckinClient method filterCommittables.

@NotNull
private List<File> filterCommittables(@NotNull List<File> committables) throws SvnBindException {
    final Set<String> childrenOfSomebody = ContainerUtil.newHashSet();
    new AbstractFilterChildren<File>() {

        @Override
        protected void sortAscending(List<File> list) {
            Collections.sort(list);
        }

        @Override
        protected boolean isAncestor(File parent, File child) {
            // strict here will ensure that for case insensitive file systems paths different only by case will not be treated as ancestors
            // of each other which is what we need to perform renames from one case to another on Windows
            final boolean isAncestor = FileUtil.isAncestor(parent, child, true);
            if (isAncestor) {
                childrenOfSomebody.add(child.getPath());
            }
            return isAncestor;
        }
    }.doFilter(ContainerUtil.newArrayList(committables));
    if (!childrenOfSomebody.isEmpty()) {
        List<File> result = ContainerUtil.newArrayList();
        StatusClient statusClient = myFactory.createStatusClient();
        for (File file : committables) {
            if (!childrenOfSomebody.contains(file.getPath())) {
                result.add(file);
            } else {
                try {
                    final Status status = statusClient.doStatus(file, false);
                    if (status != null && !StatusType.STATUS_NONE.equals(status.getContentsStatus()) && !StatusType.STATUS_UNVERSIONED.equals(status.getContentsStatus())) {
                        result.add(file);
                    }
                } catch (SvnBindException e) {
                    // not versioned
                    LOG.info(e);
                    throw e;
                }
            }
        }
        return result;
    }
    return committables;
}
Also used : StatusClient(org.jetbrains.idea.svn.status.StatusClient) Status(org.jetbrains.idea.svn.status.Status) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with StatusClient

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

the class SvnTreeConflictResolver method getDescendantsWithAddedStatus.

@NotNull
private Set<File> getDescendantsWithAddedStatus(@NotNull File ioFile) throws SvnBindException {
    final Set<File> result = ContainerUtil.newHashSet();
    StatusClient statusClient = myVcs.getFactory(ioFile).createStatusClient();
    statusClient.doStatus(ioFile, SVNRevision.UNDEFINED, Depth.INFINITY, false, false, false, false, status -> {
        if (status != null && StatusType.STATUS_ADDED.equals(status.getNodeStatus())) {
            result.add(status.getFile());
        }
    }, null);
    return result;
}
Also used : StatusClient(org.jetbrains.idea.svn.status.StatusClient) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with StatusClient

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

the class MarkResolvedAction method collectResolvablePaths.

@NotNull
private static Collection<String> collectResolvablePaths(@NotNull SvnVcs vcs, @NotNull VirtualFile[] files) {
    Collection<String> result = newTreeSet();
    for (VirtualFile file : files) {
        try {
            File path = VfsUtilCore.virtualToIoFile(file);
            StatusClient client = vcs.getFactory(path).createStatusClient();
            client.doStatus(path, SVNRevision.UNDEFINED, Depth.INFINITY, false, false, false, false, status -> {
                if (status.getContentsStatus() == StatusType.STATUS_CONFLICTED || status.getPropertiesStatus() == StatusType.STATUS_CONFLICTED) {
                    result.add(status.getFile().getAbsolutePath());
                }
            }, null);
        } catch (SvnBindException e) {
            LOG.warn(e);
        }
    }
    return result;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) StatusClient(org.jetbrains.idea.svn.status.StatusClient) SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

File (java.io.File)3 NotNull (org.jetbrains.annotations.NotNull)3 StatusClient (org.jetbrains.idea.svn.status.StatusClient)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 SvnBindException (org.jetbrains.idea.svn.commandLine.SvnBindException)1 Status (org.jetbrains.idea.svn.status.Status)1