Search in sources :

Example 21 with SvnBindException

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

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

the class LatestExistentSearcher method existsInRevision.

private boolean existsInRevision(@NotNull SVNURL url, long revisionNumber) throws SvnBindException {
    SVNRevision revision = SVNRevision.create(revisionNumber);
    Info info = null;
    try {
        info = myVcs.getInfo(url, revision, revision);
    } catch (SvnBindException e) {
        // throw error if not "does not exist" error code
        if (!e.contains(SVNErrorCode.RA_ILLEGAL_URL)) {
            throw e;
        }
    }
    return info != null;
}
Also used : SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) SVNRevision(org.tmatesoft.svn.core.wc.SVNRevision) RootUrlInfo(org.jetbrains.idea.svn.RootUrlInfo) Info(org.jetbrains.idea.svn.info.Info)

Example 23 with SvnBindException

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

the class CmdDiffClient method createChange.

@NotNull
private Change createChange(@NotNull SvnTarget target1, @NotNull SvnTarget target2, @NotNull DiffPath diffPath) throws SvnBindException {
    // TODO: 1) Unify logic of creating Change instance with SvnDiffEditor and SvnChangeProviderContext
    // TODO: 2) If some directory is switched, files inside it are returned as modified in "svn diff --summarize", even if they are equal
    // TODO: to branch files by content - possibly add separate processing of all switched files
    // TODO: 3) Properties change is currently not added as part of result change like in SvnChangeProviderContext.patchWithPropertyChange
    SvnTarget subTarget1 = SvnUtil.append(target1, diffPath.path, true);
    String relativePath = SvnUtil.getRelativeUrl(SvnUtil.toDecodedString(target1), SvnUtil.toDecodedString(subTarget1));
    if (relativePath == null) {
        throw new SvnBindException("Could not get relative path for " + target1 + " and " + subTarget1);
    }
    SvnTarget subTarget2 = SvnUtil.append(target2, FileUtil.toSystemIndependentName(relativePath));
    FilePath target1Path = createFilePath(subTarget1, diffPath.isDirectory());
    FilePath target2Path = createFilePath(subTarget2, diffPath.isDirectory());
    FileStatus status = SvnStatusConvertor.convertStatus(SvnStatusHandler.getStatus(diffPath.itemStatus), SvnStatusHandler.getStatus(diffPath.propertiesStatus));
    // statuses determine changes needs to be done to "target1" to get "target2" state
    ContentRevision beforeRevision = status == FileStatus.ADDED ? null : createRevision(target1Path, target2Path, target1.getPegRevision(), status);
    ContentRevision afterRevision = status == FileStatus.DELETED ? null : createRevision(target2Path, target1Path, target2.getPegRevision(), status);
    return createChange(status, beforeRevision, afterRevision);
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) SvnBindException(org.jetbrains.idea.svn.commandLine.SvnBindException) FileStatus(com.intellij.openapi.vcs.FileStatus) SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) CurrentContentRevision(com.intellij.openapi.vcs.changes.CurrentContentRevision) SvnRepositoryContentRevision(org.jetbrains.idea.svn.history.SvnRepositoryContentRevision) ContentRevision(com.intellij.openapi.vcs.changes.ContentRevision) NotNull(org.jetbrains.annotations.NotNull)

Example 24 with SvnBindException

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

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

SvnBindException (org.jetbrains.idea.svn.commandLine.SvnBindException)32 SVNException (org.tmatesoft.svn.core.SVNException)13 NotNull (org.jetbrains.annotations.NotNull)7 VirtualFile (com.intellij.openapi.vfs.VirtualFile)6 File (java.io.File)6 CommandExecutor (org.jetbrains.idea.svn.commandLine.CommandExecutor)5 SVNURL (org.tmatesoft.svn.core.SVNURL)5 FilePath (com.intellij.openapi.vcs.FilePath)4 VcsException (com.intellij.openapi.vcs.VcsException)4 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)4 IOException (java.io.IOException)4 SVNRevision (org.tmatesoft.svn.core.wc.SVNRevision)4 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)3 Change (com.intellij.openapi.vcs.changes.Change)3 ContentRevision (com.intellij.openapi.vcs.changes.ContentRevision)3 ArrayList (java.util.ArrayList)3 ConfigurationException (com.intellij.openapi.options.ConfigurationException)2 Ref (com.intellij.openapi.util.Ref)2 FileStatus (com.intellij.openapi.vcs.FileStatus)2 Nullable (org.jetbrains.annotations.Nullable)2