Search in sources :

Example 1 with SVNURL

use of org.tmatesoft.svn.core.SVNURL in project intellij-community by JetBrains.

the class UrlSerializationHelper method serializeUrl.

private static String serializeUrl(final String url, final Ref<Boolean> withUserInfo) {
    if (Boolean.FALSE.equals(withUserInfo.get())) {
        return url;
    }
    try {
        final SVNURL svnurl = SVNURL.parseURIEncoded(url);
        if (withUserInfo.isNull()) {
            final String userInfo = svnurl.getUserInfo();
            withUserInfo.set((userInfo != null) && (userInfo.length() > 0));
        }
        if (withUserInfo.get()) {
            return SVNURL.create(svnurl.getProtocol(), null, svnurl.getHost(), SvnUtil.resolvePort(svnurl), svnurl.getURIEncodedPath(), true).toString();
        }
    } catch (SVNException e) {
    //
    }
    return url;
}
Also used : SVNURL(org.tmatesoft.svn.core.SVNURL) SVNException(org.tmatesoft.svn.core.SVNException)

Example 2 with SVNURL

use of org.tmatesoft.svn.core.SVNURL in project intellij-community by JetBrains.

the class SvnAuthenticationManager method acknowledgeForSSL.

public void acknowledgeForSSL(boolean accepted, SVNAuthentication proxy) {
    if (accepted && proxy instanceof SVNSSLAuthentication && (((SVNSSLAuthentication) proxy).getCertificateFile() != null)) {
        final SVNSSLAuthentication svnsslAuthentication = (SVNSSLAuthentication) proxy;
        final SVNURL url = svnsslAuthentication.getURL();
        final IdeaSVNHostOptionsProvider provider = getHostOptionsProvider();
        final SVNCompositeConfigFile serversFile = provider.getServersFile();
        String groupName = getGroupName(serversFile.getProperties("groups"), url.getHost());
        groupName = StringUtil.isEmptyOrSpaces(groupName) ? "global" : groupName;
        serversFile.setPropertyValue(groupName, SvnServerFileKeys.SSL_CLIENT_CERT_FILE, svnsslAuthentication.getCertificateFile().getPath(), true);
        serversFile.save();
    }
}
Also used : SVNURL(org.tmatesoft.svn.core.SVNURL)

Example 3 with SVNURL

use of org.tmatesoft.svn.core.SVNURL in project intellij-community by JetBrains.

the class SvnAuthenticationNotifier method ensureNotify.

@Override
public boolean ensureNotify(AuthenticationRequest obj) {
    final SVNURL key = getKey(obj);
    myCopiesPassiveResults.remove(key);
    /*VcsBalloonProblemNotifier.showOverChangesView(myVcs.getProject(), "You are not authenticated to '" + obj.getRealm() + "'." +
      "To login, see pending notifications.", MessageType.ERROR);*/
    return super.ensureNotify(obj);
}
Also used : SVNURL(org.tmatesoft.svn.core.SVNURL)

Example 4 with SVNURL

use of org.tmatesoft.svn.core.SVNURL in project intellij-community by JetBrains.

the class SvnAuthenticationNotifier method onStateChangedToSuccess.

private void onStateChangedToSuccess(final AuthenticationRequest obj) {
    myCopiesPassiveResults.put(getKey(obj), true);
    myVcs.invokeRefreshSvnRoots();
    final List<SVNURL> outdatedRequests = new LinkedList<>();
    final Collection<SVNURL> keys = getAllCurrentKeys();
    for (SVNURL key : keys) {
        final SVNURL commonURLAncestor = SVNURLUtil.getCommonURLAncestor(key, obj.getUrl());
        if ((commonURLAncestor != null) && (!StringUtil.isEmptyOrSpaces(commonURLAncestor.getHost())) && (!StringUtil.isEmptyOrSpaces(commonURLAncestor.getPath()))) {
            //final AuthenticationRequest currObj = getObj(key);
            //if ((currObj != null) && passiveValidation(myVcs.getProject(), key, true, currObj.getRealm(), currObj.getKind())) {
            outdatedRequests.add(key);
        //}
        }
    }
    log("on state changed ");
    ApplicationManager.getApplication().invokeLater(() -> {
        for (SVNURL key : outdatedRequests) {
            removeLazyNotificationByKey(key);
        }
    }, ModalityState.NON_MODAL);
}
Also used : SVNURL(org.tmatesoft.svn.core.SVNURL)

