Search in sources :

Example 11 with SVNException

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

the class SvnKitDeleteClient method delete.

@Override
public void delete(@NotNull File path, boolean force, boolean dryRun, @Nullable ProgressTracker handler) throws VcsException {
    SVNWCClient client = myVcs.getSvnKitManager().createWCClient();
    client.setEventHandler(toEventHandler(handler));
    try {
        client.doDelete(path, force, dryRun);
    } catch (SVNException e) {
        throw new VcsException(e);
    }
}
Also used : VcsException(com.intellij.openapi.vcs.VcsException) SVNWCClient(org.tmatesoft.svn.core.wc.SVNWCClient) SVNException(org.tmatesoft.svn.core.SVNException)

Example 12 with SVNException

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

the class RepositoryBrowserDialog method createBrowserComponent.

public JComponent createBrowserComponent(final boolean toolWindow) {
    JPanel panel = new JPanel();
    panel.setLayout(new GridBagLayout());
    GridBagConstraints gc = new GridBagConstraints();
    gc.gridx = 0;
    gc.gridwidth = 1;
    gc.gridy = 0;
    gc.gridheight = 1;
    gc.gridx = 0;
    gc.gridwidth = 2;
    gc.gridy += 1;
    gc.gridheight = 1;
    gc.weightx = 1;
    gc.weighty = 1;
    gc.fill = GridBagConstraints.BOTH;
    gc.anchor = GridBagConstraints.WEST;
    panel.add(getRepositoryBrowser(), gc);
    gc.gridy += 1;
    gc.weighty = 0;
    gc.fill = GridBagConstraints.HORIZONTAL;
    panel.add(new JLabel(), gc);
    Collection<String> urls = SvnApplicationSettings.getInstance().getCheckoutURLs();
    ArrayList<SVNURL> svnURLs = new ArrayList<>();
    for (final String url : urls) {
        try {
            svnURLs.add(SVNURL.parseURIEncoded(url));
        } catch (SVNException e) {
        //
        }
    }
    getRepositoryBrowser().setRepositoryURLs(svnURLs.toArray(new SVNURL[svnURLs.size()]), myShowFiles);
    getRepositoryBrowser().getRepositoryTree().addMouseListener(new PopupHandler() {

        @Override
        public void invokePopup(Component comp, int x, int y) {
            JTree tree = getRepositoryBrowser().getRepositoryTree();
            int row = tree.getRowForLocation(x, y);
            if (row >= 0) {
                tree.setSelectionRow(row);
            }
            JPopupMenu popupMenu = createPopup(toolWindow);
            if (popupMenu != null) {
                popupMenu.show(comp, x, y);
            }
        }
    });
    return panel;
}
Also used : PopupHandler(com.intellij.ui.PopupHandler) SVNURL(org.tmatesoft.svn.core.SVNURL) ArrayList(java.util.ArrayList) SVNException(org.tmatesoft.svn.core.SVNException)

Example 13 with SVNException

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

the class DiffContentRevision method getContentAsBytes.

@NotNull
@Override
public byte[] getContentAsBytes() throws VcsException {
    if (myContents == null) {
        BufferExposingByteArrayOutputStream bos = new BufferExposingByteArrayOutputStream(2048);
        try {
            myRepository.getFile(myPath, -1, null, bos);
            myRepository.closeSession();
        } catch (SVNException e) {
            throw new VcsException(e);
        }
        myContents = bos.toByteArray();
    }
    return myContents;
}
Also used : BufferExposingByteArrayOutputStream(com.intellij.openapi.util.io.BufferExposingByteArrayOutputStream) VcsException(com.intellij.openapi.vcs.VcsException) SVNException(org.tmatesoft.svn.core.SVNException) NotNull(org.jetbrains.annotations.NotNull)

Example 14 with SVNException

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

the class ElementWithBranchComparer method run.

public void run() {
    new Task.Modal(myProject, getTitle(), true) {

        @Override
        public void run(@NotNull ProgressIndicator indicator) {
            try {
                beforeCompare();
                myElementUrl = resolveElementUrl();
                if (myElementUrl == null) {
                    reportNotFound();
                } else {
                    compare();
                }
            } catch (SVNCancelException ex) {
                ElementWithBranchComparer.this.onCancel();
            } catch (SVNException ex) {
                reportException(new SvnBindException(ex));
            } catch (SvnBindException ex) {
                reportException(ex);
            } catch (VcsException ex) {
                reportGeneralException(ex);
            }
        }
    }.queue();
    showResult();
}
Also used : Task(com.intellij.openapi.progress.Task) SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) SVNCancelException(org.tmatesoft.svn.core.SVNCancelException) VcsException(com.intellij.openapi.vcs.VcsException) SVNException(org.tmatesoft.svn.core.SVNException)

