private void collectLogEntries( final ProgressIndicator indicator, FilePath file, VcsException[] exception, final Consumer<VcsFileRevision> result, final Ref<Boolean> supports15Ref) throws SVNException, VcsException { SVNWCClient wcClient = myVcs.createWCClient(); SVNInfo info = wcClient.doInfo(new File(file.getIOFile().getAbsolutePath()), SVNRevision.UNDEFINED); wcClient.setEventHandler( new ISVNEventHandler() { public void handleEvent(SVNEvent event, double progress) throws SVNException {} public void checkCancelled() throws SVNCancelException { indicator.checkCanceled(); } }); if (info == null || info.getRepositoryRootURL() == null) { exception[0] = new VcsException("File ''{0}'' is not under version control" + file.getIOFile()); return; } final String url = info.getURL() == null ? null : info.getURL().toString(); String relativeUrl = url; final SVNURL repoRootURL = info.getRepositoryRootURL(); final String root = repoRootURL.toString(); if (url != null && url.startsWith(root)) { relativeUrl = url.substring(root.length()); } if (indicator != null) { indicator.setText2(SvnBundle.message("progress.text2.changes.establishing.connection", url)); } final SVNRevision pegRevision = info.getRevision(); SVNLogClient client = myVcs.createLogClient(); final boolean supports15 = SvnUtil.checkRepositoryVersion15(myVcs, url); supports15Ref.set(supports15); client.doLog( new File[] {new File(file.getIOFile().getAbsolutePath())}, SVNRevision.HEAD, SVNRevision.create(1), SVNRevision.UNDEFINED, false, true, supports15, 0, null, new MyLogEntryHandler( myVcs, url, pegRevision, relativeUrl, result, repoRootURL, file.getCharset())); }
@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(); SVNLogClient client = myVcs.createLogClient(); try { client.doLog( new File[] {new File(myFile.getIOFile().getAbsolutePath())}, SVNRevision.HEAD, SVNRevision.create(1), SVNRevision.UNDEFINED, false, true, mySupport15, 0, null, new MyLogEntryHandler( myVcs, myUrl, pegRevision, relativeUrl, myConsumer, repoRootURL, myFile.getCharset())); } catch (SVNCancelException e) { // } catch (SVNException e) { myException = new VcsException(e); } catch (VcsException e) { myException = e; } }
@Nullable private VcsRevisionNumber getCurrentRevision(FilePath file) { if (file.isNonLocal()) { // technically, it does not make sense, since there's no "current" revision for non-local // history (if look how it's used) // but ok, lets keep it for now return new SvnRevisionNumber(SVNRevision.HEAD); } try { SVNWCClient wcClient = myVcs.createWCClient(); SVNInfo info = wcClient.doInfo(new File(file.getPath()).getAbsoluteFile(), SVNRevision.UNDEFINED); if (info != null) { return new SvnRevisionNumber(info.getRevision()); } else { return null; } } catch (SVNException e) { return null; } }