Package org.tmatesoft.svn.core.internal.wc.admin

Examples of org.tmatesoft.svn.core.internal.wc.admin.SVNVersionedProperties


                area = wcAccess.open(path, false, 0);
            } catch (SVNException e) {
                break;
            }
            try {
                SVNVersionedProperties properties = area.getProperties("");
                String external = properties.getPropertyValue(SVNProperty.EXTERNALS);
                if (externals != null) {
                    SVNExternalInfo[] infos = SVNWCAccess.parseExternals("", external);
                    for (int i = 0; i < infos.length; i++) {
                        // info's path is relative to path, we should make it relative to the root,
                        // and only if it is child of the root.
View Full Code Here


        }
        for (Iterator ents = adminArea.entries(false); ents.hasNext();) {
            SVNEntry entry = (SVNEntry) ents.next();
            if (target != null) {
                if (entry.isFile() && target.equals(entry.getName())) {
                    SVNVersionedProperties props = adminArea.getWCProperties(entry.getName());
                    props.setPropertyValue(SVNProperty.WC_URL, null);
                    adminArea.saveWCProperties(false);
                }
                continue;
            }
            if (entry.isFile() || adminArea.getThisDirName().equals(entry.getName())) {
                SVNVersionedProperties props = adminArea.getWCProperties(entry.getName());
                props.setPropertyValue(SVNProperty.WC_URL, null);
                adminArea.saveWCProperties(false);
            } else {
                SVNAdminArea childArea = myAdminInfo.getWCAccess().getAdminArea(adminArea.getFile(entry.getName()));
                clearWCProperty(childArea, null);
            }
View Full Code Here

        if (modifiedWCProps != null || modifiedEntryProps != null || modifiedProps != null) {
            SVNLog log = myCurrentDirectory.getLog();
            if (modifiedProps != null && !modifiedProps.isEmpty()) {
                myAdminInfo.addExternals(adminArea, (String) modifiedProps.get(SVNProperty.EXTERNALS));

                SVNVersionedProperties oldBaseProps = adminArea.getBaseProperties(adminArea.getThisDirName());
                try {
                    propStatus = adminArea.mergeProperties(adminArea.getThisDirName(), oldBaseProps.asMap(), modifiedProps, true, false, log);
                } catch (SVNException svne) {
                    SVNErrorMessage err = svne.getErrorMessage().wrap("Couldn't do property merge");
                    SVNErrorManager.error(err, svne);
                }
            }
View Full Code Here

            modifiedProps.containsKey(SVNProperty.KEYWORDS) ||
            modifiedProps.containsKey(SVNProperty.EOL_STYLE) ||
            modifiedProps.containsKey(SVNProperty.SPECIAL);
        }
       
        SVNVersionedProperties baseProps = adminArea.getBaseProperties(name);
        Map oldBaseProps = baseProps != null ? baseProps.asMap() : null;
        SVNStatusType propStatus = adminArea.mergeProperties(name, oldBaseProps, modifiedProps, true, false, log);
        if (modifiedEntryProps != null) {
            lockStatus = log.logChangedEntryProperties(name, modifiedEntryProps);
        }

        boolean isLocalPropsModified = !myCurrentFile.IsAdded && adminArea.hasPropModifications(name);
        if (modifiedProps != null && !isLocalPropsModified) {
            command.put(SVNLog.NAME_ATTR, name);
            command.put(SVNProperty.shortPropertyName(SVNProperty.PROP_TIME), SVNLog.WC_TIMESTAMP);
            log.addCommand(SVNLog.MODIFY_ENTRY, command, false);
            command.clear();
        }
        if (modifiedWCProps != null) {
            log.logChangedWCProperties(name, modifiedWCProps);
        }

        boolean isReplaced = false;
        boolean useRevertBase = false;
        if (!isLocallyModified) {
            SVNEntry entry = adminArea.getEntry(name, false);
            if (entry != null && entry.isScheduledForReplacement()) {
                isReplaced = true;
            }
            if (isReplaced && entry.getCopyFromURL() != null) {
                useRevertBase = true;
            }
        }
       
        //merge contents.
        String adminDir = SVNFileUtil.getAdminDirectoryName();
        File textTmpBase;
        if (useRevertBase) {
            textTmpBase = adminArea.getFile(SVNAdminUtil.getTextRevertPath(name, true));
        } else {
            textTmpBase = adminArea.getBaseFile(name, true);
        }
        File workingFile = adminArea.getFile(name);
        String tmpPath = null;
        String basePath = null;

        if (myCurrentFile.TextUpdated && textTmpBase.exists()) {
            if (!isReplaced) {
                tmpPath = adminDir + "/tmp/text-base/" + name + ".svn-base";
                basePath = adminDir + "/text-base/" + name + ".svn-base";
            } else {
                tmpPath = adminDir + "/tmp/text-base/" + name + ".svn-revert";
                basePath = adminDir + "/text-base/" + name + ".svn-revert";
            }
        } else if (!myCurrentFile.TextUpdated && magicPropsChanged && workingFile.exists()) {
            // only props were changed, but we have to retranslate file.
            // only if wc file exists (may be locally deleted), otherwise no
            // need to retranslate...
            tmpPath = SVNAdminUtil.getTextBasePath(name, true);
            command.put(SVNLog.NAME_ATTR, name);
            command.put(SVNLog.DEST_ATTR, tmpPath);
            log.addCommand(SVNLog.COPY_AND_DETRANSLATE, command, false);
            command.clear();
            command.put(SVNLog.NAME_ATTR, tmpPath);
            command.put(SVNLog.DEST_ATTR, name);
            log.addCommand(SVNLog.COPY_AND_TRANSLATE, command, false);
            command.clear();
        }
       
        // update entry.
        command.put(SVNLog.NAME_ATTR, name);
        command.put(SVNProperty.shortPropertyName(SVNProperty.KIND), SVNProperty.KIND_FILE);
        command.put(SVNProperty.shortPropertyName(SVNProperty.REVISION), Long.toString(myTargetRevision));
        command.put(SVNProperty.shortPropertyName(SVNProperty.DELETED), Boolean.FALSE.toString());
        command.put(SVNProperty.shortPropertyName(SVNProperty.ABSENT), Boolean.FALSE.toString());
        if (myCurrentFile.URL != null) {
            command.put(SVNProperty.shortPropertyName(SVNProperty.URL), myCurrentFile.URL);
        }
        log.addCommand(SVNLog.MODIFY_ENTRY, command, false);
        command.clear();

        if (myCurrentFile.TextUpdated && textTmpBase.exists()) {
            textStatus = SVNStatusType.CHANGED;
            // there is a text replace working copy with.
            if (!isLocallyModified && !isReplaced) {
                command.put(SVNLog.NAME_ATTR, tmpPath);
                command.put(SVNLog.DEST_ATTR, name);
                log.addCommand(SVNLog.COPY_AND_TRANSLATE, command, false);
                command.clear();
            } else {
                SVNFileType kind = SVNFileType.getType(workingFile);
                if (kind == SVNFileType.NONE) {
                    command.put(SVNLog.NAME_ATTR, tmpPath);
                    command.put(SVNLog.DEST_ATTR, name);
                    log.addCommand(SVNLog.COPY_AND_TRANSLATE, command, false);
                    command.clear();
                } else {
                    SVNEntry entry = adminArea.getEntry(name, false);
                    if (entry == null) {
                        SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNVERSIONED_RESOURCE, "''{0}'' is not under version control", workingFile);
                        SVNErrorManager.error(err);
                    }
                    // do test merge.
                    String oldEolStyle = null;
                    String oldKeywords = null;
                    SVNVersionedProperties props = adminArea.getProperties(myCurrentFile.Name);
                    try {
                        if (magicPropsChanged &&
                                (modifiedProps.containsKey(SVNProperty.EOL_STYLE) || modifiedProps.containsKey(SVNProperty.KEYWORDS))) {
                            // use new valuse to let dry-run merge use the same input as real merge will use.
                            oldKeywords = props.getPropertyValue(SVNProperty.KEYWORDS);
                            oldEolStyle = props.getPropertyValue(SVNProperty.EOL_STYLE);
                            props.setPropertyValue(SVNProperty.EOL_STYLE, (String) modifiedProps.get(SVNProperty.EOL_STYLE));
                            props.setPropertyValue(SVNProperty.KEYWORDS, (String) modifiedProps.get(SVNProperty.KEYWORDS));
                        }
                        textStatus = adminArea.mergeText(name, adminArea.getFile(basePath), adminArea.getFile(tmpPath), "", "", "", myIsLeaveConflicts, true);
                    } finally {
                        if (magicPropsChanged &&
                                (modifiedProps.containsKey(SVNProperty.EOL_STYLE) || modifiedProps.containsKey(SVNProperty.KEYWORDS))) {
                            // restore original values.
                            props.setPropertyValue(SVNProperty.EOL_STYLE, oldEolStyle);
                            props.setPropertyValue(SVNProperty.KEYWORDS, oldKeywords);
                        }
                    }
                    if (textStatus == SVNStatusType.UNCHANGED) {
                        textStatus = SVNStatusType.MERGED;
                    }
View Full Code Here

                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);
    }
View Full Code Here

        return dir.getWCProperties(entry.getName()).getPropertyValue(propName);
    }
   
    public static void deleteWCProperties(SVNAdminArea dir, String name, boolean recursive) throws SVNException {
        if (name != null) {
            SVNVersionedProperties props = dir.getWCProperties(name);
            if (props != null) {
                props.removeAll();
            }
        }
        if (recursive || name == null) {
            for(Iterator entries = dir.entries(false); entries.hasNext();) {
                SVNEntry entry = (SVNEntry) entries.next();
                SVNVersionedProperties props = dir.getWCProperties(entry.getName());
                if (props != null) {
                    props.removeAll();
                }
                if (entry.isFile() || dir.getThisDirName().equals(entry.getName())) {
                    continue;
                }
                if (recursive) {
View Full Code Here

                SVNFileUtil.setReadonly(path, false);
            } else {
                propValue = SVNProperty.getValueOfBooleanProperty(propName);
            }
        }
        SVNVersionedProperties properties = dir.getProperties(entry.getName());
        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);
        }
        SVNLog log = dir.getLog();
        if (updateTimeStamp) {
            Map command = new HashMap();
            command.put(SVNLog.NAME_ATTR, entry.getName());
            command.put(SVNProperty.shortPropertyName(SVNProperty.TEXT_TIME), null);
            log.addCommand(SVNLog.MODIFY_ENTRY, command, false);
        }
        properties.setPropertyValue(propName, propValue);
        dir.saveVersionedProperties(log, false);
        log.save();
        dir.runLogs();
    }
View Full Code Here

            target = "";
        } else {
            dir = wcAccess.retrieve(item.getFile().getParentFile());
            target = SVNPathUtil.tail(item.getPath());
        }
        SVNVersionedProperties wcProps = dir.getWCProperties(target);
        return wcProps.getPropertyValue(name);
    }
