Examples of SVNEvent


Examples of org.tmatesoft.svn.core.wc.SVNEvent

            Collection enabledFactories = getSelector().getEnabledFactories(area.getRoot(), ourFactories, true);
            if (!enabledFactories.isEmpty()) {
                SVNAdminAreaFactory newestFactory = (SVNAdminAreaFactory) enabledFactories.iterator().next();
                SVNAdminArea newArea = newestFactory.doChangeWCFormat(area);
                if (newArea != null && newArea != area && newArea.getWCAccess() != null) {
                    SVNEvent event = SVNEventFactory.createSVNEvent(newArea.getRoot(), SVNNodeKind.DIR, null, SVNRepository.INVALID_REVISION, SVNEventAction.UPGRADE, null, null, null);
                    newArea.getWCAccess().handleEvent(event, ISVNEventHandler.UNKNOWN);
                }
                area = newArea;
            }
        }
View Full Code Here

Examples of org.tmatesoft.svn.core.wc.SVNEvent

    public static SVNAdminArea changeWCFormat(SVNAdminArea adminArea, int format) throws SVNException {
        SVNAdminAreaFactory factory = getAdminAreaFactory(format);
        SVNAdminArea newArea = factory.doChangeWCFormat(adminArea);
        if (newArea != null && newArea != adminArea && newArea.getWCAccess() != null) {
            SVNEvent event = SVNEventFactory.createSVNEvent(newArea.getRoot(), SVNNodeKind.DIR, null, SVNRepository.INVALID_REVISION, SVNEventAction.UPGRADE, null, null, null);
            newArea.getWCAccess().handleEvent(event, ISVNEventHandler.UNKNOWN);
        }
        adminArea = newArea;
        return adminArea;
    }
View Full Code Here

