private String computeSHA1Checksum(FSRoot revision, String filePath) throws SVNException { InputStream is = revision.getFileStreamForPath(getDeltaCombiner(), filePath); SVNChecksumInputStream checksum = null; try { checksum = new SVNChecksumInputStream(is, "SHA1"); } finally { SVNFileUtil.closeFile(checksum); } return checksum != null ? checksum.getDigest() : null; }
private String computeSHA1Checksum(FSRoot revision, String filePath) throws SVNException { InputStream is = revision.getFileStreamForPath(getDeltaCombiner(), filePath); SVNChecksumInputStream checksum = null; try { checksum = new SVNChecksumInputStream(is, "SHA1"); } finally { SVNFileUtil.closeFile(checksum); } return checksum != null ? checksum.getDigest() : null; }
private String computeSHA1Checksum(FSRoot revision, String filePath) throws SVNException { InputStream is = revision.getFileStreamForPath(getDeltaCombiner(), filePath); SVNChecksumInputStream checksum = null; try { checksum = new SVNChecksumInputStream(is, "SHA1"); } finally { SVNFileUtil.closeFile(checksum); } return checksum != null ? checksum.getDigest() : null; }
InputStream file2IS = null; try { file1IS = root1.getFileStreamForPath(myDeltaCombiner, path1); file2IS = root2.getFileStreamForPath(myDeltaCombiner, path2);
InputStream file2IS = null; try { file1IS = root1.getFileStreamForPath(deltaCombiner, path1); file2IS = root2.getFileStreamForPath(deltaCombiner, path2);
InputStream file2IS = null; try { file1IS = root1.getFileStreamForPath(deltaCombiner, path1); file2IS = root2.getFileStreamForPath(deltaCombiner, path2);
InputStream file2IS = null; try { file1IS = root1.getFileStreamForPath(deltaCombiner, path1); file2IS = root2.getFileStreamForPath(deltaCombiner, path2);
targetStream = srcRoot.getFileStreamForPath(myDeltaCombiner, newSrcPath); myDeltaGenerator.sendDelta(newPath, SVNFileUtil.DUMMY_IN, 0, targetStream, editor, false); } finally {
private void catFile(FSRoot root, String path, OutputStream out) throws SVNException { SVNNodeKind kind = verifyPath(root, path); if (kind != SVNNodeKind.FILE) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NOT_FILE, "Path ''{0}'' is not a file", path); SVNErrorManager.error(err, SVNLogType.FSFS); } if (out != null) { InputStream contents = null; try { contents = root.getFileStreamForPath(new SVNDeltaCombiner(), path); byte[] buffer = new byte[SVNFileUtil.STREAM_CHUNK_SIZE]; int len = 0; do { checkCancelled(); len = SVNFileUtil.readIntoBuffer(contents, buffer, 0, buffer.length); if (len > 0) { out.write(buffer, 0, len); } } while (len == SVNFileUtil.STREAM_CHUNK_SIZE); } catch (IOException ioe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage()); SVNErrorManager.error(err, ioe, SVNLogType.FSFS); } finally { SVNFileUtil.closeFile(contents); } } }
private void catFile(FSRoot root, String path, OutputStream out) throws SVNException { SVNNodeKind kind = verifyPath(root, path); if (kind != SVNNodeKind.FILE) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NOT_FILE, "Path ''{0}'' is not a file", path); SVNErrorManager.error(err, SVNLogType.FSFS); } if (out != null) { InputStream contents = null; try { contents = root.getFileStreamForPath(new SVNDeltaCombiner(), path); byte[] buffer = new byte[SVNFileUtil.STREAM_CHUNK_SIZE]; int len = 0; do { checkCancelled(); len = SVNFileUtil.readIntoBuffer(contents, buffer, 0, buffer.length); out.write(buffer, 0, len); } while (len == SVNFileUtil.STREAM_CHUNK_SIZE); } catch (IOException ioe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage()); SVNErrorManager.error(err, ioe, SVNLogType.FSFS); } finally { SVNFileUtil.closeFile(contents); } } }
private void catFile(FSRoot root, String path, OutputStream out) throws SVNException { SVNNodeKind kind = verifyPath(root, path); if (kind != SVNNodeKind.FILE) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NOT_FILE, "Path ''{0}'' is not a file", path); SVNErrorManager.error(err, SVNLogType.FSFS); } if (out != null) { InputStream contents = null; try { contents = root.getFileStreamForPath(new SVNDeltaCombiner(), path); byte[] buffer = new byte[SVNFileUtil.STREAM_CHUNK_SIZE]; int len = 0; do { checkCancelled(); len = SVNFileUtil.readIntoBuffer(contents, buffer, 0, buffer.length); if (len > 0) { out.write(buffer, 0, len); } } while (len == SVNFileUtil.STREAM_CHUNK_SIZE); } catch (IOException ioe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, ioe.getLocalizedMessage()); SVNErrorManager.error(err, ioe, SVNLogType.FSFS); } finally { SVNFileUtil.closeFile(contents); } } }
targetStream = srcRoot.getFileStreamForPath(myDeltaCombiner, newSrcPath); myDeltaGenerator.sendDelta(newPath, SVNFileUtil.DUMMY_IN, 0, targetStream, editor, false); } finally {
targetStream = srcRoot.getFileStreamForPath(myDeltaCombiner, newSrcPath); myDeltaGenerator.sendDelta(newPath, SVNFileUtil.DUMMY_IN, 0, targetStream, editor, false); } finally {
targetStream = srcRoot.getFileStreamForPath(myDeltaCombiner, newSrcPath); myDeltaGenerator.sendDelta(newPath, SVNFileUtil.DUMMY_IN, 0, targetStream, editor, false); } finally {
try { if (srcRoot != null && srcPath != null) { sourceStream = srcRoot.getFileStreamForPath(myDeltaCombiner, srcPath); } else { sourceStream = SVNFileUtil.DUMMY_IN; targetStream = myRoot.getFileStreamForPath(myDeltaCombiner, absPath); myDeltaGenerator.sendDelta(path, sourceStream, 0, targetStream, editor, false); } finally {
public static void sendTextDelta(ISVNEditor editor, String editPath, String sourcePath, String hexDigest, FSRevisionRoot sourceRoot, String targetPath, FSRoot targetRoot, boolean sendDeltas, SVNDeltaCombiner deltaCombiner, SVNDeltaGenerator deltaGenerator, FSFS fsfs) throws SVNException { editor.applyTextDelta(editPath, hexDigest); if (sendDeltas) { InputStream sourceStream = null; InputStream targetStream = null; try { if (sourceRoot != null && sourcePath != null) { sourceStream = sourceRoot.getFileStreamForPath(deltaCombiner, sourcePath); } else { sourceStream = FSInputStream.createDeltaStream(deltaCombiner, (FSRevisionNode) null, fsfs); } targetStream = targetRoot.getFileStreamForPath(deltaCombiner, targetPath); deltaGenerator.sendDelta(editPath, sourceStream, 0, targetStream, editor, false); } finally { SVNFileUtil.closeFile(sourceStream); SVNFileUtil.closeFile(targetStream); } } else { editor.textDeltaChunk(editPath, SVNDiffWindow.EMPTY); editor.textDeltaEnd(editPath); } }
try { if (lastRoot != null && lastPath != null) { sourceStream = lastRoot.getFileStreamForPath(sourceCombiner, lastPath); } else { sourceStream = FSInputStream.createDeltaStream(sourceCombiner, (FSRevisionNode) null, myFSFS);
private DiffItem prepareTmpFile(FSRoot root, String path, ISVNDiffGenerator generator) throws SVNException { String mimeType = null; if (root != null) { FSRevisionNode node = root.getRevisionNode(path); SVNProperties nodeProps = node.getProperties(root.getOwner()); mimeType = nodeProps.getStringValue(SVNProperty.MIME_TYPE); if (SVNProperty.isBinaryMimeType(mimeType) && !generator.isForcedBinaryDiff()) { return new DiffItem(mimeType, null); } } File tmpFile = createTempFile(generator); if (root != null) { InputStream contents = null; OutputStream tmpOS = null; try { contents = root.getFileStreamForPath(new SVNDeltaCombiner(), path); tmpOS = SVNFileUtil.openFileForWriting(tmpFile); FSRepositoryUtil.copy(contents, tmpOS, myCancelHandler); } finally { SVNFileUtil.closeFile(contents); SVNFileUtil.closeFile(tmpOS); } } return new DiffItem(mimeType, tmpFile); }
private DiffItem prepareTmpFile(FSRoot root, String path, ISVNDiffGenerator generator) throws SVNException { String mimeType = null; if (root != null) { FSRevisionNode node = root.getRevisionNode(path); SVNProperties nodeProps = node.getProperties(root.getOwner()); mimeType = nodeProps.getStringValue(SVNProperty.MIME_TYPE); if (SVNProperty.isBinaryMimeType(mimeType) && !generator.isForcedBinaryDiff()) { return new DiffItem(mimeType, null); } } File tmpFile = createTempFile(generator); if (root != null) { InputStream contents = null; OutputStream tmpOS = null; try { contents = root.getFileStreamForPath(new SVNDeltaCombiner(), path); tmpOS = SVNFileUtil.openFileForWriting(tmpFile); FSRepositoryUtil.copy(contents, tmpOS, myCancelHandler); } finally { SVNFileUtil.closeFile(contents); SVNFileUtil.closeFile(tmpOS); } } return new DiffItem(mimeType, tmpFile); }
private DiffItem prepareTmpFile(FSRoot root, String path, ISVNDiffGenerator generator) throws SVNException { String mimeType = null; if (root != null) { FSRevisionNode node = root.getRevisionNode(path); SVNProperties nodeProps = node.getProperties(root.getOwner()); mimeType = nodeProps.getStringValue(SVNProperty.MIME_TYPE); if (SVNProperty.isBinaryMimeType(mimeType) && !generator.isForcedBinaryDiff()) { return new DiffItem(mimeType, null); } } File tmpFile = createTempFile(generator); if (root != null) { InputStream contents = null; OutputStream tmpOS = null; try { contents = root.getFileStreamForPath(new SVNDeltaCombiner(), path); tmpOS = SVNFileUtil.openFileForWriting(tmpFile); FSRepositoryUtil.copy(contents, tmpOS, myCancelHandler); } finally { SVNFileUtil.closeFile(contents); SVNFileUtil.closeFile(tmpOS); } } return new DiffItem(mimeType, tmpFile); }