View Full Code Here

        SVNEntry entry = dir.getEntry(name, false);
        boolean replaced = false;
        if (entry != null) {
            replaced = entry.isScheduledForReplacement();
        }
        SVNVersionedProperties props = dir.getProperties(name);
        SVNVersionedProperties baseProps = replaced ? null : dir.getBaseProperties(name);
        Map diff = replaced ? props.asMap() : baseProps.compareTo(props).asMap();
        if (diff != null && !diff.isEmpty()) {
            File tmpPropsFile = dir.getPropertiesFile(name, true);
            SVNProperties tmpProps = new SVNProperties(tmpPropsFile, null);
            for(Iterator propNames = props.getPropertyNames(null).iterator(); propNames.hasNext();) {
                String propName = (String) propNames.next();
View Full Code Here

        boolean textModified = false;
        boolean propsModified = false;
        boolean commitLock;

        if (commitAddition) {
            SVNVersionedProperties props = dir.getProperties(entry.getName());
            SVNVersionedProperties baseProps = dir.getBaseProperties(entry.getName());           
            Map propDiff = null;
            if (entry.isScheduledForReplacement()) {
                propDiff = props.asMap();
            } else {
                propDiff = baseProps.compareTo(props).asMap();
            }
            boolean eolChanged = textModified = propDiff != null && propDiff.containsKey(SVNProperty.EOL_STYLE);
            if (entry.getKind() == SVNNodeKind.FILE) {
                if (commitCopy) {
                    textModified = propDiff != null && propDiff.containsKey(SVNProperty.EOL_STYLE);
                    if (!textModified) {
                        textModified = dir.hasTextModifications(entry.getName(), eolChanged);
                    }
                } else {
                    textModified = true;
                }
            }
            propsModified = propDiff != null && !propDiff.isEmpty();
        } else if (!commitDeletion) {
            SVNVersionedProperties props = dir.getProperties(entry.getName());
            SVNVersionedProperties baseProps = dir.getBaseProperties(entry.getName());
            Map propDiff = baseProps.compareTo(props).asMap();
            boolean eolChanged = textModified = propDiff != null && propDiff.containsKey(SVNProperty.EOL_STYLE);
            propsModified = propDiff != null && !propDiff.isEmpty();
            if (entry.getKind() == SVNNodeKind.FILE) {
                textModified = dir.hasTextModifications(entry.getName(),  eolChanged);
            }
View Full Code Here

TOP

Related Classes of org.tmatesoft.svn.core.internal.wc.admin.SVNVersionedProperties

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.