Examples of org.tmatesoft.svn.core.wc.SVNEvent

            return;
        }
        File victim = alreadyInTreeConflict(fullPath);
        if (victim != null) {
            addSkippedTree(fullPath);
            SVNEvent event = SVNEventFactory.createSVNEvent(fullPath, entry.getKind(), null, myTargetRevision, SVNEventAction.SKIP, SVNEventAction.UPDATE_DELETE, null, null);
            event.setPreviousRevision(previousRevision);
            event.setPreviousURL(url);
            myWCAccess.handleEvent(event);
            return;
        }

        SVNLog log = parent == null ? parentArea.getLog() : parent.getLog();
        SVNTreeConflictDescription treeConflict = checkTreeConflict(fullPath, entry, parentArea, log, SVNConflictAction.DELETE, SVNNodeKind.NONE, theirURL);
        if (treeConflict != null) {
            addSkippedTree(fullPath);
           
            SVNEvent event = SVNEventFactory.createSVNEvent(fullPath, entry.getKind(), null, myTargetRevision, SVNEventAction.TREE_CONFLICT, SVNEventAction.UPDATE_DELETE, null, null);
            event.setPreviousRevision(entry.getRevision());
            event.setPreviousURL(entry.getSVNURL());
            myWCAccess.handleEvent(event);
           
            if (treeConflict.getConflictReason() == SVNConflictReason.EDITED) {
                if (parent != null) {
                    parent.flushLog();
                    parent.runLogs();
                } else {
                    if (log != null) {
                        log.save();
                        parentArea.runLogs();
                    }
                }
                scheduleExistingEntryForReAdd(entry, fullPath, theirURL);
                return;
            } else if (treeConflict.getConflictReason() == SVNConflictReason.DELETED) {
//          The item does not exist locally (except perhaps as a skeleton
//          directory tree) because it was already scheduled for delete.
//          We must complete the deletion, leaving the tree conflict info
//          as the only difference from a normal deletion.
//
//          Fall through to the normal "delete" code path.
            } else {
                SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.UNSUPPORTED_FEATURE, "Unexpected tree conflict reason");
                SVNErrorManager.error(error, SVNLogType.WC);
            }
        }

        log = parent == null ? parentArea.getLog() : parent.getLog();
        SVNProperties attributes = new SVNProperties();
        attributes.put(SVNLog.NAME_ATTR, name);
        log.addCommand(SVNLog.DELETE_ENTRY, attributes, false);
        attributes.clear();
        if (path.equals(myTarget)) {
            attributes.put(SVNLog.NAME_ATTR, name);
            attributes.put(SVNLog.NAME_ATTR, name);
            attributes.put(SVNProperty.shortPropertyName(SVNProperty.KIND), kind == SVNNodeKind.DIR ? SVNProperty.KIND_DIR : SVNProperty.KIND_FILE);
            attributes.put(SVNProperty.shortPropertyName(SVNProperty.REVISION), Long.toString(myTargetRevision));
            attributes.put(SVNProperty.shortPropertyName(SVNProperty.DELETED), Boolean.TRUE.toString());
            log.addCommand(SVNLog.MODIFY_ENTRY, attributes, false);
            myIsTargetDeleted = true;
        }

        try {
            if (parent != null) {
                parent.flushLog();
            } else {
                if (log != null) {
                    log.save();
                }
            }
        } catch (SVNException svne) {
            SVNErrorMessage err = svne.getErrorMessage().wrap("Error writing log file for ''{0}''", parent.getPath());
            SVNErrorManager.error(err, svne, SVNLogType.WC);
        }

        if (myIsLockOnDemand && kind == SVNNodeKind.DIR) {
            SVNAdminArea childArea = myWCAccess.getAdminArea(parentArea.getFile(name));
            if (childArea != null && !childArea.isLocked()) {
                childArea.lock(false);
            }
        }

        if (mySwitchURL != null && kind == SVNNodeKind.DIR) {
            SVNAdminArea childArea = myWCAccess.retrieve(parentArea.getFile(name));
            if (childArea != null) {
                try {
                    childArea.removeFromRevisionControl(childArea.getThisDirName(), true, false);
                } catch (SVNException svne) {
                    handleLeftLocalModificationsError(svne);
                }
            }
        }
        try {
            if (parent != null) {
                parent.runLogs();
            } else {
                parentArea.runLogs();
            }
        } catch (SVNException svne) {
            SVNErrorMessage err = svne.getErrorMessage().wrap("Error running log file for ''{0}''", parentArea.getRoot());
            SVNErrorManager.error(err, svne, SVNLogType.WC);
        }

        if (treeConflict == null && !inDeletedTree(fullPath, true)) {
            SVNEvent event = SVNEventFactory.createSVNEvent(fullPath, kind, null, myTargetRevision, SVNEventAction.UPDATE_DELETE, null, null, null);
            event.setPreviousRevision(previousRevision);
            event.setPreviousURL(url);
            myWCAccess.handleEvent(event);
        }
    }
View Full Code Here

