Search in sources :

Example 1 with CommandExecutor

use of org.jetbrains.idea.svn.commandLine.CommandExecutor 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 CommandExecutor

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

the class CmdAnnotateClient method annotate.

@Override
public void annotate(@NotNull SvnTarget target, @NotNull SVNRevision startRevision, @NotNull SVNRevision endRevision, boolean includeMergedRevisions, @Nullable DiffOptions diffOptions, @Nullable final AnnotationConsumer handler) throws VcsException {
    List<String> parameters = new ArrayList<>();
    CommandUtil.put(parameters, target);
    CommandUtil.put(parameters, startRevision, endRevision);
    CommandUtil.put(parameters, includeMergedRevisions, "--use-merge-history");
    CommandUtil.put(parameters, diffOptions);
    parameters.add("--xml");
    CommandExecutor command = execute(myVcs, target, SvnCommandName.blame, parameters, null);
    parseOutput(command.getOutput(), handler);
}
Also used : ArrayList(java.util.ArrayList) CommandExecutor(org.jetbrains.idea.svn.commandLine.CommandExecutor)

Example 3 with CommandExecutor

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

the class CmdAddClient method add.

@Override
public void add(@NotNull File file, @Nullable Depth depth, boolean makeParents, boolean includeIgnored, boolean force, @Nullable ProgressTracker handler) throws VcsException {
    List<String> parameters = prepareParameters(file, depth, makeParents, includeIgnored, force);
    // TODO: handler should be called in parallel with command execution, but this will be in other thread
    // TODO: check if that is ok for current handler implementation
    // TODO: add possibility to invoke "handler.checkCancelled" - process should be killed
    CommandExecutor command = execute(myVcs, SvnTarget.fromFile(file), SvnCommandName.add, parameters, null);
    FileStatusResultParser parser = new FileStatusResultParser(CHANGED_PATH, handler, new AddStatusConvertor());
    parser.parse(command.getOutput());
}
Also used : CommandExecutor(org.jetbrains.idea.svn.commandLine.CommandExecutor)

Example 4 with CommandExecutor

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

the class CmdContentClient method getContent.

@Override
public byte[] getContent(@NotNull SvnTarget target, @Nullable SVNRevision revision, @Nullable SVNRevision pegRevision) throws VcsException, FileTooBigRuntimeException {
    // TODO: rewrite this to provide output as Stream
    // TODO: Also implement max size constraint like in SvnKitContentClient
    // NOTE: Export could not be used to get content of scheduled for deletion file
    List<String> parameters = new ArrayList<>();
    CommandUtil.put(parameters, target.getPathOrUrlString(), pegRevision);
    CommandUtil.put(parameters, revision);
    CommandExecutor command = null;
    try {
        command = execute(myVcs, target, SvnCommandName.cat, parameters, null);
    } catch (SvnBindException e) {
        // "no pristine version" error is thrown, for instance, for locally replaced files (not committed yet)
        if (StringUtil.containsIgnoreCase(e.getMessage(), NO_PRISTINE_VERSION_FOR_FILE)) {
            LOG.debug(e);
        } else {
            throw e;
        }
    }
    byte[] bytes = command != null ? command.getBinaryOutput().toByteArray() : ArrayUtil.EMPTY_BYTE_ARRAY;
    ContentRevisionCache.checkContentsSize(target.getPathOrUrlString(), bytes.length);
    return bytes;
}
Also used : SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) ArrayList(java.util.ArrayList) CommandExecutor(org.jetbrains.idea.svn.commandLine.CommandExecutor)

Example 5 with CommandExecutor

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

the class CmdLockClient method lock.

@Override
public void lock(@NotNull File file, boolean force, @NotNull String message, @Nullable ProgressTracker handler) throws VcsException {
    List<String> parameters = prepareParameters(file, force);
    parameters.add("--message");
    parameters.add(message);
    CommandExecutor command = execute(myVcs, SvnTarget.fromFile(file), SvnCommandName.lock, parameters, null);
    handleCommandCompletion(command, file, EventAction.LOCKED, EventAction.LOCK_FAILED, handler);
}
Also used : CommandExecutor(org.jetbrains.idea.svn.commandLine.CommandExecutor)

Aggregations

CommandExecutor (org.jetbrains.idea.svn.commandLine.CommandExecutor)10 SvnBindException (org.jetbrains.idea.svn.commandLine.SvnBindException)5 ArrayList (java.util.ArrayList)4 SVNException (org.tmatesoft.svn.core.SVNException)2 IOException (java.io.IOException)1 NotNull (org.jetbrains.annotations.NotNull)1 WorkingCopyFormat (org.jetbrains.idea.svn.WorkingCopyFormat)1 CommitInfo (org.jetbrains.idea.svn.checkin.CommitInfo)1 Command (org.jetbrains.idea.svn.commandLine.Command)1 Info (org.jetbrains.idea.svn.info.Info)1 SvnTarget (org.tmatesoft.svn.core.wc2.SvnTarget)1