Search in sources :

Example 1 with BaseUpdateCommandListener

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

the class CmdCheckoutClient method run.

private void run(@NotNull SvnTarget source, @NotNull File destination, @Nullable ProgressTracker handler, @NotNull List<String> parameters) throws VcsException {
    BaseUpdateCommandListener listener = new BaseUpdateCommandListener(destination, handler);
    execute(myVcs, source, SvnCommandName.checkout, parameters, listener);
    listener.throwWrappedIfException();
}
Also used : BaseUpdateCommandListener(org.jetbrains.idea.svn.commandLine.BaseUpdateCommandListener)

Example 2 with BaseUpdateCommandListener

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

the class CmdExportClient 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 {
    List<String> parameters = new ArrayList<>();
    CommandUtil.put(parameters, from);
    CommandUtil.put(parameters, to);
    CommandUtil.put(parameters, revision);
    CommandUtil.put(parameters, depth);
    CommandUtil.put(parameters, force, "--force");
    CommandUtil.put(parameters, ignoreExternals, "--ignore-externals");
    if (!StringUtil.isEmpty(nativeLineEnd)) {
        parameters.add("--native-eol");
        parameters.add(nativeLineEnd);
    }
    BaseUpdateCommandListener listener = new BaseUpdateCommandListener(to, handler);
    execute(myVcs, from, to, SvnCommandName.export, parameters, listener);
    listener.throwWrappedIfException();
}
Also used : BaseUpdateCommandListener(org.jetbrains.idea.svn.commandLine.BaseUpdateCommandListener) ArrayList(java.util.ArrayList)

Example 3 with BaseUpdateCommandListener

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

the class CmdUpdateClient method run.

private long[] run(@NotNull File path, @NotNull List<String> parameters, @NotNull SvnCommandName command) throws SvnBindException {
    File base = path.isDirectory() ? path : path.getParentFile();
    final AtomicReference<long[]> updatedToRevision = new AtomicReference<>();
    updatedToRevision.set(new long[0]);
    final BaseUpdateCommandListener listener = createCommandListener(new File[] { path }, updatedToRevision, base);
    execute(myVcs, SvnTarget.fromFile(base), command, parameters, listener);
    listener.throwWrappedIfException();
    return updatedToRevision.get();
}
Also used : BaseUpdateCommandListener(org.jetbrains.idea.svn.commandLine.BaseUpdateCommandListener) AtomicReference(java.util.concurrent.atomic.AtomicReference) File(java.io.File)

Example 4 with BaseUpdateCommandListener

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

the class CmdUpdateClient method createCommandListener.

private BaseUpdateCommandListener createCommandListener(final File[] paths, final AtomicReference<long[]> updatedToRevision, final File base) {
    return new BaseUpdateCommandListener(base, myDispatcher) {

        final long[] myRevisions = new long[paths.length];

        @Override
        protected void beforeHandler(@NotNull ProgressEvent event) {
            if (EventAction.UPDATE_COMPLETED.equals(event.getAction())) {
                final long eventRevision = event.getRevision();
                for (int i = 0; i < paths.length; i++) {
                    final File path = paths[i];
                    if (FileUtil.filesEqual(path, event.getFile())) {
                        myRevisions[i] = eventRevision;
                        break;
                    }
                }
            }
        }

        @Override
        public void processTerminated(int exitCode) {
            super.processTerminated(exitCode);
            updatedToRevision.set(myRevisions);
        }
    };
}
Also used : BaseUpdateCommandListener(org.jetbrains.idea.svn.commandLine.BaseUpdateCommandListener) ProgressEvent(org.jetbrains.idea.svn.api.ProgressEvent) NotNull(org.jetbrains.annotations.NotNull) File(java.io.File)

Example 5 with BaseUpdateCommandListener

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

the class CmdCopyMoveClient method copy.

@Override
public void copy(@NotNull SvnTarget source, @NotNull File destination, @Nullable SVNRevision revision, boolean makeParents, @Nullable ProgressTracker handler) throws VcsException {
    List<String> parameters = new ArrayList<>();
    CommandUtil.put(parameters, source);
    CommandUtil.put(parameters, destination);
    CommandUtil.put(parameters, revision);
    CommandUtil.put(parameters, makeParents, "--parents");
    File workingDirectory = CommandUtil.getHomeDirectory();
    BaseUpdateCommandListener listener = new BaseUpdateCommandListener(workingDirectory, handler);
    execute(myVcs, source, workingDirectory, SvnCommandName.copy, parameters, listener);
    listener.throwWrappedIfException();
}
Also used : BaseUpdateCommandListener(org.jetbrains.idea.svn.commandLine.BaseUpdateCommandListener) ArrayList(java.util.ArrayList) File(java.io.File)

Aggregations

BaseUpdateCommandListener (org.jetbrains.idea.svn.commandLine.BaseUpdateCommandListener)7 File (java.io.File)4 ArrayList (java.util.ArrayList)3 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 NotNull (org.jetbrains.annotations.NotNull)1 ProgressEvent (org.jetbrains.idea.svn.api.ProgressEvent)1