Examples of org.tmatesoft.svn.core.wc.SVNEvent

        }

        File victim = alreadyInTreeConflict(fullPath);
        if (victim != null) {
            addSkippedTree(fullPath);
            SVNEvent event = SVNEventFactory.createSVNEvent(fullPath, SVNNodeKind.DIR, null, myTargetRevision, SVNEventAction.SKIP, SVNEventAction.UPDATE_ADD, null, null);
            myWCAccess.handleEvent(event);
        }

        SVNFileType kind = SVNFileType.getType(fullPath);
        if (kind == SVNFileType.FILE || kind == SVNFileType.UNKNOWN) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.WC_OBSTRUCTED_UPDATE,
                    "Failed to add directory ''{0}'': a non-directory object of the same name already exists",
                    path);
            SVNErrorManager.error(err, SVNLogType.WC);
        }

        if (kind == SVNFileType.DIRECTORY) {
            SVNAdminArea adminArea = null;
            try {
                adminArea = SVNWCAccess.newInstance(null).open(fullPath, false, 0);
            } catch (SVNException svne) {
                if (svne.getErrorMessage().getErrorCode() != SVNErrorCode.WC_NOT_DIRECTORY) {
                    throw svne;
                }
                if (myIsUnversionedObstructionsAllowed) {
                    myCurrentDirectory.isExisted = true;
                } else {
                    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.WC_OBSTRUCTED_UPDATE,
                            "Failed to add directory ''{0}'': an unversioned directory of the same name already exists",
                            myCurrentDirectory.getPath());
                    SVNErrorManager.error(err, SVNLogType.WC);
                }
            }

            if (adminArea != null) {
                try {
                    SVNEntry entry = adminArea.getEntry(adminArea.getThisDirName(), false);
                    SVNEntry parentEntry = parentArea.getEntry(parentArea.getThisDirName(), false);
                    SVNEntry entryInParent = (SVNEntry) parentArea.getEntries().get(name);
                    if (entry != null && parentEntry != null && entry.getUUID() != null && parentEntry.getUUID() != null &&
                            !entry.getUUID().equals(parentEntry.getUUID())) {
                        SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.WC_OBSTRUCTED_UPDATE,
                                "UUID mismatch: existing directory ''{0}'' was checked out from a different repository",
                                myCurrentDirectory.getPath());
                        SVNErrorManager.error(err, SVNLogType.WC);
                    }
                    if (entry != null && mySwitchURL == null && myCurrentDirectory.URL != null && !myCurrentDirectory.URL.equals(entry.getURL())) {
                        SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.WC_OBSTRUCTED_UPDATE,
                                "URL ''{0}'' of existing directory ''{1}'' does not match expected URL ''{2}''",
                                new Object[] {entry.getURL(), myCurrentDirectory.getPath(), myCurrentDirectory.URL});
                        SVNErrorManager.error(err, SVNLogType.WC);
                    }
                    if (entryInParent == null) {
                        SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.WC_OBSTRUCTED_UPDATE,
                                "Failed to add directory ''{0}'': a versioned directory of the same name already exists",
                                myCurrentDirectory.getPath());
                        SVNErrorManager.error(err, SVNLogType.WC);
                    }

                    if (entry != null && (entry.isScheduledForAddition() || entry.isScheduledForReplacement()) && !entry.isCopied()) {
                        myCurrentDirectory.isAddExisted = true;
                    } else {
                        SVNURL theirURL = SVNURL.parseURIEncoded(myCurrentDirectory.URL);
                        SVNTreeConflictDescription treeConflict = checkTreeConflict(fullPath, entry, parentArea, parentDirectory.getLog(), SVNConflictAction.ADD, SVNNodeKind.DIR, theirURL);

                        try {
                            parentDirectory.flushLog();
                        } catch (SVNException svne) {
                            SVNErrorMessage err = svne.getErrorMessage().wrap("Error writing log file for ''{0}''", parentDirectory.getPath());
                            SVNErrorManager.error(err, svne, SVNLogType.WC);
                        }

                        if (treeConflict != null) {
                            addSkippedTree(fullPath);
                            SVNEvent event = SVNEventFactory.createSVNEvent(fullPath, SVNNodeKind.DIR, null, myTargetRevision, SVNEventAction.TREE_CONFLICT, SVNEventAction.UPDATE_ADD, null, null);
                            if (entry != null) {
                                event.setPreviousRevision(entry.getRevision());
                                event.setPreviousURL(entry.getSVNURL());
                            }
                            myWCAccess.handleEvent(event);
                            return;
                        }
                    }
                } finally {
                    adminArea.getWCAccess().close();
                }
            }
        }

        if (SVNFileUtil.getAdminDirectoryName().equals(name)) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.WC_OBSTRUCTED_UPDATE,
                    "Failed to add directory ''{0}'':  object of the same name as the administrative directory",
                    path);
            SVNErrorManager.error(err, SVNLogType.WC);
        }
        if (copyFromPath != null || SVNRevision.isValidRevisionNumber(copyFromRevision)) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNSUPPORTED_FEATURE,
                    "Failed to add directory ''{0}'': copyfrom arguments not yet supported", path);
            SVNErrorManager.error(err, SVNLogType.WC);
        }

        SVNEntry entry = parentArea.getEntry(name, false);
        Map attributes = new SVNHashMap();
        attributes.put(SVNProperty.KIND, SVNProperty.KIND_DIR);
        attributes.put(SVNProperty.ABSENT, null);
        attributes.put(SVNProperty.DELETED, null);
        boolean force = false;
        if (myCurrentDirectory.isAddExisted) {
            attributes.put(SVNProperty.SCHEDULE, null);
            force = true;
        }
        entry = parentArea.modifyEntry(name, attributes, true, force);

        if (myCurrentDirectory.isAddExisted) {
            attributes.put(SVNProperty.REVISION, Long.toString(myTargetRevision));
            if (mySwitchURL != null) {
                attributes.put(SVNProperty.URL, SVNPathUtil.append(mySwitchURL, name));
            }
            SVNAdminArea adminArea = myCurrentDirectory.getAdminArea();
            adminArea.modifyEntry(adminArea.getThisDirName(), attributes, true, true);
        }

        String rootURL = null;
        if (myRootURL != null && SVNPathUtil.isAncestor(myRootURL, myCurrentDirectory.URL)) {
            rootURL = myRootURL;
        }

        SVNWCManager.ensureAdminAreaExists(fullPath, myCurrentDirectory.URL, rootURL, null, myTargetRevision, myCurrentDirectory.myAmbientDepth);

        SVNAdminArea childArea = null;
        if (!myAdminInfo.getAnchor().getRoot().equals(fullPath)) {
            ISVNEventHandler eventHandler = myWCAccess.getEventHandler();
            try {
                myWCAccess.setEventHandler(null);
                childArea = myWCAccess.open(fullPath, true, 0);
            } catch(SVNException e) {
                if (e.getErrorMessage().getErrorCode() == SVNErrorCode.WC_LOCKED) {
                    childArea = myWCAccess.retrieve(fullPath);
                } else {
                    throw e;
                }
            } finally {
                myWCAccess.setEventHandler(eventHandler);
            }
        }

        if (isLocallyDeleted) {
            attributes.clear();
            attributes.put(SVNProperty.SCHEDULE, SVNProperty.SCHEDULE_DELETE);
            parentArea.modifyEntry(name, attributes, true, false);
            childArea = myWCAccess.retrieve(fullPath);
            childArea.modifyEntry(childArea.getThisDirName(), attributes, true, false);
        }

        try {
            childArea = myWCAccess.open(fullPath, true, 0);
        } catch (SVNException e) {
            if (e.getErrorMessage().getErrorCode() == SVNErrorCode.WC_LOCKED) {
                childArea = myWCAccess.retrieve(fullPath);
            } else {
                throw e;
            }
        }
        if (childArea != null) {
            myWCAccess.registerCleanupHandler(childArea, myCurrentDirectory);
        }

        if (!myCurrentDirectory.isAddExisted && !isLocallyDeleted) {
            SVNEvent event = SVNEventFactory.createSVNEvent(parentArea.getFile(entry.getName()),
                    SVNNodeKind.DIR, null, myTargetRevision, myCurrentDirectory.isExisted ?
                            SVNEventAction.UPDATE_EXISTS : SVNEventAction.UPDATE_ADD, null, null, null);
            event.setPreviousRevision(myCurrentDirectory.myPreviousRevision);
            event.setPreviousURL(entry.getSVNURL());
            event.setURL(myCurrentDirectory.URL != null ? SVNURL.parseURIEncoded(myCurrentDirectory.URL) : null);
            myWCAccess.handleEvent(event);
        }
    }