Example 5 with SVNURL

use of org.tmatesoft.svn.core.SVNURL in project intellij-community by JetBrains.

the class SvnAnnotationProvider method annotateNonExisting.

private SvnRemoteFileAnnotation annotateNonExisting(Pair<SvnChangeList, FilePath> pair, VcsFileRevision revision, Info info, Charset charset, final VirtualFile current) throws VcsException, SVNException, IOException {
    final File wasFile = pair.getSecond().getIOFile();
    final File root = getCommonAncestor(wasFile, info.getFile());
    if (root == null) {
        throw new VcsException("Can not find relative path for " + wasFile.getPath() + "@" + revision.getRevisionNumber().asString());
    }
    final String relativePath = FileUtil.getRelativePath(root.getPath(), wasFile.getPath(), File.separatorChar);
    if (relativePath == null) {
        throw new VcsException("Can not find relative path for " + wasFile.getPath() + "@" + revision.getRevisionNumber().asString());
    }
    Info wcRootInfo = myVcs.getInfo(root);
    if (wcRootInfo == null || wcRootInfo.getURL() == null) {
        throw new VcsException("Can not find relative path for " + wasFile.getPath() + "@" + revision.getRevisionNumber().asString());
    }
    SVNURL wasUrl = wcRootInfo.getURL();
    final String[] strings = relativePath.replace('\\', '/').split("/");
    for (String string : strings) {
        wasUrl = wasUrl.appendPath(string, true);
    }
    final SVNRevision svnRevision = ((SvnRevisionNumber) revision.getRevisionNumber()).getRevision();
    byte[] data = SvnUtil.getFileContents(myVcs, SvnTarget.fromURL(wasUrl), svnRevision, svnRevision);
    final String contents = LoadTextUtil.getTextByBinaryPresentation(data, charset == null ? CharsetToolkit.UTF8_CHARSET : charset).toString();
    final SvnRemoteFileAnnotation result = new SvnRemoteFileAnnotation(myVcs, contents, revision.getRevisionNumber(), current);
    final AnnotationConsumer annotateHandler = createAnnotationHandler(ProgressManager.getInstance().getProgressIndicator(), result);
    boolean calculateMergeinfo = myVcs.getSvnConfiguration().isShowMergeSourcesInAnnotate() && SvnUtil.checkRepositoryVersion15(myVcs, wasUrl.toString());
    AnnotateClient client = myVcs.getFactory().createAnnotateClient();
    client.annotate(SvnTarget.fromURL(wasUrl, svnRevision), SVNRevision.create(1), svnRevision, calculateMergeinfo, getLogClientOptions(myVcs), annotateHandler);
    return result;
}
Also used : SVNURL(org.tmatesoft.svn.core.SVNURL) Info(org.jetbrains.idea.svn.info.Info) VcsException(com.intellij.openapi.vcs.VcsException) SVNRevision(org.tmatesoft.svn.core.wc.SVNRevision) VirtualFile(com.intellij.openapi.vfs.VirtualFile) VfsUtilCore.virtualToIoFile(com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile) File(java.io.File)

Aggregations

SVNURL (org.tmatesoft.svn.core.SVNURL)101 SVNException (org.tmatesoft.svn.core.SVNException)40 File (java.io.File)32 SVNConfigFile (org.tmatesoft.svn.core.internal.wc.SVNConfigFile)15 VirtualFile (com.intellij.openapi.vfs.VirtualFile)13 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)8 SVNRevision (org.tmatesoft.svn.core.wc.SVNRevision)8 VcsException (com.intellij.openapi.vcs.VcsException)7 Nullable (org.jetbrains.annotations.Nullable)7 SvnTarget (org.tmatesoft.svn.core.wc2.SvnTarget)7 ArrayList (java.util.ArrayList)6 NotNull (org.jetbrains.annotations.NotNull)6 Info (org.jetbrains.idea.svn.info.Info)6 SvnBindException (org.jetbrains.idea.svn.commandLine.SvnBindException)5 FilePath (com.intellij.openapi.vcs.FilePath)4 SvnVcs (org.jetbrains.idea.svn.SvnVcs)3 SvnAuthenticationManager (org.jetbrains.idea.svn.auth.SvnAuthenticationManager)3 SVNDirEntry (org.tmatesoft.svn.core.SVNDirEntry)3 DefaultSVNOptions (org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions)3 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)2