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

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


        myWCAccess = createWCAccess();
        targetWCPath = targetWCPath.getAbsoluteFile();
        try {
            SVNAdminArea adminArea = myWCAccess.probeOpen(targetWCPath, !dryRun, SVNWCAccess.INFINITE_DEPTH);

            SVNEntry entry = myWCAccess.getVersionedEntry(targetWCPath, false);
            SVNURL wcReposRoot = getReposRoot(targetWCPath, null, SVNRevision.WORKING, adminArea, myWCAccess);
               
            long[] latestRev = new long[1];
            latestRev[0] = SVNRepository.INVALID_REVISION;
View Full Code Here


            File targetWCPath, boolean dryRun) throws SVNException {
        myWCAccess = createWCAccess();
        targetWCPath = targetWCPath.getAbsoluteFile();
        try {
            SVNAdminArea adminArea = myWCAccess.probeOpen(targetWCPath, !dryRun, SVNWCAccess.INFINITE_DEPTH);
            SVNEntry targetEntry = myWCAccess.getVersionedEntry(targetWCPath, false);
            SVNURL url2 = srcURL == null ? getURL(srcPath) : srcURL;
            if (url2 == null) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.ENTRY_MISSING_URL,
                        "''{0}'' has no URL", srcPath);
                SVNErrorManager.error(err, SVNLogType.WC);
            }
       
            SVNURL wcReposRoot = getReposRoot(targetWCPath, null, SVNRevision.WORKING, adminArea, myWCAccess);
            SVNRepository repository = null;
            SVNURL sourceReposRoot = null;
            try {
                repository = createRepository(wcReposRoot, null, null, true);
                sourceReposRoot = repository.getRepositoryRoot(true);
                if (!wcReposRoot.equals(sourceReposRoot)) {
                    Object source = srcPath;
                    if (source == null) {
                        source = srcURL;
                    }
                    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_UNRELATED_RESOURCES,
                            "''{0}'' must be from the same repository as ''{1}''", new Object[] { source, 
                            targetWCPath });
                    SVNErrorManager.error(err, SVNLogType.WC);
                }
               
                ensureWCReflectsRepositorySubTree(targetWCPath);
                long[] rev1 = { targetEntry.getRevision() };
                String sourceReposRelPath = getPathRelativeToRoot(null, url2, null, null, repository);
                String targetReposRelPath = getPathRelativeToRoot(targetWCPath, null, wcReposRoot, null,
                        repository);
               
                SubTreeMergeInfoHandler handler = new SubTreeMergeInfoHandler(targetWCPath, wcReposRoot);
                myWCAccess.walkEntries(targetWCPath, handler, true, SVNDepth.INFINITY);
               
                long rev2 = getRevisionNumber(pegRevision, repository, srcPath);
                SVNURL[] url1 = { null };
               
                Map unmergedToSourceMergeInfoCatalog = calculateLeftHandSide(url1, rev1, targetReposRelPath,
                        handler.getSubTreesWithMergeInfoPaths(), rev1[0], sourceReposRelPath, sourceReposRoot, rev2, repository);
               
                SVNLocationEntry youngestCommonAncestor = getYoungestCommonAncestor(null, url2, rev2, null, url1[0],
                        rev1[0]);
               
                String youngestAncestorPath = youngestCommonAncestor.getPath();
                long youngestAncestorRevision = youngestCommonAncestor.getRevision();
                if (!(youngestAncestorPath != null && SVNRevision.isValidRevisionNumber(youngestAncestorRevision))) {
                    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_NOT_READY_TO_MERGE,
                            "''{0}@{1}'' must be ancestrally related to ''{2}@{3}''",
                            new Object[] { url1[0], new Long(rev1[0]), url2, new Long(rev2)});
                    SVNErrorManager.error(err, SVNLogType.WC);
                }
               
                if (rev1[0] > youngestAncestorRevision) {
                    try {
                        ensureAllMissingRangesArePhantoms(repository, unmergedToSourceMergeInfoCatalog);
                    } catch (SVNException svne) {
                        if (svne.getErrorMessage().getErrorCode() == SVNErrorCode.CLIENT_NOT_READY_TO_MERGE) {
                            String srcMergeInfoCatalogString = SVNMergeInfoUtil.formatMergeInfoCatalogToString(unmergedToSourceMergeInfoCatalog,
                                    "  ", "    Missing ranges: ");
                            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_NOT_READY_TO_MERGE,
                                    "Reintegrate can only be used if revisions {0} through {1} were " +
                                    "previously merged from {2} to the reintegrate source, but this is not the case:\n{3}", new Object[] {
                                    String.valueOf(youngestAncestorRevision + 1), String.valueOf(rev2), targetEntry.getURL(),
                                    srcMergeInfoCatalogString });
                            SVNErrorManager.error(err, SVNLogType.WC);
                        }
                        throw svne;
                    }