View Full Code Here

Examples of org.tmatesoft.svn.core.wc.SVNEvent

            addSkippedTree(fullPath);

            if (!inDeletedTree(fullPath, false)) {
                SVNEventAction eventAction = hasPropConflicts ? SVNEventAction.SKIP : SVNEventAction.TREE_CONFLICT;
                SVNStatusType propStatus = hasPropConflicts ? SVNStatusType.CONFLICTED : null;
                SVNEvent event = SVNEventFactory.createSVNEvent(fullPath, SVNNodeKind.DIR, null, myTargetRevision, null, propStatus, null, eventAction, SVNEventAction.UPDATE_UPDATE, null, null);
                event.setPreviousRevision(myCurrentDirectory.myPreviousRevision);
                if (myCurrentDirectory.URL != null) {
                    event.setURL(SVNURL.parseURIEncoded(myCurrentDirectory.URL));
                }
                if (entry != null) {
                    event.setPreviousURL(entry.getSVNURL());
                }
                myWCAccess.handleEvent(event);
            }

            if (hasPropConflicts || (treeConflict != null && treeConflict.getConflictReason() != SVNConflictReason.DELETED)) {
View Full Code Here

Examples of org.tmatesoft.svn.core.wc.SVNEvent

                // skip event for anchor when there is a target.
                SVNEventAction action = myCurrentDirectory.isAddExisted || myCurrentDirectory.isExisted ? SVNEventAction.UPDATE_EXISTS : SVNEventAction.UPDATE_UPDATE;
                if (propStatus == SVNStatusType.UNKNOWN && action != SVNEventAction.UPDATE_EXISTS) {
                    action = SVNEventAction.UPDATE_NONE;
                }
                SVNEvent event = SVNEventFactory.createSVNEvent(adminArea.getRoot(), SVNNodeKind.DIR, null, myTargetRevision, SVNStatusType.UNKNOWN, propStatus, null, action, null, null, null);
                event.setPreviousRevision(myCurrentDirectory.myPreviousRevision);
              event.setURL(myCurrentDirectory.URL != null ? SVNURL.parseURIEncoded(myCurrentDirectory.URL) : null);
                myWCAccess.handleEvent(event);
            }
        }
        myCurrentDirectory = myCurrentDirectory.Parent;
    }
