Search in sources :

Example 21 with Info

use of org.jetbrains.idea.svn.info.Info in project intellij-community by JetBrains.

the class SvnUpdateEnvironment method checkAncestry.

// false - do not do update
private boolean checkAncestry(final File sourceFile, final SVNURL targetUrl, final SVNRevision targetRevision) throws SvnBindException {
    final Info sourceSvnInfo = myVcs.getInfo(sourceFile);
    final Info targetSvnInfo = myVcs.getInfo(targetUrl, targetRevision);
    if (sourceSvnInfo == null || targetSvnInfo == null) {
        // cannot check
        return true;
    }
    final SVNURL copyFromTarget = targetSvnInfo.getCopyFromURL();
    final SVNURL copyFromSource = sourceSvnInfo.getCopyFromURL();
    if ((copyFromSource != null) || (copyFromTarget != null)) {
        if (sourceSvnInfo.getURL().equals(copyFromTarget) || targetUrl.equals(copyFromSource)) {
            return true;
        }
    }
    final int result = Messages.showYesNoDialog(myVcs.getProject(), SvnBundle.message("switch.target.not.copy.current"), SvnBundle.message("switch.target.problem.title"), Messages.getWarningIcon());
    return (Messages.YES == result);
}
Also used : SVNURL(org.tmatesoft.svn.core.SVNURL) Info(org.jetbrains.idea.svn.info.Info)

Example 22 with Info

use of org.jetbrains.idea.svn.info.Info in project intellij-community by JetBrains.

the class LatestExistentSearcher method detectStartRevision.

private boolean detectStartRevision() {
    if (!myStartExistsKnown) {
        final SvnFileUrlMapping mapping = myVcs.getSvnFileUrlMapping();
        final RootUrlInfo rootUrlInfo = mapping.getWcRootForUrl(myUrl.toString());
        if (rootUrlInfo == null)
            return true;
        final VirtualFile vf = rootUrlInfo.getVirtualFile();
        final Info info = myVcs.getInfo(vf);
        if ((info == null) || (info.getRevision() == null)) {
            return false;
        }
        myStartNumber = info.getRevision().getNumber();
        myStartExistsKnown = true;
    }
    return true;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) SvnFileUrlMapping(org.jetbrains.idea.svn.SvnFileUrlMapping) RootUrlInfo(org.jetbrains.idea.svn.RootUrlInfo) RootUrlInfo(org.jetbrains.idea.svn.RootUrlInfo) Info(org.jetbrains.idea.svn.info.Info)

Example 23 with Info

use of org.jetbrains.idea.svn.info.Info 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 24 with Info

use of org.jetbrains.idea.svn.info.Info in project intellij-community by JetBrains.

the class SvnRollbackEnvironment method revertFileOrDir.

private void revertFileOrDir(@NotNull FilePath filePath) throws SVNException, VcsException {
    File file = filePath.getIOFile();
    Info info = mySvnVcs.getInfo(file);
    if (info != null) {
        if (info.isFile()) {
            doRevert(file, false);
        } else if (Info.SCHEDULE_ADD.equals(info.getSchedule()) || is17OrGreaterCopy(file, info)) {
            doRevert(file, true);
        } else {
            // do update to restore missing directory.
            mySvnVcs.getSvnKitManager().createUpdateClient().doUpdate(file, SVNRevision.HEAD, true);
        }
    } else {
        throw new VcsException("Can not get 'svn info' for " + file.getPath());
    }
}
Also used : VcsException(com.intellij.openapi.vcs.VcsException) Info(org.jetbrains.idea.svn.info.Info) File(java.io.File)

Example 25 with Info

use of org.jetbrains.idea.svn.info.Info in project intellij-community by JetBrains.

the class CmdStatusClient method doStatus.

@Override
public long doStatus(@NotNull final File path, @Nullable final SVNRevision revision, @NotNull final Depth depth, boolean remote, boolean reportAll, boolean includeIgnored, boolean collectParentExternals, @NotNull final StatusConsumer handler, @Nullable final Collection changeLists) throws SvnBindException {
    File base = CommandUtil.requireExistingParent(path);
    final Info infoBase = myFactory.createInfoClient().doInfo(base, revision);
    List<String> parameters = new ArrayList<>();
    putParameters(parameters, path, depth, remote, reportAll, includeIgnored, changeLists);
    CommandExecutor command = execute(myVcs, SvnTarget.fromFile(path), SvnCommandName.st, parameters, null);
    parseResult(path, revision, handler, base, infoBase, command);
    return 0;
}
Also used : Info(org.jetbrains.idea.svn.info.Info) File(java.io.File)

Aggregations

Info (org.jetbrains.idea.svn.info.Info)32 File (java.io.File)18 VirtualFile (com.intellij.openapi.vfs.VirtualFile)11 VcsException (com.intellij.openapi.vcs.VcsException)6 NotNull (org.jetbrains.annotations.NotNull)6 SVNURL (org.tmatesoft.svn.core.SVNURL)6 SVNRevision (org.tmatesoft.svn.core.wc.SVNRevision)6 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)5 RootUrlInfo (org.jetbrains.idea.svn.RootUrlInfo)5 IOException (java.io.IOException)3 Nullable (org.jetbrains.annotations.Nullable)3 Test (org.junit.Test)3 SVNException (org.tmatesoft.svn.core.SVNException)3 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)2 FilePath (com.intellij.openapi.vcs.FilePath)2 ArrayList (java.util.ArrayList)2 SvnVcs (org.jetbrains.idea.svn.SvnVcs)2 SvnBindException (org.jetbrains.idea.svn.commandLine.SvnBindException)2 WCInfo (org.jetbrains.idea.svn.dialogs.WCInfo)2 SvnChangeList (org.jetbrains.idea.svn.history.SvnChangeList)2