Package org.tmatesoft.svn.core.internal.util

Examples of org.tmatesoft.svn.core.internal.util.SVNHashMap$KeySet


        xmlBuffer = SVNXMLUtil.addXMLHeader(xmlBuffer);
        if (url.endsWith("/")) {
            url = url.substring(0, url.length() - 1);
        }
       
        Map attrs = new SVNHashMap();
        attrs.put("send-all", Boolean.toString(sendAll));
        SVNXMLUtil.openNamespaceDeclarationTag(SVNXMLUtil.SVN_NAMESPACE_PREFIX, "update-report",
                SVN_NAMESPACES_LIST, SVNXMLUtil.PREFIX_MAP, attrs, xmlBuffer, true);
       
        SVNXMLUtil.openCDataTag(SVNXMLUtil.SVN_NAMESPACE_PREFIX, "src-path", url, xmlBuffer);
        if (targetRevision >= 0) {
            SVNXMLUtil.openCDataTag(SVNXMLUtil.SVN_NAMESPACE_PREFIX, "target-revision", String.valueOf(targetRevision), xmlBuffer);
        }
        if (target != null && !"".equals(target)) {
            SVNXMLUtil.openCDataTag(SVNXMLUtil.SVN_NAMESPACE_PREFIX, "update-target", target, xmlBuffer);
        }
        if (dstPath != null) {
            SVNXMLUtil.openCDataTag(SVNXMLUtil.SVN_NAMESPACE_PREFIX, "dst-path", dstPath, xmlBuffer);
        }
        if (depth == SVNDepth.FILES || depth == SVNDepth.EMPTY) {
            SVNXMLUtil.openCDataTag(SVNXMLUtil.SVN_NAMESPACE_PREFIX, "recursive", "no", xmlBuffer);
        }
        SVNXMLUtil.openCDataTag(SVNXMLUtil.SVN_NAMESPACE_PREFIX, "depth", SVNDepth.asString(depth), xmlBuffer);

        if (ignoreAncestry) {
            SVNXMLUtil.openCDataTag(SVNXMLUtil.SVN_NAMESPACE_PREFIX, "ignore-ancestry", "yes", xmlBuffer);
        }
        if (sendCopyFromArgs) {
            SVNXMLUtil.openCDataTag(SVNXMLUtil.SVN_NAMESPACE_PREFIX, "send-copyfrom-args", "yes", xmlBuffer);
        }
        if (resourceWalk) {
            SVNXMLUtil.openCDataTag(SVNXMLUtil.SVN_NAMESPACE_PREFIX, "resource-walk", "yes", xmlBuffer);
        }
        if (sendAll && !fetchContents) {
            SVNXMLUtil.openCDataTag(SVNXMLUtil.SVN_NAMESPACE_PREFIX, "text-deltas", "no", xmlBuffer);
        }
       
        final StringBuffer report = xmlBuffer;
       
        reporterBaton.report(new ISVNReporter() {
            public void setPath(String path, String lockToken, long revision, boolean startEmpty) throws SVNException {
                setPath(path, lockToken, revision, SVNDepth.INFINITY, startEmpty);
            }

            public void deletePath(String path) {
                SVNXMLUtil.openCDataTag(SVNXMLUtil.SVN_NAMESPACE_PREFIX, "missing", path, report);
            }

            public void linkPath(SVNURL url, String path, String lockToken, long revision, boolean startEmpty) throws SVNException {
                linkPath(url, path, lockToken, revision, SVNDepth.INFINITY, startEmpty);
            }

            public void finishReport() {
            }

            public void linkPath(SVNURL url, String path, String lockToken, long revision, SVNDepth depth, boolean startEmpty) throws SVNException {
                Map attrs = new SVNHashMap();
                attrs.put(REVISION_ATTR, String.valueOf(revision));
                attrs.put("depth", SVNDepth.asString(depth));
                if (lockToken != null) {
                    if (lockTokens != null) {
                        lockTokens.put(path, lockToken);
                    }
                    attrs.put("lock-token", lockToken);
                }
                if (startEmpty) {
                    attrs.put("start-empty", Boolean.TRUE.toString());
                }
                String linkedPath = url.getURIEncodedPath();
                DAVBaselineInfo info = DAVUtil.getBaselineInfo(connection, null, linkedPath, revision, false, false, null);
                linkedPath = SVNEncodingUtil.uriDecode(info.baselinePath);
               
                if (!linkedPath.startsWith("/")) {
                    linkedPath = "/" + linkedPath;
                }
               
                attrs.put("linkpath", linkedPath);
                SVNXMLUtil.openCDataTag(SVNXMLUtil.SVN_NAMESPACE_PREFIX, "entry", path, attrs, report);
            }

            public void setPath(String path, String lockToken, long revision, SVNDepth depth, boolean startEmpty) throws SVNException {
                Map attrs = new SVNHashMap();
                attrs.put(REVISION_ATTR, String.valueOf(revision));
                attrs.put("depth", SVNDepth.asString(depth));
                if (lockToken != null) {
                    if (lockTokens != null) {
                        lockTokens.put(path, lockToken);
                    }
                    attrs.put("lock-token", lockToken);
                }
                if (startEmpty) {
                    attrs.put("start-empty", Boolean.TRUE.toString());
                }
                SVNXMLUtil.openCDataTag(SVNXMLUtil.SVN_NAMESPACE_PREFIX, "entry", path, attrs, report);
            }

            public void abortReport() throws SVNException {
View Full Code Here


                myEditor.textDeltaEnd(path);
            }
        };
        init();
        myDirs = new Stack();
        myVersionURLs = new SVNHashMap();
    }
