Search in sources :

Example 11 with SVNWCClient

use of org.tmatesoft.svn.core.wc.SVNWCClient in project intellij-community by JetBrains.

the class SvnKitUpgradeClient method upgrade.

@Override
public void upgrade(@NotNull File path, @NotNull WorkingCopyFormat format, @Nullable ProgressTracker handler) throws VcsException {
    validateFormat(format, getSupportedFormats());
    SVNWCClient client = myVcs.getSvnKitManager().createUpgradeClient();
    client.setEventHandler(toEventHandler(handler));
    try {
        cleanupIfNecessary(path, format, client, handler);
        upgrade(path, format, client, handler);
    } catch (SVNException e) {
        throw new SvnBindException(e);
    }
}
Also used : SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) SVNWCClient(org.tmatesoft.svn.core.wc.SVNWCClient) SVNException(org.tmatesoft.svn.core.SVNException)

Example 12 with SVNWCClient

use of org.tmatesoft.svn.core.wc.SVNWCClient in project intellij-community by JetBrains.

the class SvnKitContentClient method getContent.

@Override
public byte[] getContent(@NotNull SvnTarget target, @Nullable SVNRevision revision, @Nullable SVNRevision pegRevision) throws VcsException, FileTooBigRuntimeException {
    final int maxSize = VcsUtil.getMaxVcsLoadedFileSize();
    ByteArrayOutputStream buffer = new ByteArrayOutputStream() {

        @Override
        public synchronized void write(int b) {
            if (size() > maxSize)
                throw new FileTooBigRuntimeException();
            super.write(b);
        }

        @Override
        public synchronized void write(byte[] b, int off, int len) {
            if (size() > maxSize)
                throw new FileTooBigRuntimeException();
            super.write(b, off, len);
        }

        @Override
        public synchronized void writeTo(OutputStream out) throws IOException {
            if (size() > maxSize)
                throw new FileTooBigRuntimeException();
            super.writeTo(out);
        }
    };
    SVNWCClient wcClient = myVcs.getSvnKitManager().createWCClient();
    try {
        if (target.isURL()) {
            wcClient.doGetFileContents(target.getURL(), pegRevision, revision, true, buffer);
        } else {
            wcClient.doGetFileContents(target.getFile(), pegRevision, revision, true, buffer);
        }
        ContentRevisionCache.checkContentsSize(target.getPathOrUrlString(), buffer.size());
    } catch (FileTooBigRuntimeException e) {
        ContentRevisionCache.checkContentsSize(target.getPathOrUrlString(), buffer.size());
    } catch (SVNException e) {
        throw new VcsException(e);
    }
    return buffer.toByteArray();
}
Also used : OutputStream(java.io.OutputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) VcsException(com.intellij.openapi.vcs.VcsException) SVNWCClient(org.tmatesoft.svn.core.wc.SVNWCClient) ByteArrayOutputStream(java.io.ByteArrayOutputStream) SVNException(org.tmatesoft.svn.core.SVNException)

Example 13 with SVNWCClient

use of org.tmatesoft.svn.core.wc.SVNWCClient in project intellij-community by JetBrains.

the class SvnKitCleanupClient method cleanup.

@Override
public void cleanup(@NotNull File path, @Nullable ProgressTracker handler) throws VcsException {
    SVNWCClient client = myVcs.getSvnKitManager().createWCClient();
    client.setEventHandler(toEventHandler(handler));
    try {
        client.doCleanup(path);
    } catch (SVNException e) {
        throw new SvnBindException(e);
    }
}
Also used : SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) SVNWCClient(org.tmatesoft.svn.core.wc.SVNWCClient) SVNException(org.tmatesoft.svn.core.SVNException)

Aggregations

SVNWCClient (org.tmatesoft.svn.core.wc.SVNWCClient)13 SVNException (org.tmatesoft.svn.core.SVNException)6 VcsException (com.intellij.openapi.vcs.VcsException)4 SVNPropertyData (org.tmatesoft.svn.core.wc.SVNPropertyData)4 SvnBindException (org.jetbrains.idea.svn.commandLine.SvnBindException)2 SVNProperties (org.tmatesoft.svn.core.SVNProperties)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1 OutputStream (java.io.OutputStream)1 NotNull (org.jetbrains.annotations.NotNull)1 SvnVcs (org.jetbrains.idea.svn.SvnVcs)1