Examples of ISVNEntryHandler


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

   
    private List getMergeInfoPaths(final List children, final String mergeSrcPath,
        SVNEntry entry, final SVNURL sourceRootURL, final long revision1,
        final long revision2, final SVNRepository repository, final SVNDepth depth) throws SVNException {
      final List childrenWithMergeInfo = children == null ? new LinkedList() : children;
      ISVNEntryHandler handler = new ISVNEntryHandler() {
            public void handleEntry(File path, SVNEntry entry) throws SVNException {
                File target = myTarget;
              SVNAdminArea adminArea = entry.getAdminArea();
                if (entry.isDirectory() && !adminArea.getThisDirName().equals(entry.getName()) &&
                        !entry.isAbsent()) {
                    return;
                }
           
                if (entry.isDeleted()) {
                    return;
                }
               
                boolean isSwitched = false;
                boolean hasMergeInfoFromMergeSrc = false;
                boolean pathIsMergeTarget = target.equals(path);
                String mergeInfoProp = null;
                if (!entry.isAbsent() && !entry.isScheduledForDeletion()) {
                    SVNVersionedProperties props = adminArea.getProperties(entry.getName());
                    mergeInfoProp = props.getStringPropertyValue(SVNProperty.MERGE_INFO);
                    if (mergeInfoProp != null && !pathIsMergeTarget) {
                        String relToTargetPath = SVNPathUtil.getRelativePath(target.getAbsolutePath(),
                            path.getAbsolutePath());
                        String mergeSrcChildPath = SVNPathUtil.getAbsolutePath(SVNPathUtil.append(mergeSrcPath,
                            relToTargetPath));
                        Map mergeInfo = SVNMergeInfoUtil.parseMergeInfo(new StringBuffer(mergeInfoProp),
                            null);
                        if (mergeInfoProp == null || mergeInfoProp.length() == 0 || mergeInfo.containsKey(mergeSrcChildPath)) {
                            hasMergeInfoFromMergeSrc = true;
                        } else {
                          SVNURL mergeInfoURL = sourceRootURL.appendPath(mergeSrcChildPath, false);
                          SVNRevision pegRevision = SVNRevision.create(revision1 < revision2 ?
                              revision2 : revision1);
                          SVNErrorCode code = null;
                          SVNURL originalURL = null;
                          try {
                            originalURL = ensureSessionURL(repository, mergeInfoURL);
                            getLocations(mergeInfoURL, null, repository, pegRevision,
                                SVNRevision.create(revision1), SVNRevision.create(revision2));
                            hasMergeInfoFromMergeSrc = true;
                          } catch (SVNException svne) {
                            code = svne.getErrorMessage().getErrorCode();
                            if (code != SVNErrorCode.FS_NOT_FOUND &&
                                code != SVNErrorCode.RA_DAV_PATH_NOT_FOUND &&
                                code != SVNErrorCode.CLIENT_UNRELATED_RESOURCES) {
                              throw svne;
                            }
                          } finally {
                            if (originalURL != null) {
                                    repository.setLocation(originalURL, false);
                            }
                          }
                        }
                    }
                   
                    isSwitched = SVNWCManager.isEntrySwitched(path, entry);
                }

                File parent = path.getParentFile();
                if (pathIsMergeTarget || hasMergeInfoFromMergeSrc ||
                    entry.isScheduledForDeletion() ||
                    isSwitched ||
                        entry.getDepth() == SVNDepth.EMPTY ||
                        entry.getDepth() == SVNDepth.FILES ||
                        entry.isAbsent() ||
                        (depth == SVNDepth.IMMEDIATES && entry.isDirectory() &&
                                parent != null && !parent.equals(path) && parent.equals(target))) {
                   
                  boolean hasMissingChild = entry.getDepth() == SVNDepth.EMPTY ||  entry.getDepth() == SVNDepth.FILES ||
                                                  (depth == SVNDepth.IMMEDIATES && entry.isDirectory() && parent != null && parent.equals(target));
                   
                    boolean hasNonInheritable = false;
                    if (mergeInfoProp != null && mergeInfoProp.indexOf(SVNMergeRangeList.MERGE_INFO_NONINHERITABLE_STRING) != -1) {
                        hasNonInheritable = true;
                    }
                   
                    if (!hasNonInheritable && (entry.getDepth() == SVNDepth.EMPTY ||
                            entry.getDepth() == SVNDepth.FILES)) {
                        hasNonInheritable = true;
                    }
                   
                    MergePath child = new MergePath();
                    child.myPath = path;
                    child.myHasMissingChildren = hasMissingChild;
                    child.myIsSwitched = isSwitched;
                    child.myIsAbsent = entry.isAbsent();
                    child.myIsScheduledForDeletion = entry.isScheduledForDeletion();
                    child.myHasNonInheritableMergeInfo = hasNonInheritable;
                    childrenWithMergeInfo.add(child);
                }
            }
           
            public void handleError(File path, SVNErrorMessage error) throws SVNException {
                while (error.hasChildErrorMessage()) {
                    error = error.getChildErrorMessage();
                }
                if (error.getErrorCode() == SVNErrorCode.WC_PATH_NOT_FOUND ||
                        error.getErrorCode() == SVNErrorCode.WC_NOT_LOCKED) {
                    return;
                }
                SVNErrorManager.error(error, SVNLogType.DEFAULT);
            }
        };
       
        if (entry.isFile()) {
            handler.handleEntry(myTarget, entry);
        } else {
            myWCAccess.walkEntries(myTarget, handler, true, depth);
        }
       
        Collections.sort(childrenWithMergeInfo);
View Full Code Here

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

    public static Map getWorkingCopyPropertyValues(File path, SVNEntry entry, final String propName,
                                                   SVNDepth depth, final boolean base) throws SVNException {
        final Map pathsToPropValues = new SVNHashMap();

        ISVNEntryHandler handler = new ISVNEntryHandler() {
            public void handleEntry(File itemPath, SVNEntry itemEntry) throws SVNException {
                SVNAdminArea adminArea = itemEntry.getAdminArea();
                if (itemEntry.isDirectory() && !itemEntry.getName().equals(adminArea.getThisDirName())) {
                    return;
                }

                if ((itemEntry.isScheduledForAddition() && base) ||
                        (itemEntry.isScheduledForDeletion() && !base)) {
                    return;
                }

                SVNPropertyValue propValue = null;
                SVNWCAccess access = adminArea.getWCAccess();
                if (base) {
                    SVNEntry pathEntry = access.getEntry(itemPath, false);
                    if (pathEntry != null) {
                        SVNAdminArea pathArea = pathEntry.getAdminArea();
                        SVNVersionedProperties baseProps = pathArea.getBaseProperties(pathEntry.getName());
                        propValue = baseProps.getPropertyValue(propName);
                    }
                } else {
                    SVNEntry pathEntry = access.getEntry(itemPath, true);
                    if (pathEntry != null) {
                        SVNAdminArea pathArea = pathEntry.getAdminArea();
                        SVNVersionedProperties workingProps = pathArea.getProperties(pathEntry.getName());
                        propValue = workingProps.getPropertyValue(propName);
                    }
                }

                if (propValue != null) {
                    pathsToPropValues.put(itemPath, propValue);
                }
            }

            public void handleError(File path, SVNErrorMessage error) throws SVNException {
                while (error.hasChildErrorMessage()) {
                    error = error.getChildErrorMessage();
                }
                if (error.getErrorCode() == SVNErrorCode.WC_PATH_NOT_FOUND) {
                    return;
                }
                SVNErrorManager.error(error, SVNLogType.WC);
            }
        };

        if (depth == SVNDepth.UNKNOWN) {
            depth = SVNDepth.INFINITY;
        }

        SVNAdminArea adminArea = entry.getAdminArea();
        if (entry.isDirectory() && depth.compareTo(SVNDepth.FILES) >= 0) {
            SVNWCAccess wcAccess = adminArea.getWCAccess();
            wcAccess.walkEntries(path, handler, false, depth);
        } else {
            handler.handleEntry(path, entry);
        }

        return pathsToPropValues;
    }
View Full Code Here

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

            admLockLevel = 0;
        }

        try {
            wcAccess.probeOpen(path, true, admLockLevel);
            ISVNEntryHandler resolveEntryHandler = new ISVNEntryHandler() {
                public void handleEntry(File path, SVNEntry entry) throws SVNException {
                    SVNAdminArea adminArea = entry.getAdminArea();
                    if (entry.isDirectory() && !adminArea.getThisDirName().equals(entry.getName())) {
                        return;
                    }

                    File conflictDir = entry.isDirectory() ? path : path.getParentFile();
                    SVNAdminArea conflictArea = wcAccess.retrieve(conflictDir);
                    if (conflictArea.markResolved(entry.getName(), resolveContents, resolveProperties, choice)) {
                        SVNEvent event = SVNEventFactory.createSVNEvent(conflictArea.getFile(entry.getName()), entry.getKind(), null,
                                entry.getRevision(), SVNEventAction.RESOLVED, null, null, null);
                        dispatchEvent(event);
                    }
                }

                public void handleError(File path, SVNErrorMessage error) throws SVNException {
                    SVNErrorManager.error(error, SVNLogType.WC);
                }
            };

            if (depth == SVNDepth.EMPTY) {
                SVNEntry entry = wcAccess.getVersionedEntry(path, false);
                resolveEntryHandler.handleEntry(path, entry);
            } else {
                wcAccess.walkEntries(path, resolveEntryHandler, false, depth);
            }
        } finally {
            wcAccess.close();
View Full Code Here

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

            final ISVNInfoHandler handler) throws SVNException {
        SVNWCAccess wcAccess = createWCAccess();
        int admLockLevel = getLevelsToLockFromDepth(depth);
        try {
            wcAccess.probeOpen(path, false, admLockLevel);
            wcAccess.walkEntries(path, new ISVNEntryHandler() {
                public void handleEntry(File path, SVNEntry entry) throws SVNException {
                    if (entry.isDirectory() && !entry.isThisDir()) {
                        return;
                    }                   
                    if (SVNWCAccess.matchesChangeList(changeLists, entry)) {
View Full Code Here

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

            depth = SVNDepth.EMPTY;
        }
       
        File target = area.getFile(entry.getName());
        SVNWCAccess wcAccess = area.getWCAccess();
        ISVNEntryHandler propGetHandler = new PropFetchHandler(changeLists, propName, handler, base);
        if (SVNDepth.FILES.compareTo(depth) <= 0 && entry.isDirectory()) {
            wcAccess.walkEntries(target, propGetHandler, false, depth);
        } else if (SVNWCAccess.matchesChangeList(changeLists, entry)) {
            if (propName == null) {//proplist hack for compatibility with subvsersion
                SVNVersionedProperties properties = base ? area.getBaseProperties(entry.getName()) : area.getProperties(entry.getName());
                if (propName != null) {
                    SVNPropertyValue propValue = properties.getPropertyValue(propName);
                    if (propValue != null) {
                        handler.handleProperty(target, new SVNPropertyData(propName, propValue, getOptions()));
                    }
                } else {
                    SVNProperties allProps = properties.asMap();
                    for (Iterator names = allProps.nameSet().iterator(); names.hasNext();) {
                        String name = (String) names.next();
                        SVNPropertyValue val = allProps.getSVNPropertyValue(name);
                        handler.handleProperty(area.getFile(entry.getName()), new SVNPropertyData(name, val, getOptions()));
                    }
                }
            } else {
                propGetHandler.handleEntry(target, entry);
            }
        }
    }
View Full Code Here

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

   
    private List getMergeInfoPaths(final List children, final String mergeSrcPath,
        SVNEntry entry, final SVNURL sourceRootURL, final long revision1,
        final long revision2, final SVNRepository repository, final SVNDepth depth) throws SVNException {
      final List childrenWithMergeInfo = children == null ? new LinkedList() : children;
        ISVNEntryHandler handler = getMergeInfoEntryHandler(mergeSrcPath, sourceRootURL, revision1, revision2, repository, depth, childrenWithMergeInfo);

        if (entry.isFile()) {
            handler.handleEntry(myTarget, entry);
        } else {
            myWCAccess.walkEntries(myTarget, handler, true, depth);
        }
       
        Collections.sort(childrenWithMergeInfo);
View Full Code Here

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

        path = path.getAbsoluteFile();
        SVNWCAccess wcAccess = createWCAccess();
        try {
            wcAccess.probeOpen(path, false, SVNWCAccess.INFINITE_DEPTH);
           
            ISVNEntryHandler entryHandler = new ISVNEntryHandler() {
               
                public void handleEntry(File path, SVNEntry entry) throws SVNException {
                    if (SVNWCAccess.matchesChangeList(changeLists, entry) &&
                            (entry.isFile() || (entry.isDirectory() &&
                                    entry.getName().equals(entry.getAdminArea().getThisDirName())))) {
View Full Code Here

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

    public static Map getWorkingCopyPropertyValues(File path, SVNEntry entry, final String propName,
                                                   SVNDepth depth, final boolean base) throws SVNException {
        final Map pathsToPropValues = new SVNHashMap();

        ISVNEntryHandler handler = new ISVNEntryHandler() {
            public void handleEntry(File itemPath, SVNEntry itemEntry) throws SVNException {
                SVNAdminArea adminArea = itemEntry.getAdminArea();
                if (itemEntry.isDirectory() && !itemEntry.getName().equals(adminArea.getThisDirName())) {
                    return;
                }

                if ((itemEntry.isScheduledForAddition() && base) ||
                        (itemEntry.isScheduledForDeletion() && !base)) {
                    return;
                }

                SVNPropertyValue propValue = null;
                SVNWCAccess access = adminArea.getWCAccess();
                if (base) {
                    SVNEntry pathEntry = access.getEntry(itemPath, false);
                    if (pathEntry != null) {
                        SVNAdminArea pathArea = pathEntry.getAdminArea();
                        SVNVersionedProperties baseProps = pathArea.getBaseProperties(pathEntry.getName());
                        propValue = baseProps.getPropertyValue(propName);
                    }
                } else {
                    SVNEntry pathEntry = access.getEntry(itemPath, true);
                    if (pathEntry != null) {
                        SVNAdminArea pathArea = pathEntry.getAdminArea();
                        SVNVersionedProperties workingProps = pathArea.getProperties(pathEntry.getName());
                        propValue = workingProps.getPropertyValue(propName);
                    }
                }

                if (propValue != null) {
                    pathsToPropValues.put(itemPath, propValue);
                }
            }

            public void handleError(File path, SVNErrorMessage error) throws SVNException {
                while (error.hasChildErrorMessage()) {
                    error = error.getChildErrorMessage();
                }
                if (error.getErrorCode() == SVNErrorCode.WC_PATH_NOT_FOUND) {
                    return;
                }
                SVNErrorManager.error(error, SVNLogType.WC);
            }
        };

        if (depth == SVNDepth.UNKNOWN) {
            depth = SVNDepth.INFINITY;
        }

        SVNAdminArea adminArea = entry.getAdminArea();
        if (entry.isDirectory() && depth.compareTo(SVNDepth.FILES) >= 0) {
            SVNWCAccess wcAccess = adminArea.getWCAccess();
            wcAccess.walkEntries(path, handler, false, depth);
        } else {
            handler.handleEntry(path, entry);
        }

        return pathsToPropValues;
    }
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.