Example 15 with SVNException

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

the class SvnAuthenticationTest method testSavedAndRead.

public void testSavedAndRead() throws Exception {
    final TestListener listener = new TestListener(mySynchObject);
    myAuthenticationManager.addListener(listener);
    final SavedOnceListener savedOnceListener = new SavedOnceListener();
    myAuthenticationManager.addListener(savedOnceListener);
    final SVNURL url = SVNURL.parseURIEncoded("http://some.host.com/repo");
    final SVNException[] exception = new SVNException[1];
    final boolean[] result = { false };
    synchronousBackground(() -> {
        try {
            listener.addStep(new Trinity<>(ProviderType.persistent, url, Type.request));
            listener.addStep(new Trinity<>(ProviderType.interactive, url, Type.request));
            if (SystemInfo.isWindows) {
                listener.addStep(new Trinity<>(ProviderType.persistent, url, Type.save));
            } else {
                listener.addStep(new Trinity<>(ProviderType.persistent, url, Type.without_pasword_save));
            }
            commonScheme(url, false, null);
            Assert.assertEquals(3, listener.getCnt());
            //long start = System.currentTimeMillis();
            //waitListenerStep(start, listener, 3);
            listener.reset();
            if (!SystemInfo.isWindows)
                savedOnceListener.reset();
            SvnConfiguration.RUNTIME_AUTH_CACHE.clear();
            listener.addStep(new Trinity<>(ProviderType.persistent, url, Type.request));
            if (!SystemInfo.isWindows) {
                listener.addStep(new Trinity<>(ProviderType.interactive, url, Type.request));
                listener.addStep(new Trinity<>(ProviderType.persistent, url, Type.without_pasword_save));
            }
            commonScheme(url, false, null);
            //start = System.currentTimeMillis();
            //waitListenerStep(start, listener, 4);
            Assert.assertEquals(SystemInfo.isWindows ? 1 : 3, listener.getCnt());
        } catch (SVNException e) {
            exception[0] = e;
        }
        result[0] = true;
    });
    Assert.assertTrue(result[0]);
    Assert.assertEquals(SystemInfo.isWindows ? 0 : 2, myTestInteraction.getNumPlaintextPrompt());
    Assert.assertEquals(0, myTestInteraction.getNumAuthWarn());
    Assert.assertEquals(0, myTestInteraction.getNumPasswordsWarn());
    Assert.assertEquals(0, myTestInteraction.getNumSSLPlaintextPrompt());
    Assert.assertEquals(0, myTestInteraction.getNumSSLWarn());
    Assert.assertEquals(SystemInfo.isWindows ? 1 : 3, listener.getCnt());
    listener.assertForAwt();
    savedOnceListener.assertForAwt();
    savedOnceListener.assertSaved(url, ISVNAuthenticationManager.PASSWORD);
    if (exception[0] != null) {
        throw exception[0];
    }
}
Also used : SVNURL(org.tmatesoft.svn.core.SVNURL) SVNException(org.tmatesoft.svn.core.SVNException)

Aggregations

SVNException (org.tmatesoft.svn.core.SVNException)95 File (java.io.File)37 SVNURL (org.tmatesoft.svn.core.SVNURL)37 VcsException (com.intellij.openapi.vcs.VcsException)18 SvnBindException (org.jetbrains.idea.svn.commandLine.SvnBindException)14 SVNConfigFile (org.tmatesoft.svn.core.internal.wc.SVNConfigFile)14 IOException (java.io.IOException)8 ArrayList (java.util.ArrayList)8 Collection (java.util.Collection)8 List (java.util.List)8 VirtualFile (com.intellij.openapi.vfs.VirtualFile)7 DefaultSVNOptions (org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions)7 SVNRepository (org.tmatesoft.svn.core.io.SVNRepository)7 SVNRevision (org.tmatesoft.svn.core.wc.SVNRevision)7 Date (java.util.Date)6 NotNull (org.jetbrains.annotations.NotNull)6 SVNCancelException (org.tmatesoft.svn.core.SVNCancelException)6 SVNLogEntry (org.tmatesoft.svn.core.SVNLogEntry)6 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)5 ByteArrayInputStream (java.io.ByteArrayInputStream)5