/** * Tells whether this file is binary or textual. * The result will depend on the value of the file {@link #getMimeType() mime type}. * * @return <span class="javakeyword">true</span> if binary */ public boolean isBinary() { return SVNProperty.isBinaryMimeType(myMimeType); }
/** * Tells whether this file is binary or textual. * The result will depend on the value of the file {@link #getMimeType() mime type}. * * @return <span class="javakeyword">true</span> if binary */ public boolean isBinary() { return SVNProperty.isBinaryMimeType(myMimeType); }
/** * Tells whether this file is binary or textual. * The result will depend on the value of the file {@link #getMimeType() mime type}. * * @return <span class="javakeyword">true</span> if binary */ public boolean isBinary() { return SVNProperty.isBinaryMimeType(myMimeType); }
private void setBinary(SVNProperties props) { String mimeType = props.getStringValue(SVNProperty.MIME_TYPE); isBinary = Boolean.valueOf(SVNProperty.isBinaryMimeType(mimeType)); } });
private void setBinary(SVNProperties props) { String mimeType = props.getStringValue(SVNProperty.MIME_TYPE); isBinary = Boolean.valueOf(SVNProperty.isBinaryMimeType(mimeType)); } });
public boolean fileIsBinary() throws SVNException { SVNPropertyValue mimeType = context.getPropertyValue(path, SVNProperty.MIME_TYPE); return mimeType != null && SVNProperty.isBinaryMimeType(mimeType.getString()); } public void fetchFileContent(OutputStream os) throws SVNException {
public boolean fileIsBinary() throws SVNException { SVNPropertyValue mimeType = getProperty(SVNProperty.MIME_TYPE); return mimeType != null && SVNProperty.isBinaryMimeType(mimeType.getString()); } public void fetchFileContent(OutputStream os) throws SVNException {
public boolean fileIsBinary() throws SVNException { SVNPropertyValue mimeType = getProperty(access, path, SVNProperty.MIME_TYPE); return mimeType != null && SVNProperty.isBinaryMimeType(mimeType.getString()); } });
public boolean fileIsBinary() throws SVNException { SVNPropertyValue mimeType = getProperty(access, path, SVNProperty.MIME_TYPE); return mimeType != null && SVNProperty.isBinaryMimeType(mimeType.getString()); } });
public boolean fileIsBinary() throws SVNException { SVNPropertyValue mimeType = SVNPropertiesManager.getProperty(access, path, SVNProperty.MIME_TYPE); return mimeType != null && SVNProperty.isBinaryMimeType(mimeType.getString()); }
public static Map computeAutoProperties(ISVNOptions options, File file, Map properties) throws SVNException { properties = options.applyAutoProperties(file, properties); if (!properties.containsKey(SVNProperty.MIME_TYPE)) { String mimeType = SVNFileUtil.detectMimeType(file, options.getFileExtensionsToMimeTypes()); if (mimeType != null) { properties.put(SVNProperty.MIME_TYPE, mimeType); } } if (SVNProperty.isBinaryMimeType((String) properties.get(SVNProperty.MIME_TYPE))) { properties.remove(SVNProperty.EOL_STYLE); properties.remove(SVNProperty.CHARSET); } if (!properties.containsKey(SVNProperty.EXECUTABLE)) { if (SVNFileUtil.isExecutable(file)) { properties.put(SVNProperty.EXECUTABLE, ""); } } return properties; }
public static Map computeAutoProperties(ISVNOptions options, File file, Map properties) throws SVNException { properties = options.applyAutoProperties(file, properties); if (!properties.containsKey(SVNProperty.MIME_TYPE)) { String mimeType = SVNFileUtil.detectMimeType(file, options.getFileExtensionsToMimeTypes()); if (mimeType != null) { properties.put(SVNProperty.MIME_TYPE, mimeType); } } if (SVNProperty.isBinaryMimeType((String) properties.get(SVNProperty.MIME_TYPE))) { properties.remove(SVNProperty.EOL_STYLE); properties.remove(SVNProperty.CHARSET); } if (!properties.containsKey(SVNProperty.EXECUTABLE)) { if (SVNFileUtil.isExecutable(file)) { properties.put(SVNProperty.EXECUTABLE, ""); } } return properties; }
public static Map computeAutoProperties(ISVNOptions options, File file, Map properties) throws SVNException { properties = options.applyAutoProperties(file, properties); if (!properties.containsKey(SVNProperty.MIME_TYPE)) { String mimeType = SVNFileUtil.detectMimeType(file, options.getFileExtensionsToMimeTypes()); if (mimeType != null) { properties.put(SVNProperty.MIME_TYPE, mimeType); } } if (SVNProperty.isBinaryMimeType((String) properties.get(SVNProperty.MIME_TYPE))) { properties.remove(SVNProperty.EOL_STYLE); properties.remove(SVNProperty.CHARSET); } if (!properties.containsKey(SVNProperty.EXECUTABLE)) { if (SVNFileUtil.isExecutable(file)) { properties.put(SVNProperty.EXECUTABLE, ""); } } return properties; }
public static Map computeAutoProperties(ISVNOptions options, File file) { Map properties = options.applyAutoProperties(file, null); if (!properties.containsKey(SVNProperty.MIME_TYPE)) { String mimeType = SVNFileUtil.detectMimeType(file); if (mimeType != null) { properties.put(SVNProperty.MIME_TYPE, mimeType); } } if (SVNProperty.isBinaryMimeType((String) properties.get(SVNProperty.MIME_TYPE))) { properties.remove(SVNProperty.EOL_STYLE); } if (!properties.containsKey(SVNProperty.EXECUTABLE)) { if (SVNFileUtil.isExecutable(file)) { properties.put(SVNProperty.EXECUTABLE, SVNProperty.getValueOfBooleanProperty(SVNProperty.EXECUTABLE)); } } return properties; }
private void printBinaryMimeTypeWarning(Collection targets, String propertyName, SVNPropertyValue propertyValue) throws SVNException { if (SVNProperty.MIME_TYPE.equals(propertyName)) { for (Object target : targets) { String path = (String) target; File localAbsPath = SVNFileUtil.createFilePath(path).getAbsoluteFile(); if (SVNFileType.getNodeKind(SVNFileType.getType(localAbsPath)) != SVNNodeKind.FILE) { continue; } SVNPropertyValue canonicalPropertyValue = SVNPropertiesManager.validatePropertyValue(localAbsPath, SVNNodeKind.FILE, propertyName, propertyValue, false, null, null); if (SVNProperty.isBinaryMimeType(SVNPropertyValue.getPropertyAsString(canonicalPropertyValue))) { String detectedMimeType = SVNFileUtil.detectMimeType(localAbsPath, null); if (detectedMimeType == null || !SVNProperty.isBinaryMimeType(detectedMimeType)) { getEnvironment().getErr().println("svn: warning: '" + SVNPropertyValue.getPropertyAsString(canonicalPropertyValue) + "' is a binary mime-type but file '" + localAbsPath + "' " + "looks like text; diff, merge, blame, and other " + "operations will stop working on this file"); } } } } } }
private void printBinaryMimeTypeWarning(Collection targets, String propertyName, SVNPropertyValue propertyValue) throws SVNException { if (SVNProperty.MIME_TYPE.equals(propertyName)) { for (Object target : targets) { String path = (String) target; File localAbsPath = SVNFileUtil.createFilePath(path).getAbsoluteFile(); if (SVNFileType.getNodeKind(SVNFileType.getType(localAbsPath)) != SVNNodeKind.FILE) { continue; } SVNPropertyValue canonicalPropertyValue = SVNPropertiesManager.validatePropertyValue(localAbsPath, SVNNodeKind.FILE, propertyName, propertyValue, false, null, null); if (SVNProperty.isBinaryMimeType(SVNPropertyValue.getPropertyAsString(canonicalPropertyValue))) { String detectedMimeType = SVNFileUtil.detectMimeType(localAbsPath, null); if (detectedMimeType == null || !SVNProperty.isBinaryMimeType(detectedMimeType)) { getEnvironment().getErr().println("svn: warning: '" + SVNPropertyValue.getPropertyAsString(canonicalPropertyValue) + "' is a binary mime-type but file '" + localAbsPath + "' " + "looks like text; diff, merge, blame, and other " + "operations will stop working on this file"); } } } } } }
private static void validateEOLProperty(File path, SVNWCAccess access) throws SVNException { String mimeType = getProperty(access, path, SVNProperty.MIME_TYPE); if (mimeType != null && SVNProperty.isBinaryMimeType(mimeType)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.ILLEGAL_TARGET, "File ''{0}'' has binary mime type property", path); SVNErrorManager.error(err); } boolean consistent = SVNTranslator.checkNewLines(path); if (!consistent) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.ILLEGAL_TARGET, "File ''{0}'' has inconsistent newlines", path); SVNErrorManager.error(err); } }
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); }