File file1 = SVNFileUtil.createTempFile(path1 + ".left", "tmp"); File file2 = SVNFileUtil.createTempFile(path2 + ".right", "tmp"); OutputStream os1 = null; OutputStream os2 = null; try { os1 = SVNFileUtil.openFileForWriting(file1); os2 = SVNFileUtil.openFileForWriting(file2); SVNRepository repos = SVNRepositoryFactory.create(myRepos.getLocation()); repos.setAuthenticationManager(myRepos.getAuthenticationManager()); repos.getFile(path1, rev1, null, os1); repos.getFile(path2, rev2, null, os2); } finally { SVNFileUtil.closeFile(os1); SVNFileUtil.closeFile(os2); } InputStream is1 = null; InputStream is2 = null; try { is1 = SVNFileUtil.openFileForReading(file1); is2 = SVNFileUtil.openFileForReading(file2); int r1 = -1; int r2 = -1; while (true) { r1 = is1.read(); r2 = is2.read(); if (r1 != r2) { return false; } if (r1 == -1) { break; } } } catch (IOException ioe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage()); SVNErrorManager.error(err, ioe); } finally { SVNFileUtil.closeFile(is1); SVNFileUtil.closeFile(is2); SVNFileUtil.deleteFile(file1); SVNFileUtil.deleteFile(file2); } return true;
Map props1 = new HashMap(); Map props2 = new HashMap();  SVNRepository repos = SVNRepositoryFactory.create(myRepos.getLocation()); repos.setAuthenticationManager(myRepos.getAuthenticationManager()); repos.getFile(path1, rev1, props1, null); repos.getFile(path2, rev2, props2, null); String crc1 = (String) props1.get(SVNProperty.CHECKSUM); String crc2 = (String) props1.get(SVNProperty.CHECKSUM); return crc1 != null && crc1.equals(crc2);
    private boolean areFileContentsEqual(String path1, long rev1, String path2, long rev2) throws SVNException {        File file1 = SVNFileUtil.createTempFile(path1 + ".left", "tmp");        File file2 = SVNFileUtil.createTempFile(path2 + ".right", "tmp");        OutputStream os1 = null;        OutputStream os2 = null;        try {            os1 = SVNFileUtil.openFileForWriting(file1);            os2 = SVNFileUtil.openFileForWriting(file2);            SVNRepository repos = SVNRepositoryFactory.create(myRepos.getLocation());            repos.setAuthenticationManager(myRepos.getAuthenticationManager());            repos.getFile(path1, rev1, null, os1);            repos.getFile(path2, rev2, null, os2);        } finally {            SVNFileUtil.closeFile(os1);            SVNFileUtil.closeFile(os2);        }        InputStream is1 = null;        InputStream is2 = null;        try {            is1 = SVNFileUtil.openFileForReading(file1);            is2 = SVNFileUtil.openFileForReading(file2);            int r1 = -1;            int r2 = -1;            while (true) {                r1 = is1.read();                r2 = is2.read();                if (r1 != r2) {                    return false;                }                if (r1 == -1) {// we've finished - files do not differ                    break;                }            }        } catch (IOException ioe) {            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage());            SVNErrorManager.error(err, ioe);        } finally {            SVNFileUtil.closeFile(is1);            SVNFileUtil.closeFile(is2);            SVNFileUtil.deleteFile(file1);            SVNFileUtil.deleteFile(file2);        }        return true;    }