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;
}
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();
}
}
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);
}
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);
}
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;
}
Aggregations