use of org.tmatesoft.svn.core.SVNURL in project intellij-community by JetBrains.
the class SvnVcs method filterUniqueRoots.
@Override
public <S> List<S> filterUniqueRoots(final List<S> in, final Convertor<S, VirtualFile> convertor) {
if (in.size() <= 1)
return in;
final List<MyPair<S>> infos = new ArrayList<>(in.size());
final SvnFileUrlMappingImpl mapping = (SvnFileUrlMappingImpl) getSvnFileUrlMapping();
final List<S> notMatched = new LinkedList<>();
for (S s : in) {
final VirtualFile vf = convertor.convert(s);
if (vf == null)
continue;
final File ioFile = virtualToIoFile(vf);
SVNURL url = mapping.getUrlForFile(ioFile);
if (url == null) {
url = SvnUtil.getUrl(this, ioFile);
if (url == null) {
notMatched.add(s);
continue;
}
}
infos.add(new MyPair<>(vf, url.toString(), s));
}
final List<MyPair<S>> filtered = new UniqueRootsFilter().filter(infos);
final List<S> converted = ObjectsConvertor.convert(filtered, o -> o.getSrc());
if (!notMatched.isEmpty()) {
// potential bug is here: order is not kept. but seems it only occurs for cases where result is sorted after filtering so ok
converted.addAll(notMatched);
}
return converted;
}
use of org.tmatesoft.svn.core.SVNURL in project intellij-community by JetBrains.
the class SvnRootsDetector method registerRootUrlFromNestedPoint.
private void registerRootUrlFromNestedPoint(@NotNull NestedCopyInfo info, @NotNull List<RootUrlInfo> nestedRoots) {
// TODO: Seems there could be issues if myTopRoots contains nested roots => RootUrlInfo.myRoot could be incorrect
// TODO: (not nearest ancestor) for new RootUrlInfo
RootUrlInfo topRoot = findAncestorTopRoot(info.getFile());
if (topRoot != null) {
SVNURL repoRoot = info.getRootURL();
repoRoot = repoRoot == null ? myRepositoryRoots.ask(info.getUrl(), info.getFile()) : repoRoot;
if (repoRoot != null) {
Node node = new Node(info.getFile(), info.getUrl(), repoRoot);
nestedRoots.add(new RootUrlInfo(node, info.getFormat(), topRoot.getRoot(), info.getType()));
}
}
}
use of org.tmatesoft.svn.core.SVNURL in project intellij-community by JetBrains.
the class SvnUtil method appendMultiParts.
public static SVNURL appendMultiParts(@NotNull final SVNURL base, @NotNull final String subPath) throws SVNException {
if (StringUtil.isEmpty(subPath))
return base;
final List<String> parts = StringUtil.split(subPath.replace('\\', '/'), "/", true);
SVNURL result = base;
for (String part : parts) {
result = result.appendPath(part, false);
}
return result;
}
use of org.tmatesoft.svn.core.SVNURL in project intellij-community by JetBrains.
the class SvnTestInteractiveAuthentication method requestClientAuthentication.
@Override
public SVNAuthentication requestClientAuthentication(String kind, SVNURL url, String realm, SVNErrorMessage errorMessage, SVNAuthentication previousAuth, boolean authMayBeStored) {
authMayBeStored = authMayBeStored && mySaveData;
Convertor<SVNURL, SVNAuthentication> convertor = myData.get(kind);
SVNAuthentication result = convertor == null ? null : convertor.convert(url);
if (result == null) {
if (ISVNAuthenticationManager.USERNAME.equals(kind)) {
result = new SVNUserNameAuthentication("username", authMayBeStored);
} else if (ISVNAuthenticationManager.PASSWORD.equals(kind)) {
result = new SVNPasswordAuthentication("username", "abc", authMayBeStored, url, false);
} else if (ISVNAuthenticationManager.SSH.equals(kind)) {
result = new SVNSSHAuthentication("username", "abc", -1, authMayBeStored, url, false);
} else if (ISVNAuthenticationManager.SSL.equals(kind)) {
result = new SVNSSLAuthentication(new File("aaa"), "abc", authMayBeStored, url, false);
}
}
if (!ISVNAuthenticationManager.USERNAME.equals(kind)) {
myManager.requested(ProviderType.interactive, url, realm, kind, result == null);
}
return result;
}
use of org.tmatesoft.svn.core.SVNURL in project intellij-community by JetBrains.
the class RepositoryBrowserDialog method doCheckout.
protected void doCheckout(@Nullable final CheckoutProvider.Listener listener, final RepositoryTreeNode selectedNode) {
if (selectedNode == null) {
return;
}
SVNURL url = selectedNode.getURL();
String relativePath = "";
final DirectoryEntry entry = selectedNode.getSVNDirEntry();
if (entry != null) {
if (entry.getRepositoryRoot() != null) {
if (!entry.getRepositoryRoot().equals(url)) {
relativePath = SVNPathUtil.getRelativePath(entry.getRepositoryRoot().toString(), url.toDecodedString());
}
} else {
relativePath = entry.getRelativePath();
}
} else {
relativePath = url.getPath();
}
File dir = selectFile(SvnBundle.message("svn.checkout.destination.directory.title"), SvnBundle.message("svn.checkout.destination.directory.description"));
if (dir == null) {
return;
}
Project p = myProject;
CheckoutOptionsDialog dialog = new CheckoutOptionsDialog(p, url, dir, SvnUtil.getVirtualFile(dir.getAbsolutePath()), relativePath);
dialog.show();
dir = dialog.getTarget();
if (dialog.isOK() && dir != null) {
final SVNRevision revision;
try {
revision = dialog.getRevision();
} catch (ConfigurationException e) {
Messages.showErrorDialog(SvnBundle.message("message.text.cannot.checkout", e.getMessage()), SvnBundle.message("message.title.check.out"));
return;
}
SvnCheckoutProvider.doCheckout(myProject, dir, url.toString(), revision, dialog.getDepth(), dialog.isIgnoreExternals(), listener);
}
}
Aggregations