@Override public Optional<String> download(SVNRepository repository, String path) { try { ByteArrayOutputStream out = new ByteArrayOutputStream(); getWCClient(repository).doGetFileContents( SVNUtils.toURL(repository.getUrl(path)), SVNRevision.HEAD, SVNRevision.HEAD, false, out ); return Optional.of( IOUtils.toString(out.toByteArray(), "UTF-8") ); } catch (SVNException | IOException ex) { return Optional.empty(); } }
@Override public C execute(final SVNRepository repo, final SVNClientManager clientManager) throws Exception { final Long revision = parseRevisionOrDie(version); // use raw repo to check if the path exists final SVNNodeKind nodeType = repo.checkPath(path, revision); if (SVNNodeKind.NONE.equals(nodeType)) { LOGGER.warn(repo.getLocation() + "/" + path + " @r" + revision + " is SVNNodeKind.NONE returning " + defaultValue); return defaultValue; } final SVNWCClient client = clientManager.getWCClient(); final SVNURL url = svnUrl.appendPath(path, true); final SVNRevision svnRevision = SVNRevision.create(revision); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); client.doGetFileContents(url, svnRevision, svnRevision, /* expandKeywords */ false, baos); final C testDefinition = objectMapper.readValue(baos.toByteArray(), c); try { baos.close(); } catch (IOException e) { /* ignore */ } return testDefinition; }
@Override public C execute(final SVNRepository repo, final SVNClientManager clientManager) throws Exception { final Long revision = parseRevisionOrDie(version); // use raw repo to check if the path exists final SVNNodeKind nodeType = repo.checkPath(path, revision); if (SVNNodeKind.NONE.equals(nodeType)) { LOGGER.warn(repo.getLocation() + "/" + path + " @r" + revision + " is SVNNodeKind.NONE returning " + defaultValue); return defaultValue; } final SVNWCClient client = clientManager.getWCClient(); final SVNURL url = svnUrl.appendPath(path, true); final SVNRevision svnRevision = SVNRevision.create(revision); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); client.doGetFileContents(url, svnRevision, svnRevision, /* expandKeywords */ false, baos); final C testDefinition = objectMapper.readValue(baos.toByteArray(), c); try { baos.close(); } catch (IOException e) { /* ignore */ } return testDefinition; }
public byte[] fileContent(String path, Revision revision, Revision pegRevision) throws ClientException { SVNWCClient client = getSVNWCClient(); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); if(isURL(path)){ client.doGetFileContents(SVNURL.parseURIEncoded(path), JavaHLObjectFactory.getSVNRevision(pegRevision), JavaHLObjectFactory.getSVNRevision(revision), true, baos); }else{ client.doGetFileContents(new File(path).getAbsoluteFile(), JavaHLObjectFactory.getSVNRevision(pegRevision), JavaHLObjectFactory.getSVNRevision(revision), true, baos); } return baos.toByteArray(); } catch (SVNException e) { throwException(e); } return null; }
public byte[] fileContent(String path, Revision revision, Revision pegRevision) throws ClientException { SVNWCClient client = getSVNWCClient(); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); if (isURL(path)) { client.doGetFileContents(SVNURL.parseURIEncoded(path), JavaHLObjectFactory.getSVNRevision(pegRevision), JavaHLObjectFactory.getSVNRevision(revision), true, baos); } else { client.doGetFileContents(new File(path).getAbsoluteFile(), JavaHLObjectFactory.getSVNRevision(pegRevision), JavaHLObjectFactory.getSVNRevision(revision), true, baos); } return baos.toByteArray(); } catch (SVNException e) { throwException(e); } finally { resetLog(); } return null; }
public void streamFileContent(String path, Revision revision, Revision pegRevision, int bufferSize, OutputStream stream) throws ClientException { SVNWCClient client = getSVNWCClient(); try { if(isURL(path)){ client.doGetFileContents(SVNURL.parseURIEncoded(path), JavaHLObjectFactory.getSVNRevision(pegRevision), JavaHLObjectFactory.getSVNRevision(revision), true, stream); }else{ client.doGetFileContents(new File(path).getAbsoluteFile(), JavaHLObjectFactory.getSVNRevision(pegRevision), JavaHLObjectFactory.getSVNRevision(revision), true, stream); } } catch (SVNException e) { throwException(e); } }
public byte[] fileContent(String path, Revision revision, Revision pegRevision) throws ClientException { SVNWCClient client = getSVNWCClient(); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); if (isURL(path)) { client.doGetFileContents(SVNURL.parseURIEncoded(path), JavaHLObjectFactory.getSVNRevision(pegRevision), JavaHLObjectFactory.getSVNRevision(revision), true, baos); } else { client.doGetFileContents(new File(path).getAbsoluteFile(), JavaHLObjectFactory.getSVNRevision(pegRevision), JavaHLObjectFactory.getSVNRevision(revision), true, baos); } return baos.toByteArray(); } catch (SVNException e) { throwException(e); } finally { resetLog(); } return null; }
public byte[] fileContent(String path, Revision revision, Revision pegRevision) throws ClientException { SVNWCClient client = getSVNWCClient(); try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); if (isURL(path)) { client.doGetFileContents(SVNURL.parseURIEncoded(path), JavaHLObjectFactory.getSVNRevision(pegRevision), JavaHLObjectFactory.getSVNRevision(revision), true, baos); } else { client.doGetFileContents(new File(path).getAbsoluteFile(), JavaHLObjectFactory.getSVNRevision(pegRevision), JavaHLObjectFactory.getSVNRevision(revision), true, baos); } return baos.toByteArray(); } catch (SVNException e) { throwException(e); } finally { resetLog(); } return null; }
public void streamFileContent(String path, Revision revision, Revision pegRevision, int bufferSize, OutputStream stream) throws ClientException { SVNWCClient client = getSVNWCClient(); try { if (isURL(path)) { client.doGetFileContents(SVNURL.parseURIEncoded(path), JavaHLObjectFactory.getSVNRevision(pegRevision), JavaHLObjectFactory.getSVNRevision(revision), true, stream); } else { client.doGetFileContents(new File(path).getAbsoluteFile(), JavaHLObjectFactory.getSVNRevision(pegRevision), JavaHLObjectFactory.getSVNRevision(revision), true, stream); } } catch (SVNException e) { throwException(e); } finally { resetLog(); } }
public void streamFileContent(String path, Revision revision, Revision pegRevision, int bufferSize, OutputStream stream) throws ClientException { SVNWCClient client = getSVNWCClient(); try { if (isURL(path)) { client.doGetFileContents(SVNURL.parseURIEncoded(path), JavaHLObjectFactory.getSVNRevision(pegRevision), JavaHLObjectFactory.getSVNRevision(revision), true, stream); } else { client.doGetFileContents(new File(path).getAbsoluteFile(), JavaHLObjectFactory.getSVNRevision(pegRevision), JavaHLObjectFactory.getSVNRevision(revision), true, stream); } } catch (SVNException e) { throwException(e); } finally { resetLog(); } }
public void streamFileContent(String path, Revision revision, Revision pegRevision, int bufferSize, OutputStream stream) throws ClientException { SVNWCClient client = getSVNWCClient(); try { if (isURL(path)) { client.doGetFileContents(SVNURL.parseURIEncoded(path), JavaHLObjectFactory.getSVNRevision(pegRevision), JavaHLObjectFactory.getSVNRevision(revision), true, stream); } else { client.doGetFileContents(new File(path).getAbsoluteFile(), JavaHLObjectFactory.getSVNRevision(pegRevision), JavaHLObjectFactory.getSVNRevision(revision), true, stream); } } catch (SVNException e) { throwException(e); } finally { resetLog(); } }
try { if (target.isURL()) { client.doGetFileContents(target.getURL(), target.getPegRevision(), getSVNEnvironment().getStartRevision(), true, getSVNEnvironment().getOut()); } else { client.doGetFileContents(target.getFile(), target.getPegRevision(), getSVNEnvironment().getStartRevision(), true, getSVNEnvironment().getOut());
try { if (target.isURL()) { client.doGetFileContents(target.getURL(), target.getPegRevision(), getSVNEnvironment().getStartRevision(), true, getSVNEnvironment().getOut()); } else { client.doGetFileContents(target.getFile(), target.getPegRevision(), getSVNEnvironment().getStartRevision(), true, getSVNEnvironment().getOut());