private String parsePropName(String header, String indicator) throws SVNException { String propName = header.substring(indicator.length()); if (propName.length() == 0) { return null; } else if (!SVNPropertiesManager.isValidPropertyName(propName)) { propName = propName.trim(); return SVNPropertiesManager.isValidPropertyName(propName) ? propName : null; } return propName; }
public static SVNProperties normalizeRevisionProperties(SVNProperties revProps) throws SVNException { SVNProperties normalizedProps = new SVNProperties(); for (Iterator propNamesIter = revProps.nameSet().iterator(); propNamesIter.hasNext();) { String propName = (String) propNamesIter.next(); if (SVNPropertiesManager.propNeedsTranslation(propName)) { SVNPropertyValue value = revProps.getSVNPropertyValue(propName); String normalizedValue = normalizeString(SVNPropertyValue.getPropertyAsString(value)); if (normalizedValue != null) { normalizedProps.put(propName, SVNPropertyValue.create(normalizedValue)); } } } revProps.putAll(normalizedProps); return normalizedProps; }
public static void setProperty(SVNWCAccess access, File path, String propName, String propValue, boolean skipChecks) throws SVNException { if (SVNProperty.isWorkingCopyProperty(propName)) { setWCProperty(access, path, propName, propValue, true); return; } else if (SVNProperty.isEntryProperty(propName)) { boolean updateTimeStamp = SVNProperty.EOL_STYLE.equals(propName); if (propValue != null) { validatePropertyName(path, propName, entry.getKind()); if (!skipChecks && SVNProperty.EOL_STYLE.equals(propName)) { propValue = propValue.trim(); validateEOLProperty(path, access); } else if (!skipChecks && SVNProperty.MIME_TYPE.equals(propName)) { propValue = propValue.trim(); validateMimeType(propValue); } else if (SVNProperty.EXTERNALS.equals(propName) || SVNProperty.IGNORE.equals(propName)) { if (!propValue.endsWith("\n")) { if (!updateTimeStamp && (entry.getKind() == SVNNodeKind.FILE && SVNProperty.KEYWORDS.equals(propName))) { String oldValue = properties.getPropertyValue(SVNProperty.KEYWORDS); Collection oldKeywords = getKeywords(oldValue); Collection newKeywords = getKeywords(propValue); updateTimeStamp = !oldKeywords.equals(newKeywords);
private void addFile(File path, SVNFileType type, SVNAdminArea dir) throws SVNException { SVNWCManager.add(path, dir, null, SVNRevision.UNDEFINED); String mimeType = null; if (type == SVNFileType.SYMLINK) { SVNPropertiesManager.setProperty(dir.getWCAccess(), path, SVNProperty.SPECIAL, SVNProperty.getValueOfBooleanProperty(SVNProperty.SPECIAL), false); } else { Map props = SVNPropertiesManager.computeAutoProperties(getOptions(), path); for (Iterator names = props.keySet().iterator(); names.hasNext();) { String propName = (String) names.next(); String propValue = (String) props.get(propName); SVNPropertiesManager.setProperty(dir.getWCAccess(), path, propName, propValue, false); } mimeType = (String) props.get(SVNProperty.MIME_TYPE); } SVNEvent event = SVNEventFactory.createAddedEvent(dir, path.getName(), SVNNodeKind.FILE, mimeType); dispatchEvent(event); }
for (Iterator addedPathsIter = myAddedPaths.iterator(); addedPathsIter.hasNext();) { File addedPath = (File) addedPathsIter.next(); SVNPropertyValue addedPathParentPropValue = SVNPropertiesManager.getProperty(myWCAccess, addedPath.getParentFile(), SVNProperty.MERGE_INFO); String addedPathParentPropValueStr = addedPathParentPropValue != null ? mergeMergeInfo = SVNMergeInfoUtil.mergeMergeInfos(mergeMergeInfo, addedPathMergeInfo); SVNPropertiesManager.recordWCMergeInfo(addedPath, mergeMergeInfo, myWCAccess);
validatePropertyName(path, name, kind); SVNErrorManager.error(error, SVNLogType.DEFAULT); validateEOLProperty(path, fileContentFetcher); } else if (!force && SVNProperty.CHARSET.equals(name)) { value = SVNPropertyValue.create(value.getString().trim()); validateMimeType(value.getString()); } else if (SVNProperty.IGNORE.equals(name) || SVNProperty.EXTERNALS.equals(name)) { if (!value.getString().endsWith("\n")) {
public static boolean setProperty(final SVNWCAccess access, final File path, final String propName, SVNPropertyValue propValue, boolean skipChecks) throws SVNException { if (SVNProperty.isWorkingCopyProperty(propName)) { return setWCProperty(access, path, propName, propValue, true); } else if (SVNProperty.isEntryProperty(propName)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.BAD_PROP_KIND, "Property ''{0}'' is an entry property", propName); propValue = validatePropertyValue(path.getAbsolutePath(), entry.getKind(), propName, propValue, skipChecks, access.getOptions(), new ISVNFileContentFetcher() { Collection oldKeywords = getKeywords(oldValue == null ? null : oldValue.getString()); Collection newKeywords = getKeywords(propValue == null ? null : propValue.getString()); updateTimeStamp = !oldKeywords.equals(newKeywords);
SVNRevision baseRevision, String commitMessage, SVNProperties revisionProperties, boolean skipChecks, ISVNPropertyHandler handler) throws SVNException { if (propValue != null && !SVNPropertiesManager.isValidPropertyName(propName)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_PROPERTY_NAME, "Bad property name ''{0}''", propName); final long baseRev = revNumber; propValue = SVNPropertiesManager.validatePropertyValue(url, kind, propName, propValue, skipChecks, getOptions(), new ISVNFileContentFetcher() { SVNPropertiesManager.validateRevisionProperties(revisionProperties);
String propName = (String) iterator.next(); SVNPropertyValue propValue = propDiff.getSVNPropertyValue(propName); if (propValue != null && !SVNPropertiesManager.isValidPropertyName(propName)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_PROPERTY_NAME, "Bad property name ''{0}''", propName); SVNErrorManager.error(err, SVNLogType.WC); boolean modified = SVNPropertiesManager.setProperty(adminArea.getWCAccess(), path, propName, propValue, force); if (modified && handler != null) { handler.handleProperty(path, new SVNPropertyData(propName, propValue, getOptions()));
/** * Recursively removes all DAV-specific <span class="javakeyword">"svn:wc:"</span> properties * from the <code>directory</code> and beneath. * * <p> * This method does not connect to a repository, it's a local operation only. Nor does it change any user's * versioned data. Changes are made only in administrative version control files. * * @param directory working copy path * @throws SVNException * @since 1.2 */ public void doCleanupWCProperties(File directory) throws SVNException { SVNWCAccess wcAccess = SVNWCAccess.newInstance(this); try { SVNAdminArea dir = wcAccess.open(directory, true, true, -1); if (dir != null) { SVNPropertiesManager.deleteWCProperties(dir, null, true); } } finally { wcAccess.close(); } }
public static SVNPropertyValue getProperty(SVNWCAccess access, File path, String propName) throws SVNException { SVNEntry entry = access.getEntry(path, false); if (entry == null) { return null; } String[] cachableProperties = entry.getCachableProperties(); if (cachableProperties != null && contains(cachableProperties, propName)) { String[] presentProperties = entry.getPresentProperties(); if (presentProperties == null || !contains(presentProperties, propName)) { return null; } if (SVNProperty.isBooleanProperty(propName)) { return SVNProperty.getValueOfBooleanProperty(propName); } } if (SVNProperty.isWorkingCopyProperty(propName)) { return getWCProperty(access, path, propName); } else if (SVNProperty.isEntryProperty(propName)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.BAD_PROP_KIND, "Property ''{0}'' is an entry property", propName); SVNErrorManager.error(err, SVNLogType.DEFAULT); } SVNAdminArea dir = entry.getKind() == SVNNodeKind.DIR ? access.retrieve(path) : access.retrieve(path.getParentFile()); return dir.getProperties(entry.getName()).getPropertyValue(propName); }
SVNErrorManager.error(err, SVNLogType.CLIENT); if (!SVNPropertiesManager.isValidPropertyName(propertyName)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_PROPERTY_NAME, "''{0}'' is not a valid Subversion property name", propertyName); if (SVNPropertiesManager.propNeedsTranslation(propertyName)) { encoding = getSVNEnvironment().getEncoding(); if (encoding == null) {
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"); } } } } } }
public SVNPropertyValue getProperty(String propertyName) throws SVNException { return SVNPropertiesManager.getProperty(access, path, propertyName); } });
private Map getAllAutoProperties(ISVNOptions options, File file) throws SVNException { Map<String, String> allAutoProperties = new HashMap<String, String>(); Map configAutoProperties = SVNPropertiesManager.computeAutoProperties(options, file, null); if (configAutoProperties != null) { allAutoProperties.putAll(configAutoProperties);
SVNPropertiesManager.validateMimeType(value); } catch (SVNException svne) { return DAVInsertPropAction.NOT_DEF;
validatePropertyName(path, name, kind); SVNErrorManager.error(error, SVNLogType.DEFAULT); validateEOLProperty(path, fileContentFetcher); } else if (!force && SVNProperty.CHARSET.equals(name)) { value = SVNPropertyValue.create(value.getString().trim()); validateMimeType(value.getString()); } else if (SVNProperty.IGNORE.equals(name) || SVNProperty.EXTERNALS.equals(name)) { if (!value.getString().endsWith("\n")) {
public static boolean setProperty(final SVNWCAccess access, final File path, final String propName, SVNPropertyValue propValue, boolean skipChecks) throws SVNException { if (SVNProperty.isWorkingCopyProperty(propName)) { return setWCProperty(access, path, propName, propValue, true); } else if (SVNProperty.isEntryProperty(propName)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.BAD_PROP_KIND, "Property ''{0}'' is an entry property", propName); propValue = validatePropertyValue(path, entry.getKind(), propName, propValue, skipChecks, access.getOptions(), new ISVNFileContentFetcher() { Collection oldKeywords = getKeywords(oldValue == null ? null : oldValue.getString()); Collection newKeywords = getKeywords(propValue == null ? null : propValue.getString()); updateTimeStamp = !oldKeywords.equals(newKeywords);
SVNRevision baseRevision, String commitMessage, SVNProperties revisionProperties, boolean skipChecks, ISVNPropertyHandler handler) throws SVNException { if (propValue != null && !SVNPropertiesManager.isValidPropertyName(propName)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_PROPERTY_NAME, "Bad property name ''{0}''", propName); final long baseRev = revNumber; propValue = SVNPropertiesManager.validatePropertyValue(url.toString(), kind, propName, propValue, skipChecks, getOptions(), new ISVNFileContentFetcher() { SVNPropertiesManager.validateRevisionProperties(revisionProperties);
SVNPropertyValue propValue = propDiff.getSVNPropertyValue(propName); if (propValue != null && !SVNPropertiesManager.isValidPropertyName(propName)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_PROPERTY_NAME, "Bad property name ''{0}''", propName); boolean modified = SVNPropertiesManager.setProperty(adminArea.getWCAccess(), path, propName, propValue, force); if (modified && handler != null) {