public long getFileRevision(String filePath) throws SVNException { long rev = -1; if (isFile(filePath)) { rev = repository.getFile(filePath, -1, null, null); // stream not needed } return rev; }
private String getSourceCode(SVNRepository repository, long endRevision, SVNLogEntryPath e) throws SVNException, UnsupportedEncodingException { if (e.getType() == 'D') return ""; ByteArrayOutputStream out = new ByteArrayOutputStream(); repository.getFile(e.getPath(), endRevision, null, out); String sc = out.toString("UTF-8"); return sc; }
/** @return revision */ public long doWriteTo(long revision, OutputStream dest) throws FileNotFoundException, SVNException { SVNRepository repository; repository = root.getRepository(); if (repository.checkPath(path, revision) != SVNNodeKind.FILE) { throw new FileNotFoundException("no such file: " + path + ", revision " + revision); } return repository.getFile(path, revision, null, dest); }
public boolean fileIsBinary() throws SVNException { if (isBinary == null) { SVNProperties props = new SVNProperties(); repos.getFile("", baseRev, props, null); setBinary(props); } return isBinary.booleanValue(); }
public boolean fileIsBinary() throws SVNException { if (isBinary == null) { SVNProperties props = new SVNProperties(); repos.getFile("", baseRev, props, null); setBinary(props); } return isBinary.booleanValue(); }
public void fetchFileContent(OutputStream os) throws SVNException { SVNProperties props = new SVNProperties(); repos.getFile("", baseRev, props, os); setBinary(props); }
public void fetchFileContent(OutputStream os) throws SVNException { SVNProperties props = new SVNProperties(); repos.getFile("", baseRev, props, os); setBinary(props); }
@Override public InputStream content() throws IOException, InterruptedException { ByteArrayOutputStream contents = new ByteArrayOutputStream(); try { fs.getRepository().getFile(getPath(), fs.getLatestRevision(), null, contents); return new ByteArrayInputStream(contents.toByteArray()); } catch (SVNException e) { throw new IOException("failed to fetch file: " + getPath(), e); } }
private boolean areFileContentsEqual(String path1, long rev1, String path2, long rev2, SVNProperties props2) throws SVNException { SVNProperties props1 = new SVNProperties(); props2 = props2 == null ? new SVNProperties() : props2; SVNRepository repos = getSourceRepository(); repos.getFile(path1, rev1, props1, null); repos.getFile(path2, rev2, props2, null); String crc1 = props1.getStringValue(SVNProperty.CHECKSUM); String crc2 = props2.getStringValue(SVNProperty.CHECKSUM); return crc1 != null && crc1.equals(crc2); }
private boolean areFileContentsEqual(String path1, long rev1, String path2, long rev2, SVNProperties props2) throws SVNException { SVNProperties props1 = new SVNProperties(); props2 = props2 == null ? new SVNProperties() : props2; SVNRepository repos = getSourceRepository(); repos.getFile(path1, rev1, props1, null); repos.getFile(path2, rev2, props2, null); String crc1 = props1.getStringValue(SVNProperty.CHECKSUM); String crc2 = props2.getStringValue(SVNProperty.CHECKSUM); return crc1 != null && crc1.equals(crc2); }
private boolean areFileContentsEqual(String path1, long rev1, String path2, long rev2, SVNProperties props2) throws SVNException { SVNProperties props1 = new SVNProperties(); props2 = props2 == null ? new SVNProperties() : props2; SVNRepository repos = getSourceRepository(); repos.getFile(path1, rev1, props1, null); repos.getFile(path2, rev2, props2, null); String crc1 = props1.getStringValue(SVNProperty.CHECKSUM); String crc2 = props2.getStringValue(SVNProperty.CHECKSUM); return crc1 != null && crc1.equals(crc2); }
public static void checkFileContent(@NotNull SVNRepository repo, @NotNull String filePath, @NotNull byte[] content) throws IOException, SVNException { try (ByteArrayOutputStream stream = new ByteArrayOutputStream()) { repo.getFile(filePath, repo.getLatestRevision(), null, stream); Assert.assertEquals(stream.toByteArray(), content); } }
/** @return revision */ public long doWriteTo(long revision, OutputStream dest) throws FileNotFoundException, SVNException { SVNRepository repository; repository = root.getRepository(); if (repository.checkPath(path, revision) != SVNNodeKind.FILE) { throw new FileNotFoundException(this, "no such file in revision " + revision); } return repository.getFile(path, revision, null, dest); }
public static void checkFileContent(@NotNull SVNRepository repo, @NotNull String filePath, @NotNull String content) throws IOException, SVNException { try (ByteArrayOutputStream stream = new ByteArrayOutputStream()) { repo.getFile(filePath, repo.getLatestRevision(), null, stream); Assert.assertEquals(new String(stream.toByteArray(), StandardCharsets.UTF_8), content); } }
public static void checkFileProp(@NotNull SVNRepository repo, @NotNull String filePath, @Nullable Map<String, String> expected) throws SVNException { SVNProperties props = new SVNProperties(); repo.getFile(filePath, repo.getLatestRevision(), props, null); checkProp(props, expected); }
public long fetchFile(String path, long revision, OutputStream os, SVNProperties properties) throws SVNException { SVNURL url = reposRoot.appendPath(SVNPathUtil.removeTail(path), false); if (repos2[0] == null) { repos2[0] = createRepository(url, null, null, false); } else { repos2[0].setLocation(url, false); } return repos2[0].getFile(SVNPathUtil.tail(path), revision, properties, os); } };
public void loadFromRepository(long revision) throws SVNException { myBaseFile = SVNFileUtil.createUniqueFile(getTempDirectory(), ".diff", ".tmp", myIsUseGlobalTmp); OutputStream os = null; myBaseProperties = new SVNProperties(); try { os = SVNFileUtil.openFileForWriting(myBaseFile); myRepos.getFile(myRepositoryPath, revision, myBaseProperties, new SVNCancellableOutputStream(os, myCancelHandler)); } finally { SVNFileUtil.closeFile(os); } }
public void loadFromRepository(long revision) throws SVNException { myBaseFile = SVNFileUtil.createUniqueFile(getTempDirectory(), ".diff", ".tmp", myIsUseGlobalTmp); OutputStream os = null; myBaseProperties = new SVNProperties(); try { os = SVNFileUtil.openFileForWriting(myBaseFile); myRepos.getFile(myRepositoryPath, revision, myBaseProperties, new SVNCancellableOutputStream(os, myCancelHandler)); } finally { SVNFileUtil.closeFile(os); } }
public void loadFromRepository(long revision) throws SVNException { myBaseFile = SVNFileUtil.createUniqueFile(getTempDirectory(), ".diff", ".tmp", myIsUseGlobalTmp); OutputStream os = null; myBaseProperties = new SVNProperties(); try { os = SVNFileUtil.openFileForWriting(myBaseFile); myRepos.getFile(myRepositoryPath, revision, myBaseProperties, new SVNCancellableOutputStream(os, myCancelHandler)); } finally { SVNFileUtil.closeFile(os); } }
public void writeTo(OutputStream out) throws SVNException { if (isCollection()) { SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_DAV_REQUEST_FAILED), SVNLogType.NETWORK); } getRepository().getFile(getResourceURI().getPath(), getRevision(), null, out); }