Search in sources :

Example 6 with CommandExecutor

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

the class CmdLockClient method unlock.

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

Example 7 with CommandExecutor

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

the class CmdRevertClient method revert.

@Override
public void revert(@NotNull Collection<File> paths, @Nullable Depth depth, @Nullable ProgressTracker handler) throws VcsException {
    if (!ContainerUtil.isEmpty(paths)) {
        Command command = newCommand(SvnCommandName.revert);
        command.put(depth);
        command.setTargets(paths);
        // 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
        SvnTarget target = SvnTarget.fromFile(ObjectUtils.assertNotNull(ContainerUtil.getFirstItem(paths)));
        CommandExecutor executor = execute(myVcs, target, CommandUtil.getHomeDirectory(), command, null);
        FileStatusResultParser parser = new FileStatusResultParser(CHANGED_PATH, handler, new RevertStatusConvertor());
        parser.parse(executor.getOutput());
    }
}
Also used : Command(org.jetbrains.idea.svn.commandLine.Command) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) CommandExecutor(org.jetbrains.idea.svn.commandLine.CommandExecutor)

Example 8 with CommandExecutor

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

the class CmdHistoryClient method doLog.

@Override
public void doLog(@NotNull SvnTarget target, @NotNull SVNRevision startRevision, @NotNull SVNRevision endRevision, boolean stopOnCopy, boolean discoverChangedPaths, boolean includeMergedRevisions, long limit, @Nullable String[] revisionProperties, @Nullable LogEntryConsumer handler) throws VcsException {
    // TODO: add revision properties parameter if necessary
    List<String> parameters = prepareCommand(target, startRevision, endRevision, stopOnCopy, discoverChangedPaths, includeMergedRevisions, limit);
    try {
        CommandExecutor command = execute(myVcs, target, SvnCommandName.log, parameters, null);
        // 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
        parseOutput(command, handler);
    } catch (SVNException e) {
        throw new SvnBindException(e);
    }
}
Also used : SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) CommandExecutor(org.jetbrains.idea.svn.commandLine.CommandExecutor) SVNException(org.tmatesoft.svn.core.SVNException)

Example 9 with CommandExecutor

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

the class CmdDiffClient method compare.

@NotNull
@Override
public List<Change> compare(@NotNull SvnTarget target1, @NotNull SvnTarget target2) throws VcsException {
    assertUrl(target1);
    if (target2.isFile()) {
        // Such combination (file and url) with "--summarize" option is supported only in svn 1.8.
        // For svn 1.7 "--summarize" is only supported when both targets are repository urls.
        assertDirectory(target2);
        WorkingCopyFormat format = WorkingCopyFormat.from(myFactory.createVersionClient().getVersion());
        if (format.less(WorkingCopyFormat.ONE_DOT_EIGHT)) {
            throw new SvnBindException("Could not compare local file and remote url with executable for svn " + format);
        }
    }
    List<String> parameters = new ArrayList<>();
    CommandUtil.put(parameters, target1);
    CommandUtil.put(parameters, target2);
    parameters.add("--xml");
    parameters.add("--summarize");
    CommandExecutor executor = execute(myVcs, target1, SvnCommandName.diff, parameters, null);
    return parseOutput(target1, target2, executor);
}
Also used : SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) WorkingCopyFormat(org.jetbrains.idea.svn.WorkingCopyFormat) ArrayList(java.util.ArrayList) CommandExecutor(org.jetbrains.idea.svn.commandLine.CommandExecutor) NotNull(org.jetbrains.annotations.NotNull)

Example 10 with CommandExecutor

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

the class CmdDiffClient method unifiedDiff.

@Override
public void unifiedDiff(@NotNull SvnTarget target1, @NotNull SvnTarget target2, @NotNull OutputStream output) throws VcsException {
    assertUrl(target1);
    assertUrl(target2);
    List<String> parameters = ContainerUtil.newArrayList();
    CommandUtil.put(parameters, target1);
    CommandUtil.put(parameters, target2);
    CommandExecutor executor = execute(myVcs, target1, SvnCommandName.diff, parameters, null);
    try {
        executor.getBinaryOutput().writeTo(output);
    } catch (IOException e) {
        throw new SvnBindException(e);
    }
}
Also used : SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) CommandExecutor(org.jetbrains.idea.svn.commandLine.CommandExecutor) IOException(java.io.IOException)

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