View Full Code Here

Examples of org.tmatesoft.svn.core.wc.SVNEvent

        File victim = alreadyInTreeConflict(fullPath);
        if (victim != null) {
            info.isSkipped = true;
            addSkippedTree(fullPath);
            SVNEvent event = SVNEventFactory.createSVNEvent(fullPath, SVNNodeKind.FILE, null, myTargetRevision, SVNEventAction.SKIP, SVNEventAction.UPDATE_ADD, null, null);
            if (entry != null) {
                event.setPreviousRevision(entry.getRevision());
                event.setPreviousURL(entry.getSVNURL());
            }
            myWCAccess.handleEvent(event);
            return info;
        }

        if (fileType == SVNFileType.DIRECTORY || fileType == SVNFileType.UNKNOWN) {
            SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_OBSTRUCTED_UPDATE, "Failed to add file ''{0}'': a non-file object of the same name already exists", path);
            SVNErrorManager.error(error, SVNLogType.WC);
        }

        if (entry == null && (fileType == SVNFileType.FILE || fileType == SVNFileType.SYMLINK)) {
            if (myIsUnversionedObstructionsAllowed) {
                info.isExisted = true;
            } else {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.WC_OBSTRUCTED_UPDATE,
                        "Failed to add file ''{0}'': an unversioned file of the same name already exists", path);
                SVNErrorManager.error(err, SVNLogType.WC);
            }
        }

        if (entry != null) {
            SVNEntry parentEntry = adminArea.getEntry(adminArea.getThisDirName(), false);
            if (entry.getUUID() != null && !entry.getUUID().equals(parentEntry.getUUID())) {
                SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_OBSTRUCTED_UPDATE, "UUID mismatch: existing file ''{0}'' was checked out from a different repository", fullPath);
                SVNErrorManager.error(error, SVNLogType.WC);
            }
            if (mySwitchURL == null && !info.URL.equals(entry.getURL())) {
                SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.WC_OBSTRUCTED_UPDATE, "URL ''{0}'' of existing file ''{1}'' does not match expected URL ''{2}''", new Object[]{entry.getURL(), fullPath, info.URL});
                SVNErrorManager.error(error, SVNLogType.WC);
            }
        }

        if (entry != null && (fileType == SVNFileType.FILE || fileType == SVNFileType.SYMLINK)) {
            if ((entry.isScheduledForAddition() || entry.isScheduledForReplacement()) && !entry.isCopied()) {
                info.isAddExisted = true;
            } else {
                SVNLog log = parent.getLog();
                SVNURL theirURL = SVNURL.parseURIEncoded(info.URL);
                SVNTreeConflictDescription treeConflict = checkTreeConflict(fullPath, entry, adminArea, log, SVNConflictAction.ADD, SVNNodeKind.FILE, theirURL);
                if (treeConflict != null) {
                    addSkippedTree(fullPath);
                    info.isSkipped = true;
                    SVNEvent event = SVNEventFactory.createSVNEvent(fullPath, SVNNodeKind.FILE, null, myTargetRevision, SVNEventAction.TREE_CONFLICT, SVNEventAction.UPDATE_ADD, null, null);
                    event.setPreviousRevision(entry.getRevision());
                    event.setPreviousURL(entry.getSVNURL());
                    myWCAccess.handleEvent(event);
                    return info;
                }
            }
        }
