Package org.tmatesoft.svn.core

Examples of org.tmatesoft.svn.core.SVNPropertyValue


                    FSRevisionNode node = myRoot.getRevisionNode(absPath);
                    SVNProperties newProps = node.getProperties(myOwner);
                    SVNProperties propDiff = FSRepositoryUtil.getPropsDiffs(oldProps, newProps);
                    for (Iterator propNames = propDiff.nameSet().iterator(); propNames.hasNext();) {
                        String propName = (String) propNames.next();
                        SVNPropertyValue propValue = propDiff.getSVNPropertyValue(propName);
                        if (kind == SVNNodeKind.DIR) {
                            editor.changeDirProperty(propName, propValue);
                        } else if (kind == SVNNodeKind.FILE) {
                            editor.changeFileProperty(path, propName, propValue);
                        }
View Full Code Here


        FSRevisionNode node = srcRoot.getRevisionNode(srcPath);

        SVNProperties props = node.getProperties(myOwner);
        for (Iterator names = props.nameSet().iterator(); names.hasNext();) {
            String propName = (String) names.next();
            SVNPropertyValue propValue = props.getSVNPropertyValue(propName);
            editor.changeDirProperty(propName, propValue);
        }

        Map entries = node.getDirEntries(myOwner);
        for (Iterator entryNames = entries.keySet().iterator(); entryNames.hasNext();) {
            String entryName = (String) entryNames.next();
            FSEntry entry = (FSEntry) entries.get(entryName);
            String newPath = SVNPathUtil.append(path, entry.getName());

            if (entry.getType() == SVNNodeKind.DIR) {
                addSubdirectory(srcRoot, tgtRoot, editor, SVNPathUtil.append(srcPath, entry.getName()), newPath);
                editor.closeDir();
            } else if (entry.getType() == SVNNodeKind.FILE) {
                editor.addFile(SVNPathUtil.append(path, entry.getName()), null, -1);
                String newSrcPath = SVNPathUtil.append(srcPath, entry.getName());
                FSRevisionNode srcNode = srcRoot.getRevisionNode(newSrcPath);

                props = srcNode.getProperties(myOwner);
                for (Iterator names = props.nameSet().iterator(); names.hasNext();) {
                    String propName = (String) names.next();
                    SVNPropertyValue propValue = props.getSVNPropertyValue(propName);
                    editor.changeFileProperty(newPath, propName, propValue);
                }

                editor.applyTextDelta(newPath, null);
View Full Code Here

        FSRevisionNode targetNode = getTargetRoot().getRevisionNode(targetPath);
        long createdRevision = targetNode.getCreatedRevision();

        if (FSRepository.isValidRevision(createdRevision)) {
            SVNProperties entryProps = myFSFS.compoundMetaProperties(createdRevision);
            SVNPropertyValue committedRevision = entryProps.getSVNPropertyValue(SVNProperty.COMMITTED_REVISION);
            changeProperty(editPath, SVNProperty.COMMITTED_REVISION, committedRevision, isDir);
            SVNPropertyValue committedDate = entryProps.getSVNPropertyValue(SVNProperty.COMMITTED_DATE);

            if (committedDate != null || sourcePath != null) {
                changeProperty(editPath, SVNProperty.COMMITTED_DATE, committedDate, isDir);
            }

            SVNPropertyValue lastAuthor = entryProps.getSVNPropertyValue(SVNProperty.LAST_AUTHOR);

            if (lastAuthor != null || sourcePath != null) {
                changeProperty(editPath, SVNProperty.LAST_AUTHOR, lastAuthor, isDir);
            }

            SVNPropertyValue uuid = entryProps.getSVNPropertyValue(SVNProperty.UUID);

            if (uuid != null || sourcePath != null) {
                changeProperty(editPath, SVNProperty.UUID, uuid, isDir);
            }
        }
View Full Code Here

            }
           
            if (outgoingProperties != null) {
                for (Iterator propsIter = outgoingProperties.keySet().iterator(); propsIter.hasNext();) {
                    String propName = (String) propsIter.next();
                    SVNPropertyValue propValue = (SVNPropertyValue) outgoingProperties.get(propName);
                    if (item.getKind() == SVNNodeKind.FILE) {
                        commitEditor.changeFileProperty(commitPath, propName, propValue);
                    } else {
                        commitEditor.changeDirProperty(propName, propValue);
                    }
                }
                outgoingProperties = null;
            }
        }
       
        if (item.isPropertiesModified()) {
            if (item.getKind() == SVNNodeKind.FILE) {
                if (!fileOpen) {
                    try {
                        commitEditor.openFile(commitPath, rev);
                    } catch (SVNException e) {
                        fixError(commitPath, e, SVNNodeKind.FILE);
                    }
                }
                fileOpen = true;
            } else if (!item.isAdded()) {
                // do not open dir twice.
                try {
                    if ("".equals(commitPath)) {
                        commitEditor.openRoot(rev);
                    } else {
                        commitEditor.openDir(commitPath, rev);
                    }
                } catch (SVNException svne) {
                    fixError(commitPath, svne, SVNNodeKind.DIR);
                }
                closeDir = true;
            }

            try {
                sendPropertiesDelta(commitPath, item, commitEditor);
            } catch (SVNException e) {
                fixError(commitPath, e, item.getKind());
            }
           
            if (outgoingProperties != null) {
                for (Iterator propsIter = outgoingProperties.keySet().iterator(); propsIter.hasNext();) {
                    String propName = (String) propsIter.next();
                    SVNPropertyValue propValue = (SVNPropertyValue) outgoingProperties.get(propName);
                    if (item.getKind() == SVNNodeKind.FILE) {
                        commitEditor.changeFileProperty(commitPath, propName, propValue);
                    } else {
                        commitEditor.changeDirProperty(propName, propValue);
                    }
View Full Code Here

        if (diff != null && !diff.isEmpty()) {
            File tmpPropsFile = dir.getPropertiesFile(name, true);
            SVNWCProperties tmpProps = new SVNWCProperties(tmpPropsFile, null);
            for(Iterator propNames = props.getPropertyNames(null).iterator(); propNames.hasNext();) {
                String propName = (String) propNames.next();
                SVNPropertyValue propValue = props.getPropertyValue(propName);
                tmpProps.setPropertyValue(propName, propValue);
            }
            if (!tmpPropsFile.exists()) {
                // create empty tmp (!) file just to make sure it will be used on post-commit.
                SVNFileUtil.createEmptyFile(tmpPropsFile);
            }
            myTmpFiles.add(tmpPropsFile);

            for (Iterator names = diff.nameSet().iterator(); names.hasNext();) {
                String propName = (String) names.next();
                SVNPropertyValue value = diff.getSVNPropertyValue(propName);
                if (item.getKind() == SVNNodeKind.FILE) {
                    editor.changeFileProperty(commitPath, propName, value);
                } else {
                    editor.changeDirProperty(propName, value);
                }
View Full Code Here

    public abstract boolean containsProperty(String name) throws SVNException;
   
    public abstract SVNPropertyValue getPropertyValue(String name) throws SVNException;

    public String getStringPropertyValue(String name) throws SVNException {
        SVNPropertyValue value = getPropertyValue(name);
        return value == null ? null : value.getString();
    }
View Full Code Here

        log.addCommand(SVNLog.COMMIT, command, false);
        command.clear();
        if (wcPropChanges != null && !wcPropChanges.isEmpty()) {
            for (Iterator propNames = wcPropChanges.nameSet().iterator(); propNames.hasNext();) {
                String propName = (String) propNames.next();
                SVNPropertyValue propValue = wcPropChanges.getSVNPropertyValue(propName);
                command.put(SVNLog.NAME_ATTR, target);
                command.put(SVNLog.PROPERTY_NAME_ATTR, propName);
                command.put(SVNLog.PROPERTY_VALUE_ATTR, propValue);
                log.addCommand(SVNLog.MODIFY_WC_PROPERTY, command, false);
                command.clear();
View Full Code Here

        return this;
    }

    private void handleCharsetProperty(SVNAdminArea adminArea, SVNLog log, SVNEntry entry, SVNVersionedProperties baseProps) throws SVNException {
        SVNProperties command = new SVNProperties();
        SVNPropertyValue charsetProp = baseProps.getPropertyValue(SVNProperty.CHARSET);
        String currentCharset = charsetProp == null ? null : charsetProp.getString();
        currentCharset = SVNTranslator.getCharset(currentCharset, getAdminFile(entry.getName()).toString(), getWCAccess().getOptions());
        if (currentCharset != null && !SVNProperty.isUTF8(currentCharset)) {
            File detranslatedFile = SVNAdminUtil.createTmpFile(this, "detranslated", ".tmp", true);
            String detranslatedPath = SVNPathUtil.getRelativePath(getRoot().getAbsolutePath(), detranslatedFile.getAbsolutePath());
            File tmpCharsetPropFile = SVNAdminUtil.createTmpFile(this, "props", ".tmp", true);
View Full Code Here

    public static boolean setWCProperty(SVNWCAccess access, File path, String propName, SVNPropertyValue propValue,
                                        boolean write) throws SVNException {
        SVNEntry entry = access.getVersionedEntry(path, false);
        SVNAdminArea dir = entry.getKind() == SVNNodeKind.DIR ? access.retrieve(path) : access.retrieve(path.getParentFile());
        SVNVersionedProperties wcProps = dir.getWCProperties(entry.getName());
        SVNPropertyValue oldValue = wcProps.getPropertyValue(propName);
        wcProps.setPropertyValue(propName, propValue);
        if (write) {
            dir.saveWCProperties(false);
        }
        return oldValue == null ? propValue != null : !oldValue.equals(propValue);
    }
View Full Code Here

                        SVNFileUtil.closeFile(is);
                    }
                }

                public boolean fileIsBinary() throws SVNException {
                    SVNPropertyValue mimeType = getProperty(access, path, SVNProperty.MIME_TYPE);
                    return mimeType != null && SVNProperty.isBinaryMimeType(mimeType.getString());
                }
            });
        }

        if (entry.getKind() == SVNNodeKind.FILE && SVNProperty.EXECUTABLE.equals(propName)) {
            if (propValue == null) {
                SVNFileUtil.setExecutable(path, false);
            } else {
                propValue = SVNProperty.getValueOfBooleanProperty(propName);
                SVNFileUtil.setExecutable(path, true);
            }
        }
        if (entry.getKind() == SVNNodeKind.FILE && SVNProperty.NEEDS_LOCK.equals(propName)) {
            if (propValue == null) {
                SVNFileUtil.setReadonly(path, false);
            } else {
                propValue = SVNProperty.getValueOfBooleanProperty(propName);
            }
        }
        SVNVersionedProperties properties = dir.getProperties(entry.getName());
        SVNPropertyValue oldValue = properties.getPropertyValue(propName);
        SVNEventAction action;
        if (oldValue == null) {
            if (propValue == null) {
                action = SVNEventAction.PROPERTY_DELETE_NONEXISTENT;
            } else {
                action = SVNEventAction.PROPERTY_ADD;
            }
        } else {
            if (propValue == null) {
                action = SVNEventAction.PROPERTY_DELETE;
            } else {
                action = SVNEventAction.PROPERTY_MODIFY;
            }
          
        }
        if (!updateTimeStamp && (entry.getKind() == SVNNodeKind.FILE && SVNProperty.KEYWORDS.equals(propName))) {
            Collection oldKeywords = getKeywords(oldValue == null ? null : oldValue.getString());
            Collection newKeywords = getKeywords(propValue == null ? null : propValue.getString());
            updateTimeStamp = !oldKeywords.equals(newKeywords);
        }
        SVNLog log = dir.getLog();
        if (updateTimeStamp) {
            SVNProperties command = new SVNProperties();
            command.put(SVNLog.NAME_ATTR, entry.getName());
            command.put(SVNProperty.shortPropertyName(SVNProperty.TEXT_TIME), (String) null);
            log.addCommand(SVNLog.MODIFY_ENTRY, command, false);
        }
        properties.setPropertyValue(propName, propValue);
        dir.saveVersionedProperties(log, false);
        log.save();
        dir.runLogs();
        final boolean modified = oldValue == null ? propValue != null : !oldValue.equals(propValue);
        if (modified || action == SVNEventAction.PROPERTY_DELETE_NONEXISTENT) {
            dir.getWCAccess().handleEvent(new SVNEvent(path, entry.getKind(), null, -1, null, null, null, null, action, action, null, null, null));
        }
        return modified;
    }
View Full Code Here

TOP

Related Classes of org.tmatesoft.svn.core.SVNPropertyValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.