Examples of SVNDirEntry


Examples of org.tmatesoft.svn.core.SVNDirEntry

                    long size = SVNReader.getLong(direntProps, 2);
                    boolean hasProps = SVNReader.getBoolean(direntProps, 3);
                    long createdRevision = SVNReader.getLong(direntProps, 4);
                    Date createdDate = SVNDate.parseDate(SVNReader.getString(direntProps, 5));
                    String lastAuthor = SVNReader.getString(direntProps, 6);
                    handler.handleDirEntry(new SVNDirEntry(url.appendPath(name, false), repositoryRoot, name, kind, size, hasProps, createdRevision, createdDate, lastAuthor));
                }
            }
        } catch (SVNException e) {
            closeSession();
            throw e;
View Full Code Here

Examples of org.tmatesoft.svn.core.SVNDirEntry

    }

    public SVNDirEntry getDir(String path, long revision, boolean includeComment, final Collection entries) throws SVNException {
        Long rev = getRevisionObject(revision);
        // convert path to path relative to repos root.
        SVNDirEntry parentEntry = null;
        try {
            openConnection();
            final SVNURL url = getLocation().setPath(getFullPath(path), false);
            final SVNURL repositoryRoot = getRepositoryRoot(false);
            ISVNDirEntryHandler handler = new ISVNDirEntryHandler() {
                public void handleDirEntry(SVNDirEntry dirEntry) throws SVNException {
                    if (entries != null) {
                        dirEntry = new SVNDirEntry(url.appendPath(dirEntry.getName(), false), repositoryRoot, dirEntry.getName(),
                                dirEntry.getKind(), dirEntry.getSize(), dirEntry.hasProperties(), dirEntry.getRevision(), dirEntry.getDate(), dirEntry.getAuthor());
                        entries.add(dirEntry);
                    }
                }
            };
            path = getRepositoryPath(path);
            // get parent
            Object[] buffer = new Object[]{"stat", path, getRevisionObject(revision)};
            write("(w(s(n)))", buffer);
            authenticate();
            List values = read("(?l)", null, false);
            values = (List) values.get(0);
            if (values != null) {
                List direntProps = SVNReader.parseTuple("wnsr(?s)(?s)", values, null);
                SVNNodeKind kind = SVNNodeKind.parseKind(SVNReader.getString(direntProps, 0));
                long size = SVNReader.getLong(direntProps, 1);
                boolean hasProps = SVNReader.getBoolean(direntProps, 2);
                long createdRevision = SVNReader.getLong(direntProps, 3);
                Date createdDate = SVNDate.parseDate(SVNReader.getString(direntProps, 4));
                String lastAuthor = SVNReader.getString(direntProps, 5);
                parentEntry = new SVNDirEntry(url, repositoryRoot, "", kind, size, hasProps, createdRevision, createdDate, lastAuthor);
            }

            // get entries.
            buffer = new Object[]{"get-dir", path, rev, Boolean.FALSE, Boolean.TRUE};
            write("(w(s(n)ww))", buffer);
            authenticate();
            values = read("rll", null, false);
            revision = values.get(0) != null ? SVNReader.getLong(values, 0) : revision;

            if (handler != null) {
                List dirents = (List) values.get(2);
                for (Iterator iterator = dirents.iterator(); iterator.hasNext();) {
                    SVNItem item = (SVNItem) iterator.next();
                    if (item.getKind() != SVNItem.LIST) {
                        SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_SVN_MALFORMED_DATA, "Dirlist element not a list");
                        SVNErrorManager.error(err, SVNLogType.NETWORK);
                    }
                    List direntProps = SVNReader.parseTuple("swnsr(?s)(?s)", item.getItems(), null);
                    String name = SVNReader.getString(direntProps, 0);
                    SVNNodeKind kind = SVNNodeKind.parseKind(SVNReader.getString(direntProps, 1));
                    long size = SVNReader.getLong(direntProps, 2);
                    boolean hasProps = SVNReader.getBoolean(direntProps, 3);
                    long createdRevision = SVNReader.getLong(direntProps, 4);
                    Date createdDate = SVNDate.parseDate(SVNReader.getString(direntProps, 5));
                    String lastAuthor = SVNReader.getString(direntProps, 6);
                    handler.handleDirEntry(new SVNDirEntry(url.appendPath(name, false), repositoryRoot, name, kind, size, hasProps, createdRevision, createdDate, lastAuthor));
                }
            }

            // get comments.
            if (includeComment && entries != null) {
                Map messages = new SVNHashMap();
                for (Iterator ents = entries.iterator(); ents.hasNext();) {
                    SVNDirEntry entry = (SVNDirEntry) ents.next();
                    Long key = getRevisionObject(entry.getRevision());
                    if (messages.containsKey(key)) {
                        entry.setCommitMessage((String) messages.get(key));
                        continue;
                    }
                    buffer = new Object[]{"rev-prop", key, SVNRevisionProperty.LOG};
                    write("(w(ns))", buffer);
                    authenticate();
                    values = read("(?s)", null, false);
                    String msg = SVNReader.getString(values, 0);
                    messages.put(key, msg);
                    entry.setCommitMessage(msg);
                }
            }
        } catch (SVNException e) {
            closeSession();
            throw e;
View Full Code Here

Examples of org.tmatesoft.svn.core.SVNDirEntry

            SVNURL url = getLocation().setPath(fullPath, false);
            path = getRepositoryPath(path);
            Object[] buffer = new Object[]{"stat", path, getRevisionObject(revision)};
            write("(w(s(n)))", buffer);
            authenticate();
            SVNDirEntry entry = null;
            List items = read("(?l)", null, false);
            if (items == null || items.isEmpty()) {
                return null;
            }
            items = (List) items.get(0);
            if (items != null && !items.isEmpty()) {
                SVNURL repositoryRoot = getRepositoryRoot(false);
                List values = SVNReader.parseTuple("wnsr(?s)(?s)", items, null);
                SVNNodeKind kind = SVNNodeKind.parseKind(SVNReader.getString(values, 0));
                long size = SVNReader.getLong(values, 1);
                boolean hasProperties = SVNReader.getBoolean(values, 2);
                long createdRevision = SVNReader.getLong(values, 3);
                Date createdDate = SVNDate.parseDate(SVNReader.getString(values, 4));
                String lastAuthor = SVNReader.getString(values, 5);
                entry = new SVNDirEntry(url, repositoryRoot, SVNPathUtil.tail(path), kind, size, hasProperties, createdRevision, createdDate, lastAuthor);
            }
            return entry;
        } catch (SVNException e) {
            closeSession();
            handleUnsupportedCommand(e, "'stat' not implemented");
View Full Code Here

Examples of org.tmatesoft.svn.core.SVNDirEntry

        long size = SVNReader.getLong(items, 2);
        boolean hasProps = SVNReader.getBoolean(items, 3);
        long revision = SVNReader.getLong(items, 4);
        Date date = items[5] != null ? SVNTimeUtil.parseDate(SVNReader.getString(items, 5)) : null;
        String author = SVNReader.getString(items, 6);
        return new SVNDirEntry(null, name, kind, size, hasProps, revision, date, author);
    }
