Package org.exist.versioning.svn.internal.wc.admin

Examples of org.exist.versioning.svn.internal.wc.admin.SVNEntry


        }

        SVNWCAccess wcAccess = createWCAccess();
        try {
            wcAccess.probeOpen(path, true, admLockLevel);
            SVNEntry entry = wcAccess.getVersionedEntry(path, false);
            if (SVNDepth.FILES.compareTo(depth) <= 0 && entry.isDirectory()) {
                PropSetHandlerExt entryHandler = new PropSetHandlerExt(skipChecks, propertyValueProvider, handler, changeLists);
                wcAccess.walkEntries(path, entryHandler, false, depth);
            } else if (SVNWCAccess.matchesChangeList(changeLists, entry)) {
                SVNAdminArea adminArea = entry.getAdminArea();
                setLocalProperties(path, entry, adminArea, skipChecks, propertyValueProvider, handler);
            }
        } finally {
            wcAccess.close();
        }
View Full Code Here


        } else {
            SVNWCAccess wcAccess = createWCAccess();
            try {
                int admDepth = getLevelsToLockFromDepth(depth);
                SVNAdminArea area = wcAccess.probeOpen(path, false, admDepth);
                SVNEntry entry = wcAccess.getVersionedEntry(path, false);
                boolean base = revision == SVNRevision.BASE || revision == SVNRevision.COMMITTED;
                doGetLocalProperty(entry, area, propName, base, handler, depth, changeLists);
            } finally {
                wcAccess.close();
            }
View Full Code Here

            SVNAdminAreaInfo areaInfo = wcAccess.openAnchor(path, true, SVNWCAccess.INFINITE_DEPTH);
            SVNAdminArea anchor = areaInfo.getAnchor();
            if (path.equals(anchor.getRoot().getAbsoluteFile())) {
                SVNWCManager.markTree(anchor, SVNProperty.SCHEDULE_REPLACE, false, false, SVNWCManager.SCHEDULE);
            } else {
                SVNEntry entry = anchor.getEntry(path.getName(), false);
                SVNWCManager.markEntry(anchor, entry, SVNProperty.SCHEDULE_REPLACE, false, false, SVNWCManager.SCHEDULE);
            }
            anchor.saveEntries(false);
        } finally {
            wcAccess.close();
View Full Code Here

                path = path.getAbsoluteFile();
                SVNWCAccess wcAccess = createWCAccess();
                try {
                    int admLockLevel = getLevelsToLockFromDepth(depth);
                    SVNAdminAreaInfo info = wcAccess.openAnchor(path, true, admLockLevel);
                    SVNEntry entry = wcAccess.getEntry(path, false);
                    if (entry != null && entry.isDirectory() && entry.isScheduledForAddition()) {
                        if (depth != SVNDepth.INFINITY) {
                            getDebugLog().logFine(SVNLogType.WC,
                                    "Forcing revert on path '" + path + "' to recurse");
                            depth = SVNDepth.INFINITY;
                            wcAccess.close();
View Full Code Here

                    SVNErrorManager.error(error, SVNLogType.WC);
                }
            };

            if (depth == SVNDepth.EMPTY) {
                SVNEntry entry = wcAccess.getEntry(path, false);
                if (entry != null) {
                    resolveEntryHandler.handleEntry(path, entry);
                } else {
                    SVNTreeConflictDescription tc = wcAccess.getTreeConflict(path);
                    if (tc != null) {
View Full Code Here

                public void handleLock(String path, SVNLock lock, SVNErrorMessage error) throws SVNException {
                    SVNURL fullURL = rootURL.appendPath(path, false);
                    LockInfo lockInfo = (LockInfo) entriesMap.get(fullURL);
                    SVNAdminArea dir = wcAccess.probeRetrieve(lockInfo.myFile);
                    if (error == null) {
                        SVNEntry entry = wcAccess.getVersionedEntry(lockInfo.myFile, false);
                        entry.setLockToken(lock.getID());
                        entry.setLockComment(lock.getComment());
                        entry.setLockOwner(lock.getOwner());
                        entry.setLockCreationDate(SVNDate.formatDate(lock.getCreationDate()));
                        // get properties and values.
                        SVNVersionedProperties props = dir.getProperties(entry.getName());

                        if (props.getPropertyValue(SVNProperty.NEEDS_LOCK) != null) {
                            SVNFileUtil.setReadonly(dir.getFile(entry.getName()), false);
                        }
                        SVNFileUtil.setExecutable(dir.getFile(entry.getName()), props.getPropertyValue(SVNProperty.EXECUTABLE) != null);
                        dir.saveEntries(false);
                        handleEvent(SVNEventFactory.createLockEvent(dir.getFile(entry.getName()), SVNEventAction.LOCKED, lock, null),
                                ISVNEventHandler.UNKNOWN);
                    } else {
                        handleEvent(SVNEventFactory.createLockEvent(dir.getFile(lockInfo.myFile.getName()), SVNEventAction.LOCK_FAILED, lock, error),
                                ISVNEventHandler.UNKNOWN);
                    }
View Full Code Here

                    SVNURL fullURL = rootURL.appendPath(path, false);
                    LockInfo lockInfo = (LockInfo) entriesMap.get(fullURL);
                    SVNEventAction action = null;
                    SVNAdminArea dir = wcAccess.probeRetrieve(lockInfo.myFile);
                    if (error == null || (error != null && error.getErrorCode() != SVNErrorCode.FS_LOCK_OWNER_MISMATCH)) {
                        SVNEntry entry = wcAccess.getVersionedEntry(lockInfo.myFile, false);
                        entry.setLockToken(null);
                        entry.setLockComment(null);
                        entry.setLockOwner(null);
                        entry.setLockCreationDate(null);

                        SVNVersionedProperties props = dir.getProperties(entry.getName());

                        if (props.getPropertyValue(SVNProperty.NEEDS_LOCK) != null) {
                            SVNFileUtil.setReadonly(dir.getFile(entry.getName()), true);
                        }
                        dir.saveEntries(false);
                        action = SVNEventAction.UNLOCKED;
                    }
                    if (error != null) {
View Full Code Here

            SVNWCAccess wcAccess = createWCAccess();
            SVNRevision wcRevision = null;
            SVNURL url = null;
            try {
                wcAccess.probeOpen(path, false, 0);
                SVNEntry entry = wcAccess.getVersionedEntry(path, false);
                url = entry.getSVNURL();
                if (url == null) {
                    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.ENTRY_MISSING_URL,
                            "''{0}'' has no URL", path);
                    SVNErrorManager.error(err, SVNLogType.WC);
                }
                wcRevision = SVNRevision.create(entry.getRevision());
            } finally {
                wcAccess.close();
            }
            doInfo(url, pegRevision == null || !pegRevision.isValid() || pegRevision.isLocal() ?
                    wcRevision : pegRevision, revision, depth, handler);
View Full Code Here

            }
        }
        wcAccess.probeOpen(new Resource(commonParentPath).getAbsoluteFile(), true, depth);
        for (int i = 0; i < paths.length; i++) {
            File file = new Resource(commonParentPath, paths[i]);
            SVNEntry entry = wcAccess.getVersionedEntry(file, false);
            if (entry.getURL() == null) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.ENTRY_MISSING_URL, "''{0}'' has no URL", file);
                SVNErrorManager.error(err, SVNLogType.WC);
            }
            if (lock) {
                SVNRevision revision = stealLock ? SVNRevision.UNDEFINED : SVNRevision.create(entry.getRevision());
                lockInfo.put(entry.getSVNURL(), new LockInfo(file, revision));
            } else {
                if (!stealLock && entry.getLockToken() == null) {
                    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_MISSING_LOCK_TOKEN, "''{0}'' is not locked in this working copy", file);
                    SVNErrorManager.error(err, SVNLogType.WC);
                }               
                lockInfo.put(entry.getSVNURL(), new LockInfo(file, stealLock ? null : entry.getLockToken()));
            }
        }
        checkCancelled();
        SVNURL[] urls = (SVNURL[]) lockInfo.keySet().toArray(new SVNURL[lockInfo.size()]);
        Collection urlPaths = new SVNHashSet();
View Full Code Here

    private boolean doRevert(File path, SVNAdminArea parent, SVNDepth depth, boolean useCommitTimes,
            Collection changeLists) throws SVNException {
        checkCancelled();
        SVNWCAccess wcAccess = parent.getWCAccess();
        SVNAdminArea dir = wcAccess.probeRetrieve(path);
        SVNEntry entry = wcAccess.getEntry(path, false);
        SVNTreeConflictDescription treeConflict = wcAccess.getTreeConflict(path);
        if (entry == null && treeConflict == null) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNVERSIONED_RESOURCE, "Cannot revert unversioned item ''{0}''",
                    path);
            SVNErrorManager.error(err, SVNLogType.WC);
        }
       
        if (entry != null && entry.getKind() == SVNNodeKind.DIR) {
            SVNFileType fileType = SVNFileType.getType(path);
            if (fileType != SVNFileType.DIRECTORY && !entry.isScheduledForAddition()) {
                if (isRevertMissingDirectories() && entry.getSchedule() != null && !entry.isThisDir()) {
                    // missing directory scheduled for deletion in parent.
                    boolean reverted = revert(parent, entry.getName(), entry, useCommitTimes);
                    if (reverted) {
                        SVNEvent event = SVNEventFactory.createSVNEvent(dir.getFile(entry.getName()), entry.getKind(), null, entry.getRevision(),
                            SVNEventAction.REVERT, null, null, null);
                        dispatchEvent(event);
                    }
                    return reverted;
                }
                SVNEvent event = SVNEventFactory.createSVNEvent(dir.getFile(entry.getName()), entry.getKind(), null, entry.getRevision(), SVNEventAction.FAILED_REVERT, null, null, null);
                dispatchEvent(event);
                return false;
            }
        }

        if (entry != null && entry.getKind() != SVNNodeKind.DIR && entry.getKind() != SVNNodeKind.FILE) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNSUPPORTED_FEATURE,
                    "Cannot revert ''{0}'': unsupported entry node kind", path);
            SVNErrorManager.error(err, SVNLogType.WC);
        }

        SVNFileType fileType = SVNFileType.getType(path);
        if (fileType == SVNFileType.UNKNOWN) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNSUPPORTED_FEATURE,
                    "Cannot revert ''{0}'': unsupported node kind in working copy", path);
            SVNErrorManager.error(err, SVNLogType.WC);
        }

        boolean reverted = false;
        if (SVNWCAccess.matchesChangeList(changeLists, entry)) {
            if (treeConflict != null) {
                parent.deleteTreeConflict(path.getName());
                reverted = true;
            }
           
            if (entry != null) {
                if (entry.isScheduledForAddition()) {
                    boolean wasDeleted = false;
                    if (entry.getKind() == SVNNodeKind.FILE) {
                        wasDeleted = entry.isDeleted();
                        parent.removeFromRevisionControl(path.getName(), false, false);
                    } else if (entry.getKind() == SVNNodeKind.DIR) {
                        SVNEntry entryInParent = parent.getEntry(path.getName(), true);
                        if (entryInParent != null) {
                            wasDeleted = entryInParent.isDeleted();
                        }
                        if (fileType == SVNFileType.NONE || wcAccess.isMissing(path)) {
                            parent.deleteEntry(path.getName());
                            parent.saveEntries(false);
                        } else {
                            dir.removeFromRevisionControl("", false, false);
                        }
                    }

                    reverted = true;
                    depth = SVNDepth.EMPTY;
                    if (wasDeleted) {
                        Map attributes = new SVNHashMap();
                        attributes.put(SVNProperty.KIND, entry.getKind().toString());
                        attributes.put(SVNProperty.DELETED, Boolean.TRUE.toString());
                        parent.modifyEntry(path.getName(), attributes, true, false);
                    }
                } else if (entry.getSchedule() == null || entry.isScheduledForDeletion() || entry.isScheduledForReplacement()) {
                    if (entry.getKind() == SVNNodeKind.FILE) {
                        reverted = revert(parent, entry.getName(), entry, useCommitTimes);
                    } else if (entry.getKind() == SVNNodeKind.DIR) {
                        reverted = revert(dir, dir.getThisDirName(), entry, useCommitTimes);
                        if (reverted && parent != dir) {
                            SVNEntry entryInParent = parent.getEntry(path.getName(), false);
                            revert(parent, path.getName(), entryInParent, useCommitTimes);
                        }
                        if (entry.isScheduledForReplacement()) {
                            depth = SVNDepth.INFINITY;
                        }
                    }
                }
            }
            if (reverted) {
                SVNEvent event = null;
                if (entry != null) {
                    event = SVNEventFactory.createSVNEvent(dir.getFile(entry.getName()), entry.getKind(), null, entry.getRevision(),
                            SVNEventAction.REVERT, null, null, null);
                } else {
                    event = SVNEventFactory.createSVNEvent(path, SVNNodeKind.UNKNOWN, null, SVNRepository.INVALID_REVISION,
                            SVNEventAction.REVERT, null, null, null);
                }
                dispatchEvent(event);
            }
        }
       
       
        if (entry != null && entry.getKind() == SVNNodeKind.DIR && depth.compareTo(SVNDepth.EMPTY) > 0) {
            SVNDepth depthBelowHere = depth;
            if (depth == SVNDepth.FILES || depth == SVNDepth.IMMEDIATES) {
                depthBelowHere = SVNDepth.EMPTY;
            }
            for (Iterator entries = dir.entries(false); entries.hasNext();) {
                SVNEntry childEntry = (SVNEntry) entries.next();
                if (dir.getThisDirName().equals(childEntry.getName())) {
                    continue;
                }
                if (depth == SVNDepth.FILES && !childEntry.isFile()) {
                    continue;
                }
                File childPath = new Resource(path, childEntry.getName());
                reverted |= doRevert(childPath, dir, depthBelowHere, useCommitTimes, changeLists);
            }
           
            Map conflicts = SVNTreeConflictUtil.readTreeConflicts(path, entry.getTreeConflictData());
            for (Iterator conflictsIter = conflicts.keySet().iterator(); conflictsIter.hasNext();) {
View Full Code Here

TOP

Related Classes of org.exist.versioning.svn.internal.wc.admin.SVNEntry

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.