@Override protected void preliminary() throws SVNException { myInfo = myVcs.getInfo(myFile.getIOFile()); if (myInfo == null || myInfo.getRepositoryRootURL() == null) { myException = new VcsException("File " + myFile.getPath() + " is not under version control"); return; } if (myInfo.getURL() == null) { myException = new VcsException("File " + myFile.getPath() + " is not under Subversion control"); return; } myUrl = myInfo.getURL().toDecodedString(); }
private boolean existsNow(SVNURL svnurl) { final Info info; try { info = myVcs.getInfo(svnurl, SVNRevision.HEAD, SVNRevision.HEAD); } catch (SvnBindException e) { return false; } return info != null && info.getURL() != null && info.getRevision().isValid(); }
@Nullable public static SvnBranchConfigurationNew loadDefaultConfiguration( final Project project, final VirtualFile vcsRoot) { try { final SvnVcs vcs = SvnVcs.getInstance(project); File rootFile = new File(vcsRoot.getPath()); final Info info = vcs.getInfo(rootFile); if (info == null || info.getURL() == null) { LOG.info("Directory is not a working copy: " + vcsRoot.getPresentableUrl()); return null; } SVNURL baseUrl = info.getURL(); final SvnBranchConfigurationNew result = new SvnBranchConfigurationNew(); result.setTrunkUrl(baseUrl.toString()); while (true) { final String s = SVNPathUtil.tail(baseUrl.getPath()); if (s.equalsIgnoreCase(DEFAULT_TRUNK_NAME) || s.equalsIgnoreCase(DEFAULT_BRANCHES_NAME) || s.equalsIgnoreCase(DEFAULT_TAGS_NAME)) { SVNURL rootPath = baseUrl.removePathTail(); SvnTarget target = SvnTarget.fromURL(rootPath); vcs.getFactory(target) .createBrowseClient() .list(target, SVNRevision.HEAD, Depth.IMMEDIATES, createHandler(result, rootPath)); break; } if (SVNPathUtil.removeTail(baseUrl.getPath()).length() == 0) { break; } baseUrl = baseUrl.removePathTail(); } return result; } catch (SVNException e) { LOG.info(e); return null; } catch (VcsException e) { LOG.info(e); return null; } }