protected void categorizeProperties(Map original, Map regular, Map entry, Map wc) { if (original == null) { return; } for(Iterator propNames = original.keySet().iterator(); propNames.hasNext();) { String name = (String) propNames.next(); if (SVNProperty.isRegularProperty(name) && regular != null) { regular.put(name, original.get(name)); } else if (SVNProperty.isEntryProperty(name) && entry != null) { entry.put(name, original.get(name)); } else if (SVNProperty.isWorkingCopyProperty(name) && wc != null) { wc.put(name, original.get(name)); } } }
/** * Checks if a property is regular. * * <p/> * A property is considered to be regular if it is not <span class="javakeyword">null</span> and * does not start neither with {@link #SVN_WC_PREFIX} nor with {@link #SVN_ENTRY_PREFIX}. * * @param name a property name * @return <span class="javakeyword">true</span> if regular, otherwise * <span class="javakeyword">false</span> */ public static boolean isRegularProperty(String name) { if (name == null) { return false; } else if (isWorkingCopyProperty(name) || isEntryProperty(name)) { return false; } else { return true; } }
public static void addProperties(SVNAdminArea dir, String fileName, Map properties, boolean base, SVNLog log) throws SVNException { if (properties == null || properties.isEmpty()) { return; } Map regularProps = new HashMap(); Map entryProps = new HashMap(); Map wcProps = new HashMap(); for (Iterator names = properties.keySet().iterator(); names.hasNext();) { String propName = (String) names.next(); String propValue = (String) properties.get(propName); if (SVNProperty.isEntryProperty(propName)) { entryProps.put(SVNProperty.shortPropertyName(propName), propValue); } else if (SVNProperty.isWorkingCopyProperty(propName)) { wcProps.put(propName, propValue); } else { regularProps.put(propName, propValue); } } SVNVersionedProperties props = base ? dir.getBaseProperties(fileName) : dir.getProperties(fileName); props.removeAll(); for (Iterator propNames = regularProps.keySet().iterator(); propNames.hasNext();) { String propName = (String) propNames.next(); String propValue = (String) regularProps.get(propName); props.setPropertyValue(propName, propValue); } dir.saveVersionedProperties(log, false); log.logChangedEntryProperties(fileName, entryProps); log.logChangedWCProperties(fileName, wcProps); }
protected void categorizeProperties(SVNProperties original, SVNProperties regular, SVNProperties entry, SVNProperties wc) { if (original == null) { return; } for(Iterator propNames = original.nameSet().iterator(); propNames.hasNext();) { String name = (String) propNames.next(); if (regular != null && SVNProperty.isRegularProperty(name)) { regular.put(name, original.getSVNPropertyValue(name)); } else if (entry != null && SVNProperty.isEntryProperty(name)) { entry.put(name, original.getSVNPropertyValue(name)); } else if (wc != null && SVNProperty.isWorkingCopyProperty(name)) { wc.put(name, original.getSVNPropertyValue(name)); } } }
private void changeProperties(EditorEntry entry, String name, SVNPropertyValue value) throws SVNException { //String quotedName = SVNEncodingUtil.xmlEncodeCDATA(name, true); if (getUpdateRequest().isSendAll()) { if (value != null) { writePropertyTag("set-prop", name, value); } else { writeEntryTag("remove-prop", name); } } else if (value != null) { if (SVNProperty.isEntryProperty(name)) { if (SVNProperty.COMMITTED_REVISION.equals(name)) { entry.setCommitedRevision(value.getString()); } else if (SVNProperty.COMMITTED_DATE.equals(name)) { entry.setCommitedDate(value.getString()); } else if (SVNProperty.LAST_AUTHOR.equals(name)) { if (value != null) { entry.setLastAuthor(value.getString()); } } else if (SVNProperty.LOCK_TOKEN.equals(name) && value == null) { entry.addRemovedProperty(name); } return; } if (value == null) { entry.addRemovedProperty(name); } else { entry.setHasChangedProperty(true); } } }
protected void categorizeProperties(SVNProperties original, SVNProperties regular, SVNProperties entry, SVNProperties wc) { if (original == null) { return; } for(Iterator propNames = original.nameSet().iterator(); propNames.hasNext();) { String name = (String) propNames.next(); if (regular != null && SVNProperty.isRegularProperty(name)) { regular.put(name, original.getSVNPropertyValue(name)); } else if (entry != null && SVNProperty.isEntryProperty(name)) { entry.put(name, original.getSVNPropertyValue(name)); } else if (wc != null && SVNProperty.isWorkingCopyProperty(name)) { wc.put(name, original.getSVNPropertyValue(name)); } } }
protected void categorizeProperties(SVNProperties original, SVNProperties regular, SVNProperties entry, SVNProperties wc) { if (original == null) { return; } for(Iterator propNames = original.nameSet().iterator(); propNames.hasNext();) { String name = (String) propNames.next(); if (regular != null && SVNProperty.isRegularProperty(name)) { regular.put(name, original.getSVNPropertyValue(name)); } else if (entry != null && SVNProperty.isEntryProperty(name)) { entry.put(name, original.getSVNPropertyValue(name)); } else if (wc != null && SVNProperty.isWorkingCopyProperty(name)) { wc.put(name, original.getSVNPropertyValue(name)); } } }
public static void categorizeProperties(SVNProperties props, SVNProperties regular, SVNProperties entry, SVNProperties working) { for (String name : props.nameSet()) { SVNPropertyValue pv = props.getSVNPropertyValue(name); if (SVNProperty.isEntryProperty(name) && entry != null) { entry.put(name, pv); } else if (SVNProperty.isRegularProperty(name) && regular != null) { regular.put(name, pv); } else if (SVNProperty.isWorkingCopyProperty(name) && working != null) { working.put(name, pv); } } }
public static void addProperties(SVNAdminArea dir, String fileName, SVNProperties properties, boolean base, SVNLog log) throws SVNException { if (properties == null || properties.isEmpty()) { return; } SVNProperties regularProps = new SVNProperties(); SVNProperties entryProps = new SVNProperties(); SVNProperties wcProps = new SVNProperties(); for (Iterator names = properties.nameSet().iterator(); names.hasNext();) { String propName = (String) names.next(); SVNPropertyValue propValue = properties.getSVNPropertyValue(propName); if (SVNProperty.isEntryProperty(propName)) { entryProps.put(SVNProperty.shortPropertyName(propName), propValue); } else if (SVNProperty.isWorkingCopyProperty(propName)) { wcProps.put(propName, propValue); } else { regularProps.put(propName, propValue); } } SVNVersionedProperties props = base ? dir.getBaseProperties(fileName) : dir.getProperties(fileName); props.removeAll(); for (Iterator propNames = regularProps.nameSet().iterator(); propNames.hasNext();) { String propName = (String) propNames.next(); SVNPropertyValue propValue = regularProps.getSVNPropertyValue(propName); props.setPropertyValue(propName, propValue); } dir.saveVersionedProperties(log, false); log.logChangedEntryProperties(fileName, entryProps); log.logChangedWCProperties(fileName, wcProps); }
public static void addProperties(SVNAdminArea dir, String fileName, SVNProperties properties, boolean base, SVNLog log) throws SVNException { if (properties == null || properties.isEmpty()) { return; } SVNProperties regularProps = new SVNProperties(); SVNProperties entryProps = new SVNProperties(); SVNProperties wcProps = new SVNProperties(); for (Iterator names = properties.nameSet().iterator(); names.hasNext();) { String propName = (String) names.next(); SVNPropertyValue propValue = properties.getSVNPropertyValue(propName); if (SVNProperty.isEntryProperty(propName)) { entryProps.put(SVNProperty.shortPropertyName(propName), propValue); } else if (SVNProperty.isWorkingCopyProperty(propName)) { wcProps.put(propName, propValue); } else { regularProps.put(propName, propValue); } } SVNVersionedProperties props = base ? dir.getBaseProperties(fileName) : dir.getProperties(fileName); props.removeAll(); for (Iterator propNames = regularProps.nameSet().iterator(); propNames.hasNext();) { String propName = (String) propNames.next(); SVNPropertyValue propValue = regularProps.getSVNPropertyValue(propName); props.setPropertyValue(propName, propValue); } dir.saveVersionedProperties(log, false); log.logChangedEntryProperties(fileName, entryProps); log.logChangedWCProperties(fileName, wcProps); }
public static void addProperties(SVNAdminArea dir, String fileName, SVNProperties properties, boolean base, SVNLog log) throws SVNException { if (properties == null || properties.isEmpty()) { return; } SVNProperties regularProps = new SVNProperties(); SVNProperties entryProps = new SVNProperties(); SVNProperties wcProps = new SVNProperties(); for (Iterator names = properties.nameSet().iterator(); names.hasNext();) { String propName = (String) names.next(); SVNPropertyValue propValue = properties.getSVNPropertyValue(propName); if (SVNProperty.isEntryProperty(propName)) { entryProps.put(SVNProperty.shortPropertyName(propName), propValue); } else if (SVNProperty.isWorkingCopyProperty(propName)) { wcProps.put(propName, propValue); } else { regularProps.put(propName, propValue); } } SVNVersionedProperties props = base ? dir.getBaseProperties(fileName) : dir.getProperties(fileName); props.removeAll(); for (Iterator propNames = regularProps.nameSet().iterator(); propNames.hasNext();) { String propName = (String) propNames.next(); SVNPropertyValue propValue = regularProps.getSVNPropertyValue(propName); props.setPropertyValue(propName, propValue); } dir.saveVersionedProperties(log, false); log.logChangedEntryProperties(fileName, entryProps); log.logChangedWCProperties(fileName, wcProps); }
public void changeFileProperty(String path, String propertyName, SVNPropertyValue propertyValue) throws SVNException { if (SVNProperty.isRegularProperty(propertyName)) { if (regularPropChanges == null) { regularPropChanges = new SVNProperties(); } regularPropChanges.put(propertyName, propertyValue); } else if (SVNProperty.isEntryProperty(propertyName)) { if (entryPropChanges == null) { entryPropChanges = new SVNProperties(); } entryPropChanges.put(propertyName, propertyValue); } else if (SVNProperty.isWorkingCopyProperty(propertyName)) { if (davPropChanges == null) { davPropChanges = new SVNProperties(); } davPropChanges.put(propertyName, propertyValue); } }
private SVNProperties getProperties(File localAbsPath, String name) throws SVNException { assert (isAbsolute(localAbsPath)); assert (!SVNProperty.isEntryProperty(name)); SVNProperties properties = null; final SVNWCDbKind wcKind = db.readKind(localAbsPath, true);
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); }
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); }
public static String 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); } SVNAdminArea dir = entry.getKind() == SVNNodeKind.DIR ? access.retrieve(path) : access.retrieve(path.getParentFile()); return dir.getProperties(entry.getName()).getPropertyValue(propName); }
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); }
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_PROPERTY_NAME, "''{0}'' is a wcprop, thus not accessible to clients", propName); SVNErrorManager.error(err, SVNLogType.WC); } else if (SVNProperty.isEntryProperty(propName)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_PROPERTY_NAME, "Property ''{0}'' is an entry property", propName); SVNErrorManager.error(err, SVNLogType.WC);
"''{0}'' is a wcprop, thus not accessible to clients", propName); SVNErrorManager.error(err, SVNLogType.WC); } else if (SVNProperty.isEntryProperty(propName)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_PROPERTY_NAME, "Property ''{0}'' is an entry property", propName);
SVNErrorManager.error(err, SVNLogType.WC); if (SVNProperty.isEntryProperty(propertyName)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_PROPERTY_NAME, "Property ''{0}'' is an entry property", propertyName); SVNErrorManager.error(err, SVNLogType.WC);