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(); }
@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(); }
@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; } }
@Override protected void load() { String relativeUrl = myUrl; final SVNURL repoRootURL = myInfo.getRepositoryRootURL(); final String root = repoRootURL.toString(); if (myUrl != null && myUrl.startsWith(root)) { relativeUrl = myUrl.substring(root.length()); } if (myPI != null) { myPI.setText2(SvnBundle.message("progress.text2.changes.establishing.connection", myUrl)); } final SVNRevision pegRevision = myInfo.getRevision(); final SvnTarget target = SvnTarget.fromFile(myFile.getIOFile(), myPeg); try { myVcs .getFactory(target) .createHistoryClient() .doLog( target, myFrom == null ? SVNRevision.HEAD : myFrom, myTo == null ? SVNRevision.create(1) : myTo, false, true, myShowMergeSources && mySupport15, myLimit + 1, null, new MyLogEntryHandler( myVcs, myUrl, pegRevision, relativeUrl, createConsumerAdapter(myConsumer), repoRootURL, myFile.getCharset())); } catch (SVNCancelException e) { // } catch (SVNException e) { myException = new VcsException(e); } catch (VcsException e) { myException = e; } }
private void loadBackwards(SVNURL svnurl) throws SVNException, VcsException { // this method is called when svnurl does not exist in latest repository revision - thus // concrete old revision is used for "info" // command to get repository url Info info = myVcs.getInfo(svnurl, myPeg, myPeg); final SVNURL rootURL = info != null ? info.getRepositoryRootURL() : null; final String root = rootURL != null ? rootURL.toString() : ""; String relativeUrl = myUrl; if (myUrl.startsWith(root)) { relativeUrl = myUrl.substring(root.length()); } final RepositoryLogEntryHandler repositoryLogEntryHandler = new RepositoryLogEntryHandler( myVcs, myUrl, SVNRevision.UNDEFINED, relativeUrl, new ThrowableConsumer<VcsFileRevision, SVNException>() { @Override public void consume(VcsFileRevision revision) throws SVNException { myConsumer.consume(revision); } }, rootURL); repositoryLogEntryHandler.setThrowCancelOnMeetPathCreation(true); SvnTarget target = SvnTarget.fromURL(rootURL, myFrom); myVcs .getFactory(target) .createHistoryClient() .doLog( target, myFrom, myTo == null ? SVNRevision.create(1) : myTo, false, true, myShowMergeSources && mySupport15, 1, null, repositoryLogEntryHandler); }