Search in sources :

Example 6 with SvnBindException

use of org.jetbrains.idea.svn.commandLine.SvnBindException in project intellij-community by JetBrains.

the class SingleCommittedListProvider method searchForUrl.

private boolean searchForUrl(@NotNull SVNURL url) throws VcsException {
    LogEntryConsumer handler = logEntry -> {
        checkDisposed();
        if (logEntry.getDate() != null) {
            changeList[0] = createChangeList(logEntry);
        }
    };
    SvnTarget target = SvnTarget.fromURL(url);
    try {
        myVcs.getFactory(target).createHistoryClient().doLog(target, revisionBefore, revisionBefore, false, true, false, 1, null, handler);
    } catch (SvnBindException e) {
        LOG.info(e);
        if (!e.containsCategory(SVNErrorCode.FS_CATEGORY)) {
            throw e;
        }
    }
    return changeList[0] != null;
}
Also used : SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) VcsRevisionNumber(com.intellij.openapi.vcs.history.VcsRevisionNumber) VcsUtil(com.intellij.vcsUtil.VcsUtil) RootUrlInfo(org.jetbrains.idea.svn.RootUrlInfo) SvnRevisionNumber(org.jetbrains.idea.svn.SvnRevisionNumber) Change(com.intellij.openapi.vcs.changes.Change) VirtualFile(com.intellij.openapi.vfs.VirtualFile) ContentRevision(com.intellij.openapi.vcs.changes.ContentRevision) SVNErrorCode(org.tmatesoft.svn.core.SVNErrorCode) SvnAuthenticationNotifier(org.jetbrains.idea.svn.auth.SvnAuthenticationNotifier) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException) SvnUtil(org.jetbrains.idea.svn.SvnUtil) SVNRevision(org.tmatesoft.svn.core.wc.SVNRevision) SVNURL(org.tmatesoft.svn.core.SVNURL) Pair(com.intellij.openapi.util.Pair) Project(com.intellij.openapi.project.Project) SvnVcs(org.jetbrains.idea.svn.SvnVcs) Logger(com.intellij.openapi.diagnostic.Logger) VcsException(com.intellij.openapi.vcs.VcsException) NotNull(org.jetbrains.annotations.NotNull) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) FilePath(com.intellij.openapi.vcs.FilePath) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget)

Example 7 with SvnBindException

use of org.jetbrains.idea.svn.commandLine.SvnBindException in project intellij-community by JetBrains.

the class SvnChangeProvider method processCopiedFile.

private void processCopiedFile(@NotNull SvnChangedFile copiedFile, @NotNull SvnChangeProviderContext context, @Nullable VcsDirtyScope dirtyScope) throws SVNException {
    boolean foundRename = false;
    final Status copiedStatus = copiedFile.getStatus();
    final String copyFromURL = ObjectUtils.assertNotNull(copiedFile.getCopyFromURL());
    final Set<SvnChangedFile> deletedToDelete = new HashSet<>();
    for (SvnChangedFile deletedFile : context.getDeletedFiles()) {
        final Status deletedStatus = deletedFile.getStatus();
        if (deletedStatus.getURL() != null && Comparing.equal(copyFromURL, deletedStatus.getURL().toString())) {
            final String clName = SvnUtil.getChangelistName(copiedFile.getStatus());
            applyMovedChange(context, copiedFile.getFilePath(), dirtyScope, deletedToDelete, deletedFile, copiedStatus, clName);
            for (SvnChangedFile deletedChild : context.getDeletedFiles()) {
                final Status childStatus = deletedChild.getStatus();
                final SVNURL childUrl = childStatus.getURL();
                if (childUrl == null) {
                    continue;
                }
                final String childURL = childUrl.toDecodedString();
                if (StringUtil.startsWithConcatenation(childURL, copyFromURL, "/")) {
                    String relativePath = childURL.substring(copyFromURL.length());
                    File newPath = new File(copiedFile.getFilePath().getIOFile(), relativePath);
                    FilePath newFilePath = myFactory.createFilePathOn(newPath);
                    if (!context.isDeleted(newFilePath)) {
                        applyMovedChange(context, newFilePath, dirtyScope, deletedToDelete, deletedChild, context.getTreeConflictStatus(newPath), clName);
                    }
                }
            }
            foundRename = true;
            break;
        }
    }
    final List<SvnChangedFile> deletedFiles = context.getDeletedFiles();
    for (SvnChangedFile file : deletedToDelete) {
        deletedFiles.remove(file);
    }
    // by building a relative url
    if (!foundRename && copiedStatus.getURL() != null) {
        File wcPath = myVcs.getSvnFileUrlMapping().getLocalPath(copyFromURL);
        if (wcPath != null) {
            Status status;
            try {
                status = myVcs.getFactory(wcPath).createStatusClient().doStatus(wcPath, false);
            } catch (SvnBindException ex) {
                LOG.info(ex);
                status = null;
            }
            if (status != null && status.is(StatusType.STATUS_DELETED)) {
                final FilePath filePath = myFactory.createFilePathOnDeleted(wcPath, false);
                final SvnContentRevision beforeRevision = SvnContentRevision.createBaseRevision(myVcs, filePath, status.getRevision());
                final ContentRevision afterRevision = CurrentContentRevision.create(copiedFile.getFilePath());
                context.getBuilder().processChangeInList(context.createMovedChange(beforeRevision, afterRevision, copiedStatus, status), SvnUtil.getChangelistName(status), SvnVcs.getKey());
                foundRename = true;
            }
        }
    }
    if (!foundRename) {
        // for debug
        LOG.info("Rename not found for " + copiedFile.getFilePath().getPresentableUrl());
        context.processStatus(copiedFile.getFilePath(), copiedStatus);
    }
}
Also used : FileStatus(com.intellij.openapi.vcs.FileStatus) Status(org.jetbrains.idea.svn.status.Status) FilePath(com.intellij.openapi.vcs.FilePath) SVNURL(org.tmatesoft.svn.core.SVNURL) SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) VirtualFile(com.intellij.openapi.vfs.VirtualFile) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) File(java.io.File)

