Search in sources :

Example 86 with SVNException

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

the class SvnKitExportClient method export.

@Override
public void export(@NotNull SvnTarget from, @NotNull File to, @Nullable SVNRevision revision, @Nullable Depth depth, @Nullable String nativeLineEnd, boolean force, boolean ignoreExternals, @Nullable ProgressTracker handler) throws VcsException {
    SVNUpdateClient client = myVcs.getSvnKitManager().createUpdateClient();
    client.setEventHandler(toEventHandler(handler));
    client.setIgnoreExternals(ignoreExternals);
    try {
        if (from.isFile()) {
            client.doExport(from.getFile(), to, from.getPegRevision(), revision, nativeLineEnd, force, toDepth(depth));
        } else {
            client.doExport(from.getURL(), to, from.getPegRevision(), revision, nativeLineEnd, force, toDepth(depth));
        }
    } 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 87 with SVNException

use of org.tmatesoft.svn.core.SVNException 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)

Example 88 with SVNException

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

the class SvnChangeProvider method getChanges.

public void getChanges(@NotNull VcsDirtyScope dirtyScope, @NotNull ChangelistBuilder builder, @NotNull ProgressIndicator progress, @NotNull ChangeListManagerGate addGate) throws VcsException {
    final SvnScopeZipper zipper = new SvnScopeZipper(dirtyScope);
    zipper.run();
    final Map<String, SvnScopeZipper.MyDirNonRecursive> nonRecursiveMap = zipper.getNonRecursiveDirs();
    final ISVNStatusFileProvider fileProvider = createFileProvider(nonRecursiveMap);
    try {
        final SvnChangeProviderContext context = new SvnChangeProviderContext(myVcs, builder, progress);
        final NestedCopiesBuilder nestedCopiesBuilder = new NestedCopiesBuilder(myVcs, mySvnFileUrlMapping);
        final EventDispatcher<StatusReceiver> statusReceiver = EventDispatcher.create(StatusReceiver.class);
        statusReceiver.addListener(context);
        statusReceiver.addListener(nestedCopiesBuilder);
        final SvnRecursiveStatusWalker walker = new SvnRecursiveStatusWalker(myVcs, statusReceiver.getMulticaster(), progress);
        for (FilePath path : zipper.getRecursiveDirs()) {
            walker.go(path, Depth.INFINITY);
        }
        walker.setFileProvider(fileProvider);
        for (SvnScopeZipper.MyDirNonRecursive item : nonRecursiveMap.values()) {
            walker.go(item.getDir(), Depth.IMMEDIATES);
        }
        statusReceiver.getMulticaster().finish();
        processCopiedAndDeleted(context, dirtyScope);
        processUnsaved(dirtyScope, addGate, context);
        final Set<NestedCopyInfo> nestedCopies = nestedCopiesBuilder.getCopies();
        mySvnFileUrlMapping.acceptNestedData(nestedCopies);
        putAdministrative17UnderVfsListener(nestedCopies);
    } catch (SvnExceptionWrapper e) {
        LOG.info(e);
        throw new VcsException(e.getCause());
    } catch (SVNException e) {
        if (e.getCause() != null) {
            throw new VcsException(e.getMessage() + " " + e.getCause().getMessage(), e);
        }
        throw new VcsException(e);
    }
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) ISVNStatusFileProvider(org.tmatesoft.svn.core.wc.ISVNStatusFileProvider) SVNException(org.tmatesoft.svn.core.SVNException) VcsException(com.intellij.openapi.vcs.VcsException) SvnExceptionWrapper(org.jetbrains.idea.svn.commandLine.SvnExceptionWrapper)

Example 89 with SVNException

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

the class Idea87218Test method main.

public static void main(String[] args) {
    try {
        SVNStatusClient client = new SVNStatusClient((ISVNRepositoryPool) null, new DefaultSVNOptions());
        File src = new File(ourWcPath, "file1.txt");
        SVNStatus status = client.doStatus(src, false);
        assert status != null && SVNStatusType.STATUS_NORMAL.equals(status.getNodeStatus());
        File dir = new File(ourWcPath, "unversioned");
        SVNStatus dirStatus = client.doStatus(dir, false);
        assert dirStatus != null && SVNStatusType.STATUS_UNVERSIONED.equals(dirStatus.getNodeStatus());
        File dst = new File(dir, "file1.txt");
        /*
      final SVNCopyClient copyClient = new SVNCopyClient((ISVNRepositoryPool)null, new DefaultSVNOptions());
      final SVNCopySource svnCopySource = new SVNCopySource(SVNRevision.UNDEFINED, SVNRevision.WORKING, src);
      copyClient.doCopy(new SVNCopySource[]{svnCopySource}, dst, true, false, true);
      */
        SVNMoveClient moveClient = new SVNMoveClient((ISVNRepositoryPool) null, new DefaultSVNOptions());
        moveClient.doMove(src, dst);
    } catch (SVNException e) {
        e.printStackTrace();
    }
}
Also used : DefaultSVNOptions(org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions) SVNException(org.tmatesoft.svn.core.SVNException) File(java.io.File)

Example 90 with SVNException

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

the class Idea93475Test method main.

public static void main(String[] args) {
    try {
        SVNStatusClient client = new SVNStatusClient((ISVNRepositoryPool) null, new DefaultSVNOptions());
        File src = new File(ourWcPath, "cde\\text1.txt");
        assertStatus(client, src, SVNStatusType.STATUS_NORMAL);
        File src1 = new File(ourWcPath, "cde\\text2.txt");
        assertStatus(client, src, SVNStatusType.STATUS_NORMAL);
        File dir = new File(ourWcPath, "abc");
        assertStatus(client, dir, SVNStatusType.STATUS_ADDED);
        File dst = new File(dir, "text1.txt");
        File dst1 = new File(dir, "text2.txt");
        SVNMoveClient moveClient = new SVNMoveClient((ISVNRepositoryPool) null, new DefaultSVNOptions());
        moveClient.doMove(src, dst);
        moveClient.doMove(src1, dst1);
        assertStatus(client, dst, SVNStatusType.STATUS_ADDED);
        assertStatus(client, dst1, SVNStatusType.STATUS_ADDED);
        assert client.doStatus(dst, false).getCopyFromURL() != null;
        assert client.doStatus(dst1, false).getCopyFromURL() != null;
        // now rename the directory
        final File renamedDir = new File(ourWcPath, "abc_renamed");
        moveClient.doMove(dir, renamedDir);
        File dstInRenamed = new File(renamedDir, "text1.txt");
        File dst1InRenamed = new File(renamedDir, "text2.txt");
        assertStatus(client, dstInRenamed, SVNStatusType.STATUS_ADDED);
        assertStatus(client, dst1InRenamed, SVNStatusType.STATUS_ADDED);
        assert client.doStatus(dstInRenamed, false).getCopyFromURL() != null;
        assert client.doStatus(dst1InRenamed, false).getCopyFromURL() != null;
    } catch (SVNException e) {
        e.printStackTrace();
    }
}
Also used : DefaultSVNOptions(org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions) SVNException(org.tmatesoft.svn.core.SVNException) File(java.io.File)

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