Search in sources :

Example 1 with SvnBindException

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

the class CmdBrowseClient method list.

@Override
public void list(@NotNull SvnTarget target, @Nullable SVNRevision revision, @Nullable Depth depth, @Nullable DirectoryEntryConsumer handler) throws VcsException {
    assertUrl(target);
    List<String> parameters = new ArrayList<>();
    CommandUtil.put(parameters, target);
    CommandUtil.put(parameters, revision);
    CommandUtil.put(parameters, depth);
    parameters.add("--xml");
    CommandExecutor command = execute(myVcs, target, SvnCommandName.list, parameters, null);
    Info info = myFactory.createInfoClient().doInfo(target, revision);
    try {
        parseOutput(target.getURL(), command, handler, info != null ? info.getRepositoryRootURL() : null);
    } catch (SVNException e) {
        throw new SvnBindException(e);
    }
}
Also used : SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) ArrayList(java.util.ArrayList) CommandExecutor(org.jetbrains.idea.svn.commandLine.CommandExecutor) SVNException(org.tmatesoft.svn.core.SVNException) Info(org.jetbrains.idea.svn.info.Info) CommitInfo(org.jetbrains.idea.svn.checkin.CommitInfo)

Example 2 with SvnBindException

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

the class SvnKitImportClient method doImport.

@Override
public long doImport(@NotNull File path, @NotNull SVNURL url, @Nullable Depth depth, @NotNull String message, boolean noIgnore, @Nullable CommitEventHandler handler, @Nullable ISVNCommitHandler commitHandler) throws VcsException {
    SVNCommitClient client = myVcs.getSvnKitManager().createCommitClient();
    client.setEventHandler(toEventHandler(handler));
    client.setCommitHandler(commitHandler);
    try {
        SVNCommitInfo info = client.doImport(path, url, message, null, !noIgnore, false, toDepth(depth));
        return info.getNewRevision();
    } catch (SVNException e) {
        throw new SvnBindException(e);
    }
}
Also used : SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) SVNCommitInfo(org.tmatesoft.svn.core.SVNCommitInfo) SVNCommitClient(org.tmatesoft.svn.core.wc.SVNCommitClient) SVNException(org.tmatesoft.svn.core.SVNException)

Example 3 with SvnBindException

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

the class AuthenticationService method acceptSSLServerCertificate.

public boolean acceptSSLServerCertificate(@Nullable SVNURL repositoryUrl, final String realm) throws SvnBindException {
    if (repositoryUrl == null) {
        return false;
    }
    boolean result;
    if (Registry.is("svn.use.svnkit.for.https.server.certificate.check")) {
        result = new SSLServerCertificateAuthenticator(this, repositoryUrl, realm).tryAuthenticate();
    } else {
        HttpClient client = getClient(repositoryUrl);
        try {
            client.execute(new HttpGet(repositoryUrl.toDecodedString()));
            result = true;
        } catch (IOException e) {
            throw new SvnBindException(fixMessage(e), e);
        }
    }
    return result;
}
Also used : SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) HttpClient(org.apache.http.client.HttpClient) HttpGet(org.apache.http.client.methods.HttpGet) IOException(java.io.IOException)

Example 4 with SvnBindException

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

the class SvnKitCheckoutClient method checkout.

@Override
public void checkout(@NotNull SvnTarget source, @NotNull File destination, @Nullable SVNRevision revision, @Nullable Depth depth, boolean ignoreExternals, boolean force, @NotNull WorkingCopyFormat format, @Nullable ProgressTracker handler) throws VcsException {
    assertUrl(source);
    validateFormat(format, getSupportedFormats());
    SVNUpdateClient client = myVcs.getSvnKitManager().createUpdateClient();
    client.setIgnoreExternals(ignoreExternals);
    client.setEventHandler(toEventHandler(handler));
    try {
        runCheckout(client, format, source, destination, revision, depth, force);
    } catch (SVNException e) {
        throw new SvnBindException(e);
    }
}
Also used : SVNUpdateClient(org.tmatesoft.svn.core.wc.SVNUpdateClient) SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) SVNException(org.tmatesoft.svn.core.SVNException)

Example 5 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)

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