Example 8 with SvnBindException

use of org.jetbrains.idea.svn.commandLine.SvnBindException in project intellij-community by JetBrains.

the class SvnFileSystemListener method for16move.

private boolean for16move(SvnVcs vcs, final File src, final File dst, final boolean undo) throws VcsException {
    final SVNMoveClient mover = vcs.getSvnKitManager().createMoveClient();
    if (undo) {
        myUndoingMove = true;
        restoreFromUndoStorage(dst);
    } else if (doUsualMove(vcs, src))
        return true;
    new RepeatSvnActionThroughBusy() {

        @Override
        protected void executeImpl() throws VcsException {
            try {
                if (undo) {
                    mover.undoMove(src, dst);
                } else {
                    mover.doMove(src, dst);
                }
            } catch (SVNException e) {
                throw new SvnBindException(e);
            }
        }
    }.execute();
    return false;
}
Also used : SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) SVNMoveClient(org.tmatesoft.svn.core.wc.SVNMoveClient) SVNException(org.tmatesoft.svn.core.SVNException)

Example 9 with SvnBindException

use of org.jetbrains.idea.svn.commandLine.SvnBindException in project intellij-community by JetBrains.

the class SvnFileSystemListener method copyUnversionedMembersOfDirectory.

private static void copyUnversionedMembersOfDirectory(final File src, final File dst) throws SvnBindException {
    if (src.isDirectory()) {
        final SvnBindException[] exc = new SvnBindException[1];
        FileUtil.processFilesRecursively(src, file -> {
            String relativePath = FileUtil.getRelativePath(src, file);
            File newFile = new File(dst, relativePath);
            if (!newFile.exists()) {
                try {
                    FileUtil.copyFileOrDir(src, dst);
                } catch (IOException e) {
                    exc[0] = new SvnBindException(e);
                    return false;
                }
            }
            return true;
        });
        if (exc[0] != null) {
            throw exc[0];
        }
    }
}
Also used : SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) IOException(java.io.IOException) VirtualFile(com.intellij.openapi.vfs.VirtualFile) ActionWithTempFile(com.intellij.vcsUtil.ActionWithTempFile) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) File(java.io.File)

Example 10 with SvnBindException

use of org.jetbrains.idea.svn.commandLine.SvnBindException in project intellij-community by JetBrains.

the class CmdDiffClient method parseOutput.

@NotNull
private List<Change> parseOutput(@NotNull SvnTarget target1, @NotNull SvnTarget target2, @NotNull CommandExecutor executor) throws SvnBindException {
    try {
        DiffInfo diffInfo = CommandUtil.parse(executor.getOutput(), DiffInfo.class);
        List<Change> result = ContainerUtil.newArrayList();
        if (diffInfo != null) {
            for (DiffPath path : diffInfo.diffPaths) {
                result.add(createChange(target1, target2, path));
            }
        }
        return result;
    } catch (JAXBException e) {
        throw new SvnBindException(e);
    }
}
Also used : SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) JAXBException(javax.xml.bind.JAXBException) Change(com.intellij.openapi.vcs.changes.Change) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

SvnBindException (org.jetbrains.idea.svn.commandLine.SvnBindException)32 SVNException (org.tmatesoft.svn.core.SVNException)13 NotNull (org.jetbrains.annotations.NotNull)7 VirtualFile (com.intellij.openapi.vfs.VirtualFile)6 File (java.io.File)6 CommandExecutor (org.jetbrains.idea.svn.commandLine.CommandExecutor)5 SVNURL (org.tmatesoft.svn.core.SVNURL)5 FilePath (com.intellij.openapi.vcs.FilePath)4 VcsException (com.intellij.openapi.vcs.VcsException)4 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)4 IOException (java.io.IOException)4 SVNRevision (org.tmatesoft.svn.core.wc.SVNRevision)4 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)3 Change (com.intellij.openapi.vcs.changes.Change)3 ContentRevision (com.intellij.openapi.vcs.changes.ContentRevision)3 ArrayList (java.util.ArrayList)3 ConfigurationException (com.intellij.openapi.options.ConfigurationException)2 Ref (com.intellij.openapi.util.Ref)2 FileStatus (com.intellij.openapi.vcs.FileStatus)2 Nullable (org.jetbrains.annotations.Nullable)2