View Full Code Here

Examples of org.tmatesoft.svn.core.SVNDirEntry

        long size = SVNReader.getLong(items, 1);
        boolean hasProps = SVNReader.getBoolean(items, 2);
        long revision = SVNReader.getLong(items, 3);
        Date date = items[4] != null ? SVNTimeUtil.parseDate(SVNReader.getString(items, 4)) : null;
        String author = SVNReader.getString(items, 5);
        return new SVNDirEntry(null, null, kind, size, hasProps, revision, date, author);
    }
View Full Code Here

Examples of org.tmatesoft.svn.core.SVNDirEntry

            buffer[1] = properties;
            buffer = read("[(N(*P)", buffer, true);
            revision = buffer[0] != null ? SVNReader.getLong(buffer, 0) : revision;
            ISVNDirEntryHandler nestedHandler = new ISVNDirEntryHandler() {
                public void handleDirEntry(SVNDirEntry dirEntry) throws SVNException {
                    handler.handleDirEntry(new SVNDirEntry(url.appendPath(dirEntry.getName(), false), dirEntry.getName(), dirEntry.getKind(), dirEntry.getSize(), dirEntry.hasProperties(), dirEntry.getRevision(), dirEntry.getDate(), dirEntry.getAuthor()));
                }
            };
            if (handler != null) {
                buffer[0] = nestedHandler;
                read("(*D)))", buffer, true);
View Full Code Here

Examples of org.tmatesoft.svn.core.SVNDirEntry

    }

    public SVNDirEntry getDir(String path, long revision, boolean includeComment, final Collection entries) throws SVNException {
        Long rev = getRevisionObject(revision);
        // convert path to path relative to repos root.
        SVNDirEntry parentEntry = null;
        try {
            openConnection();
            final SVNURL url = getLocation().setPath(getFullPath(path), false);
            ISVNDirEntryHandler handler = new ISVNDirEntryHandler() {
                public void handleDirEntry(SVNDirEntry dirEntry) throws SVNException {
                    dirEntry = new SVNDirEntry(url.appendPath(dirEntry.getName(), false), dirEntry.getName(),
                            dirEntry.getKind(), dirEntry.getSize(), dirEntry.hasProperties(), dirEntry.getRevision(), dirEntry.getDate(), dirEntry.getAuthor());
                    entries.add(dirEntry);
                }           
            };
            path = getRepositoryPath(path);
            // get parent
            Object[] buffer = new Object[] { "stat", path, getRevisionObject(revision) };
            write("(w(s(n)))", buffer);
            authenticate();
            read("[((?F))]", buffer, true);
            parentEntry = (SVNDirEntry) buffer[0];
            parentEntry = new SVNDirEntry(url, "", parentEntry.getKind(), parentEntry.getSize(), parentEntry.hasProperties(), parentEntry.getRevision(), parentEntry.getDate(), parentEntry.getAuthor());

            // get entries.
            buffer = new Object[] { "get-dir", path, rev, Boolean.FALSE, Boolean.TRUE };
            write("(w(s(n)ww))", buffer);
            authenticate();
            buffer = read("[(N(*P)", buffer, true);
            revision = buffer[0] != null ? SVNReader.getLong(buffer, 0) : revision;
            if (handler != null) {
                buffer[0] = handler;
                read("(*D)))", buffer, true);
            } else {
                read("()))", null, true);
            }
            // get comments.
            if (includeComment) {
                Map messages = new HashMap();
                for(Iterator ents = entries.iterator(); ents.hasNext();) {
                    SVNDirEntry entry = (SVNDirEntry) ents.next();
                    Long key = getRevisionObject(entry.getRevision());
                    if (messages.containsKey(key)) {
                        entry.setCommitMessage((String) messages.get(key));
                        continue;
                    }
                    buffer = new Object[] { "rev-prop", key, SVNRevisionProperty.LOG};
                    write("(w(ns))", buffer);
                    authenticate();
                    buffer = read("[((?S))]", buffer, true);
                    messages.put(key, buffer[0]);
                    entry.setCommitMessage((String) buffer[0]);
                }
            }
        } catch (SVNException e) {
            closeSession();
            throw e;
View Full Code Here

Examples of org.tmatesoft.svn.core.SVNDirEntry

            path = getRepositoryPath(path);
            Object[] buffer = new Object[] { "stat", path, getRevisionObject(revision) };
            write("(w(s(n)))", buffer);
            authenticate();
            read("[((?F))]", buffer, true);
            SVNDirEntry entry = (SVNDirEntry) buffer[0];
            if (entry != null) {
                entry = new SVNDirEntry(url, SVNPathUtil.tail(path), entry.getKind(), entry.getSize(), entry.hasProperties(), entry.getRevision(), entry.getDate(), entry.getAuthor());
            }
            return entry;
        } catch (SVNException e) {
            closeSession();
            handleUnsupportedCommand(e, "'stat' not implemented");
View Full Code Here

Examples of org.tmatesoft.svn.core.SVNDirEntry

            log = (String) revProps.get(SVNRevisionProperty.LOG);
            String timeString = (String) revProps.get(SVNRevisionProperty.DATE);
            lastCommitDate = timeString != null ? SVNTimeUtil.parseDateString(timeString) : null;
        }
        SVNURL entryURL = parentURL.appendPath(repEntry.getName(), false);
        SVNDirEntry dirEntry = new SVNDirEntry(entryURL, repEntry.getName(), repEntry.getType(), size, hasProps, repEntry.getId().getRevision(), lastCommitDate, lastAuthor, includeLogs ? log : null);
        dirEntry.setRelativePath(repEntry.getName());
        return dirEntry;
    }
View Full Code Here

Examples of org.tmatesoft.svn.core.SVNDirEntry

            if (handler != null) {
                SVNURL parentURL = getLocation().appendPath(path, false);
                Collection entriesCollection = getDirEntries(parent, parentURL, false);
                Iterator entries = entriesCollection.iterator();
                while (entries.hasNext()) {
                    SVNDirEntry entry = (SVNDirEntry) entries.next();
                    handler.handleDirEntry(entry);
                }
            }
            if (properties != null) {
                properties.putAll(collectProperties(parent));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.