View Full Code Here

            dirInfo.myIsFetchProps = true;
           
            String bcURL = attrs.getValue(BC_URL_ATTR);
            if (!myIsReceiveAll && bcURL != null) {
                DAVElement[] elements = null;
                Map propsMap = new SVNHashMap();
                DAVUtil.getProperties(getConnection(), DAVUtil.getPathFromURL(bcURL), 0, null,
                        elements, propsMap);
               
                if (!propsMap.isEmpty()) {
                    dirInfo.myChildren = new SVNHashMap();
                    for (Iterator propsIter = propsMap.values().iterator(); propsIter.hasNext();) {
                        DAVProperties props = (DAVProperties) propsIter.next();
                        SVNPropertyValue vcURL = props.getPropertyValue(DAVElement.CHECKED_IN);
                        if (vcURL != null) {
                            dirInfo.myChildren.put(vcURL.getString(), props);
                        }
View Full Code Here

        if (element == DAVElement.RESPONSE) {
            if (myCurrentResource != null) {
                invalidXML();
            }
            myCurrentResource = new DAVProperties();
            myCurrentProperties = new SVNHashMap();
            myStatusCode = 0;
        } else if (element == DAVElement.PROPSTAT) {
            myStatusCode = 0;
        } else if (element == DAVElement.COLLECTION) {
            myCurrentResource.setCollection(true);
View Full Code Here

    }

    private static synchronized SAXParserFactory getSAXParserFactory() throws FactoryConfigurationError {
        if (ourSAXParserFactory == null) {
            ourSAXParserFactory = SAXParserFactory.newInstance();
            Map supportedFeatures = new SVNHashMap();
            try {
                ourSAXParserFactory.setFeature("http://xml.org/sax/features/namespaces", true);
                supportedFeatures.put("http://xml.org/sax/features/namespaces", Boolean.TRUE);
            } catch (SAXNotRecognizedException e) {
            } catch (SAXNotSupportedException e) {
            } catch (ParserConfigurationException e) {
            }
            try {
                ourSAXParserFactory.setFeature("http://xml.org/sax/features/validation", false);
                supportedFeatures.put("http://xml.org/sax/features/validation", Boolean.FALSE);
            } catch (SAXNotRecognizedException e) {
            } catch (SAXNotSupportedException e) {
            } catch (ParserConfigurationException e) {
            }
            try {
                ourSAXParserFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
                supportedFeatures.put("http://apache.org/xml/features/nonvalidating/load-external-dtd", Boolean.FALSE);
            } catch (SAXNotRecognizedException e) {
            } catch (SAXNotSupportedException e) {
            } catch (ParserConfigurationException e) {
            }
            if (supportedFeatures.size() < 3) {
                ourSAXParserFactory = SAXParserFactory.newInstance();
                for (Iterator names = supportedFeatures.keySet().iterator(); names.hasNext();) {
                    String name = (String) names.next();
                    try {
                        ourSAXParserFactory.setFeature(name, supportedFeatures.get(name) == Boolean.TRUE);
                    } catch (SAXNotRecognizedException e) {
                    } catch (SAXNotSupportedException e) {
                    } catch (ParserConfigurationException e) {
                    }
                }
View Full Code Here

    protected String[] getLines() {
        return myLines;
    }

    public Map getProperties(String groupName) {
        Map map = new SVNHashMap();
        load();
        boolean groupMatched = false;
        for (int i = 0; i < myLines.length; i++) {
            String line = myLines[i];
            if (line == null) {
                continue;
            }
            if (!groupMatched && matchGroup(line, groupName)) {
                groupMatched = true;
            } else if (groupMatched) {
                if (matchGroup(line, null)) {
                    return map;
                } else if (matchProperty(line, null)) {
                    map.put(getPropertyName(line), getPropertyValue(line));
                }
            }
        }
        return map;
    }
View Full Code Here

                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN);
                SVNErrorManager.error(err, SVNLogType.NETWORK);
            }
            if (myLogEntryHandler != null) {
                if (myPaths == null) {
                    myPaths = new SVNHashMap();
                }
                if (myRevProps == null) {
                    myRevProps = new SVNProperties();
                }
                if (myAuthor != null) {
                    myRevProps.put(SVNRevisionProperty.AUTHOR, myAuthor);
                }
                if (myComment != null) {
                    myRevProps.put(SVNRevisionProperty.LOG, myComment);
                }
                if (myDate != null) {
                    myRevProps.put(SVNRevisionProperty.DATE, SVNDate.formatDate(myDate));
                }
                SVNLogEntry logEntry = new SVNLogEntry(myPaths, myRevision, myRevProps, myHasChildren);
                myLogEntryHandler.handleLogEntry(logEntry);
                if (logEntry.hasChildren()) {
                    myNestLevel++;
                }
                if (logEntry.getRevision() < 0) {
                    myNestLevel = myNestLevel <= 0 ? 0 : myNestLevel -1;
                }
            }
            myPaths = null;
            myRevProps = null;
            myRevision = -1;
            myAuthor = null;
            myDate = null;
            myComment = null;
            myRevPropName = null;
            myHasChildren = false;
        } else if (element == DAVElement.VERSION_NAME && cdata != null) {
            try {
                myRevision = Long.parseLong(cdata.toString());
            } catch (NumberFormatException nfe) {
                SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.RA_DAV_MALFORMED_DATA, nfe), SVNLogType.NETWORK);
            }
        } else if (element == REVPROP) {
            if (myRevProps == null) {
                myRevProps = new SVNProperties();
            }
            if (myRevPropName != null && cdata != null) {
                myRevProps.put(myRevPropName, cdata.toString());
            }
        } else if (element == DAVElement.CREATOR_DISPLAY_NAME && cdata != null) {
            if (myIsWantAuthor) {
                myAuthor = cdata.toString();
            }
        } else if (element == DAVElement.COMMENT && cdata != null) {
            if (myIsWantComment) {
                myComment = cdata.toString();
            }
        } else if (element == DAVElement.DATE && cdata != null) {
            if (myIsWantDate) {
                myDate = SVNDate.parseDate(cdata.toString());
            }
        } else if (element == ADDED_PATH || element == MODIFIED_PATH || element == REPLACED_PATH || element == DELETED_PATH) {
            if (myPath != null && cdata != null) {
                if (myPaths == null) {
                    myPaths = new SVNHashMap();
                }
                myPath.setPath(cdata.toString());
                String path = myPath.getPath();
                myPath.setPath(path);
                myPaths.put(myPath.getPath(), myPath);
View Full Code Here

        if (parentEntry.isScheduledForDeletion()) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.WC_SCHEDULE_CONFLICT,
                    "Can''t add ''{0}'' to a parent directory scheduled for deletion", path);
            SVNErrorManager.error(err, SVNLogType.WC);
        }
        Map command = new SVNHashMap();
        String name = path.getName();
        if (copyFromURL != null) {
            if (parentEntry.getRepositoryRoot() != null && !SVNPathUtil.isAncestor(parentEntry.getRepositoryRoot(), copyFromURL.toString())) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNSUPPORTED_FEATURE,
                        "The URL ''{0}'' has a different repository root than its parent", copyFromURL);
                SVNErrorManager.error(err, SVNLogType.WC);
            }
            command.put(SVNProperty.COPYFROM_URL, copyFromURL.toString());
            command.put(SVNProperty.COPYFROM_REVISION, SVNProperty.toString(copyFromRev));
            command.put(SVNProperty.COPIED, Boolean.TRUE.toString());
        }
        if (replace) {
            command.put(SVNProperty.CHECKSUM, null);
            command.put(SVNProperty.HAS_PROPS, Boolean.FALSE.toString());
            command.put(SVNProperty.HAS_PROP_MODS, Boolean.FALSE.toString());
        }
        command.put(SVNProperty.SCHEDULE, SVNProperty.SCHEDULE_ADD);
        command.put(SVNProperty.KIND, SVNFileType.getNodeKind(fileType).toString());
        if (!(replace || copyFromURL != null)) {
            command.put(SVNProperty.REVISION, "0");
        }
        parentDir.modifyEntry(name, command, true, false);

        if (entry != null && copyFromURL == null) {
            String propPath = SVNAdminUtil.getPropPath(name, entry.getKind(), false);
            File propFile = dir.getFile(propPath);
            SVNFileUtil.deleteFile(propFile);
        }
        if (replace) {
            SVNProperties props = new SVNProperties();
            SVNLog log = parentDir.getLog();
            if (entry.getKind() == SVNNodeKind.FILE) {
                props.put(SVNLog.NAME_ATTR, SVNAdminUtil.getTextBasePath(entry.getName(), false));
                props.put(SVNLog.DEST_ATTR, SVNAdminUtil.getTextRevertPath(entry.getName(), false));
                log.addCommand(SVNLog.MOVE, props, false);
            }
            createRevertProperties(parentDir, log, entry.getName(), true);
            log.save();
            parentDir.runLogs();
        }
        if (kind == SVNNodeKind.DIR) {
            if (copyFromURL == null) {
                SVNEntry pEntry = wcAccess.getEntry(path.getParentFile(), false);
                SVNURL newURL = pEntry.getSVNURL().appendPath(name, false);
                SVNURL rootURL = pEntry.getRepositoryRootURL();
                String uuid = pEntry.getUUID();
                ensureAdminAreaExists(path, newURL.toString(), rootURL != null ? rootURL.toString() : null, uuid, 0, depth == null ? SVNDepth.INFINITY : depth);
            } else {
                SVNURL rootURL = parentEntry.getRepositoryRootURL();
                ensureAdminAreaExists(path, copyFromURL.toString(), rootURL != null ? rootURL.toString() : null, parentEntry.getUUID(),
                        copyFromRev, depth == null ? SVNDepth.INFINITY : depth);
            }
            if (entry == null || entry.isDeleted()) {
                dir = wcAccess.open(path, true, copyFromURL != null ? SVNWCAccess.INFINITE_DEPTH : 0);
            }
            command.put(SVNProperty.INCOMPLETE, null);
            command.put(SVNProperty.SCHEDULE, replace ? SVNProperty.SCHEDULE_REPLACE : SVNProperty.SCHEDULE_ADD);
            dir.modifyEntry(dir.getThisDirName(), command, true, true);
            if (copyFromURL != null) {
                SVNURL newURL = parentEntry.getSVNURL().appendPath(name, false);
                updateCleanup(path, wcAccess, newURL.toString(), parentEntry.getRepositoryRoot(), -1, false, null, SVNDepth.INFINITY, false);
                markTree(dir, null, true, false, COPIED | KEEP_LOCAL);
View Full Code Here

    // this method is not applicable for "this dir" entry, use markTree() for that case
    public static void markEntry(SVNAdminArea dir, SVNEntry entry, String schedule, boolean copied, boolean keepLocal, int flags) throws SVNException {
        if (dir.getThisDirName().equals(entry.getName())) {
            return;
        }
        Map attributes = new SVNHashMap();
        File path = dir.getFile(entry.getName());
        if (entry.getKind() == SVNNodeKind.DIR) {
            SVNAdminArea childDir = dir.getWCAccess().retrieve(path);
            markTree(childDir, schedule, copied, keepLocal, flags);
        }

        if ((flags & SCHEDULE) != 0) {
            attributes.put(SVNProperty.SCHEDULE, schedule);
        }

        if ((flags & COPIED) != 0) {
            attributes.put(SVNProperty.COPIED, copied ? Boolean.TRUE.toString() : null);
        }

        dir.modifyEntry(entry.getName(), attributes, true, false);

        if (copied) {
View Full Code Here

        for (Iterator entries = dir.entries(false); entries.hasNext();) {
            SVNEntry entry = (SVNEntry) entries.next();
            markEntry(dir, entry, schedule, copied, keepLocal, flags);
        }

        Map attributes = new SVNHashMap();
        SVNEntry dirEntry = dir.getEntry(dir.getThisDirName(), false);
        if (!(dirEntry.isScheduledForAddition() && SVNProperty.SCHEDULE_DELETE.equals(schedule))) {
            if ((flags & SCHEDULE) != 0) {
                attributes.put(SVNProperty.SCHEDULE, schedule);
            }
            if ((flags & COPIED) != 0) {
                attributes.put(SVNProperty.COPIED, copied ? Boolean.TRUE.toString() : null);
            }
        }

        if ((flags & KEEP_LOCAL) != 0 && keepLocal) {
            attributes.put(SVNProperty.KEEP_LOCAL, SVNProperty.toString(true));
        }

        if (attributes.size() > 0) {
            dir.modifyEntry(dir.getThisDirName(), attributes, true, false);
            attributes.clear();
        }

        dir.saveEntries(false);
    }
View Full Code Here

TOP

Related Classes of org.tmatesoft.svn.core.internal.util.SVNHashMap$KeySet

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.