View Full Code Here

Examples of org.tmatesoft.svn.core.wc.SVNEvent

                info.isSkipped = true;
            }
            addSkippedTree(fullPath);
            if (!inDeletedTree(fullPath, false)) {
                SVNEventAction eventAction = treeConflict != null ? SVNEventAction.TREE_CONFLICT : SVNEventAction.SKIP;
                SVNEvent event = SVNEventFactory.createSVNEvent(fullPath, SVNNodeKind.FILE,
                        null, myTargetRevision, hasTextConflicts ? SVNStatusType.CONFLICTED : SVNStatusType.UNKNOWN,
                        hasPropConflicts ? SVNStatusType.CONFLICTED : SVNStatusType.UNKNOWN,
                        SVNStatusType.LOCK_INAPPLICABLE, eventAction, SVNEventAction.UPDATE_UPDATE, null, null);
                event.setPreviousRevision(entry.getRevision());
                event.setURL(entry.getSVNURL());
                myWCAccess.handleEvent(event);
            }
        }
        return info;
    }
View Full Code Here

Examples of org.tmatesoft.svn.core.wc.SVNEvent

                }
            } else if (fileInfo.IsAdded) {
                action = SVNEventAction.UPDATE_ADD;
                expectedAction = action;
            }
            SVNEvent event = SVNEventFactory.createSVNEvent(fullPath, SVNNodeKind.FILE,  null, myTargetRevision, textStatus, propStatus, lockStatus, action, expectedAction, null, null);
            event.setPreviousRevision(previousRevision);
          event.setPreviousURL(previousURL);
          event.setURL(fileInfo.URL != null ? SVNURL.parseURIEncoded(fileInfo.URL) : null);
            myWCAccess.handleEvent(event);
        }
    }
View Full Code Here

Examples of org.tmatesoft.svn.core.wc.SVNEvent

* @author  TMate Software Ltd.
*/
public class SVNEventFactory {

    public static SVNEvent createErrorEvent(SVNErrorMessage error){
        return new SVNEvent(error);
    }
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.