View Full Code Here

        SVNURL sourceRootURL = null;
        String mergeInfoPath = null;
        SVNMergeRange conflictedRange = null;
       
        myWCAccess.probeTry(targetWCPath, true, SVNWCAccess.INFINITE_DEPTH);
        SVNEntry entry = myWCAccess.getVersionedEntry(targetWCPath, false);

        if (honorMergeInfo) {
            sourceRootURL = myRepository1.getRepositoryRoot(true);
            mergeInfoPath = getPathRelativeToRoot(null, primaryURL, sourceRootURL, null, null);           
        }
View Full Code Here

            } else {
                childReposPath = SVNPathUtil.getRelativePath(myTarget.getAbsolutePath(),
                        child.myPath.getAbsolutePath());
            }
           
            SVNEntry childEntry = myWCAccess.getVersionedEntry(child.myPath, false);
            String childMergeSourcePath = SVNPathUtil.getAbsolutePath(SVNPathUtil.append(mergeInfoPath,
                    childReposPath));
           
            SVNMergeRangeList childMergeRangeList = filterNaturalHistoryFromMergeInfo(childMergeSourcePath,
                    child.myImplicitMergeInfo, range);
View Full Code Here

                        addedPath.getParentFile(), SVNProperty.MERGE_INFO);
                String addedPathParentPropValueStr = addedPathParentPropValue != null ?
                        addedPathParentPropValue.getString() : null;
                if (addedPathParentPropValueStr != null &&
                        addedPathParentPropValueStr.indexOf(SVNMergeRangeList.MERGE_INFO_NONINHERITABLE_STRING) != -1) {
                    SVNEntry entry = myWCAccess.getVersionedEntry(addedPath, false);
                    Map mergeMergeInfo = new TreeMap();
                    MergePath targetMergePath = (MergePath) myChildrenWithMergeInfo.get(0);
                   
                    SVNMergeRange rng = range.dup();
                    if (entry.isFile()) {
                        rng.setInheritable(true);
                    } else {
                        rng.setInheritable(!(depth == SVNDepth.INFINITY || depth == SVNDepth.IMMEDIATES));
                    }
View Full Code Here

    protected SVNProperties filterSelfReferentialMergeInfo(SVNProperties props, File path) throws SVNException {
        boolean honorMergeInfo = isHonorMergeInfo();
        if (!honorMergeInfo && myIsSameRepository && !myIsReIntegrateMerge) {
            return null;
        }
        SVNEntry targetEntry = myWCAccess.getVersionedEntry(path, false);
        if (myIsSameRepository && (targetEntry.isScheduledForAddition() || targetEntry.isScheduledForReplacement())) {
            return null;
        }
        SVNProperties adjustedProperties = new SVNProperties();
        for (Iterator propNamesIter = props.nameSet().iterator(); propNamesIter.hasNext();) {
            String propName = (String) propNamesIter.next();
            SVNPropertyValue propValue = props.getSVNPropertyValue(propName);
            if (SVNProperty.MERGE_INFO.equals(propName) && !myIsSameRepository) {
                // skip mergeinfo from foreign repository
            } else if (!SVNProperty.MERGE_INFO.equals(propName) || propValue == null ||
                    "".equals(propValue.getString())) {
                adjustedProperties.put(propName, propValue);
            } else {
                SVNURL mergeSourceRootURL = myRepository2.getRepositoryRoot(true);
                SVNURL targetURL = getURL(path);
                SVNURL oldURL = ensureSessionURL(myRepository2, targetURL);
               
                Map filteredYoungerMergeInfo = null;
                Map mergeInfo = SVNMergeInfoUtil.parseMergeInfo(new StringBuffer(propValue.getString()), null);
               
                Map[] mergeInfoArr = { mergeInfo };
                Map youngerMergeInfo = splitMergeInfoOnRevision(mergeInfoArr, targetEntry.getRevision());
                mergeInfo = mergeInfoArr[0];
               
                if (youngerMergeInfo != null) {
                    for (Iterator youngerMergeInfoIter = youngerMergeInfo.keySet().iterator(); youngerMergeInfoIter.hasNext();) {
                        String sourcePath = (String) youngerMergeInfoIter.next();
                        SVNMergeRangeList rangeList = (SVNMergeRangeList) youngerMergeInfo.get(sourcePath);
                        SVNMergeRange ranges[] = rangeList.getRanges();
                        LinkedList adjustedRanges = new LinkedList();
                        SVNURL mergeSourceURL = mergeSourceRootURL.appendPath(sourcePath, false);
                        for (int i = 0; i < ranges.length; i++) {
                            SVNMergeRange range = ranges[i];
                            SVNRepositoryLocation[] locations = null;
                            try {
                                locations = getLocations(targetURL, null, myRepository2,
                                        SVNRevision.create(targetEntry.getRevision()),
                                        SVNRevision.create(range.getStartRevision() + 1), SVNRevision.UNDEFINED);
                                SVNURL startURL = locations[0].getURL();
                                if (!mergeSourceURL.equals(startURL)) {
                                    adjustedRanges.add(range);
                                }
                            } catch (SVNException svne) {
                                SVNErrorCode code = svne.getErrorMessage().getErrorCode();
                                if (code == SVNErrorCode.CLIENT_UNRELATED_RESOURCES ||
                                        code == SVNErrorCode.RA_DAV_PATH_NOT_FOUND ||
                                        code == SVNErrorCode.FS_NOT_FOUND ||
                                        code == SVNErrorCode.FS_NO_SUCH_REVISION) {
                                    adjustedRanges.add(range);
                                } else {
                                    throw svne;
                                }
                            }
                        }

                        if (!adjustedRanges.isEmpty()) {
                            if (filteredYoungerMergeInfo == null) {
                                filteredYoungerMergeInfo = new TreeMap();
                            }
                            SVNMergeRangeList adjustedRangeList = SVNMergeRangeList.fromCollection(adjustedRanges);
                            filteredYoungerMergeInfo.put(sourcePath, adjustedRangeList);
                        }
                    }
                }
               
                Map filteredMergeInfo = null;
                if (mergeInfo != null && !mergeInfo.isEmpty()) {
                    Map implicitMergeInfo = getHistoryAsMergeInfo(null, path, SVNRevision.create(targetEntry.getRevision()),
                            targetEntry.getRevision(), SVNRepository.INVALID_REVISION, myRepository2, myWCAccess);
                   
                    filteredMergeInfo = SVNMergeInfoUtil.removeMergeInfo(implicitMergeInfo, mergeInfo);
                }
               
                if (oldURL != null) {
View Full Code Here

    private void processChildrenWithNewMergeInfo() throws SVNException {
        if (myPathsWithNewMergeInfo != null && !myIsDryRun) {
            for (Iterator pathsIter = myPathsWithNewMergeInfo.iterator(); pathsIter.hasNext();) {
                File pathWithNewMergeInfo = (File) pathsIter.next();
                SVNEntry pathEntry = myWCAccess.getVersionedEntry(pathWithNewMergeInfo, false);
                boolean[] indirect = { false };
                Map pathExplicitMergeInfo = getWCMergeInfo(pathWithNewMergeInfo, pathEntry, null, SVNMergeInfoInheritance.EXPLICIT, false,
                        indirect);
               
                SVNURL oldURL = null;
                if (pathExplicitMergeInfo != null) {
                    oldURL = ensureSessionURL(myRepository2, pathEntry.getSVNURL());
                    Map pathInheritedMergeInfo = getWCOrRepositoryMergeInfo(pathWithNewMergeInfo, pathEntry,
                            SVNMergeInfoInheritance.NEAREST_ANCESTOR, indirect, false, myRepository2);
                   
                    if (pathInheritedMergeInfo != null) {
                        pathExplicitMergeInfo = SVNMergeInfoUtil.mergeMergeInfos(pathExplicitMergeInfo, pathInheritedMergeInfo);
View Full Code Here

                    child.myPath.getAbsolutePath());
            }
            MergePath parent = null;
            SVNURL childURL1 = url1.appendPath(childRelativePath, false);
            SVNURL childURL2 = url2.appendPath(childRelativePath, false);
            SVNEntry childEntry = myWCAccess.getVersionedEntry(child.myPath, false);
           
            boolean indirect[] = { false };
            Map mergeInfo[] = getFullMergeInfo(childEntry, indirect, SVNMergeInfoInheritance.INHERITED,
                repository, child.myPath, Math.max(revision1, revision2), Math.min(revision1, revision2));
       
View Full Code Here

               
                if (child.myHasNonInheritableMergeInfo) {
                    SVNAdminArea childArea = myWCAccess.probeTry(child.myPath, true, SVNWCAccess.INFINITE_DEPTH);
                   
                    for (Iterator entries = childArea.entries(false); entries.hasNext();) {
                        SVNEntry childEntry = (SVNEntry) entries.next();
                        if (childArea.getThisDirName().equals(childEntry.getName())) {
                            continue;
                        }
                       
                        File childPath = childArea.getFile(childEntry.getName());
                        MergePath childOfNonInheritable = new MergePath(childPath);
                        if (!childrenWithMergeInfo.contains(childOfNonInheritable)) {
                            if (depth == SVNDepth.FILES) {
                                SVNEntry childEntry2 = myWCAccess.getEntry(childPath, false);
                                if (childEntry2 == null || !childEntry2.isFile()) {
                                    continue;
                                }
                            }
                            childrenWithMergeInfo.add(childOfNonInheritable);
                            //TODO: optimize these repeating sorts
                            Collections.sort(childrenWithMergeInfo);
                            if (!myIsDryRun && myIsSameRepository) {
                                SVNEntry childOfNonInheritableEntry = myWCAccess.getVersionedEntry(childOfNonInheritable.myPath, false);
                               
                                Map mergeInfo = getWCMergeInfo(childOfNonInheritable.myPath, childOfNonInheritableEntry, myTarget,
                                        SVNMergeInfoInheritance.NEAREST_ANCESTOR, false, new boolean[1]);
                                SVNPropertiesManager.recordWCMergeInfo(childPath, mergeInfo, myWCAccess);
                            }
                        }
                    }
                }
               
                if (child.myIsAbsent || (child.myIsSwitched && !myTarget.equals(child.myPath))) {
                    File parentPath = child.myPath.getParentFile();
                    int parentInd = childrenWithMergeInfo.indexOf(new MergePath(parentPath));
                    MergePath parent = parentInd != -1 ? (MergePath) childrenWithMergeInfo.get(parentInd) : null;
                    if (parent != null) {
                        parent.myHasMissingChildren = true;
                    } else {
                        parent = new MergePath(parentPath);
                        parent.myHasMissingChildren = true;
                        childrenWithMergeInfo.add(parent);
                        //TODO: optimize these repeating sorts
                        Collections.sort(childrenWithMergeInfo);
                        i++;
                    }
                   
                    SVNAdminArea parentArea = myWCAccess.probeTry(parentPath, true,
                            SVNWCAccess.INFINITE_DEPTH);
                    for (Iterator siblings = parentArea.entries(false); siblings.hasNext();) {
                        SVNEntry siblingEntry = (SVNEntry) siblings.next();
                        if (parentArea.getThisDirName().equals(siblingEntry.getName())) {
                            continue;
                        }
                       
                        File siblingPath = parentArea.getFile(siblingEntry.getName());
                        MergePath siblingOfMissing = new MergePath(siblingPath);
                        if (!childrenWithMergeInfo.contains(siblingOfMissing)) {
                            if (depth == SVNDepth.FILES) {
                                SVNEntry childEntry = myWCAccess.getEntry(siblingPath, false);
                                if (childEntry == null || !childEntry.isFile()) {
                                    continue;
                                }
                            }
                            childrenWithMergeInfo.add(siblingOfMissing);
                            //TODO: optimize these repeating sorts
View Full Code Here

            File path = (File) pathToRangeList.getKey();
            SVNMergeRangeList ranges = (SVNMergeRangeList) pathToRangeList.getValue();
            Map mergeInfo = null;
            try {
                // TODO this is a hack: assert that path is not missing if it is directory.
                SVNEntry pathEntry = entry.getAdminArea().getWCAccess().getEntry(path, false);
                if (pathEntry != null && pathEntry.isDirectory()) {
                    pathEntry.getAdminArea().getWCAccess().retrieve(path);
                }
              mergeInfo = SVNPropertiesManager.parseMergeInfo(path, entry, false)
            } catch (SVNException svne) {
              if (svne.getErrorMessage().getErrorCode() == SVNErrorCode.WC_NOT_LOCKED) {
                continue;
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.