Package org.tmatesoft.svn.core

Examples of org.tmatesoft.svn.core.SVNMergeRange


            myRangeList = rangeList;
        }
       
        public void handleLogEntry(SVNLogEntry logEntry) throws SVNException {
            checkCancelled();
            SVNMergeRange range = new SVNMergeRange(logEntry.getRevision() - 1, logEntry.getRevision(), true);
            SVNMergeRangeList thisRangeList = new SVNMergeRangeList(range);
            SVNMergeRangeList intersection = thisRangeList.intersect(myRangeList, true);
            if (intersection == null || intersection.isEmpty()) {
                return;
            }
View Full Code Here


            SVNAdminArea adminArea, SVNDepth depth) throws SVNException {
        File targetWCPath = adminArea.getRoot();
        boolean isRollBack = revision1 > revision2;

        MergePath item = new MergePath(targetWCPath);
        SVNMergeRange itemRange = new SVNMergeRange(revision1, revision2, true);
        item.myRemainingRanges = new SVNMergeRangeList(itemRange);
        myChildrenWithMergeInfo.add(item);

        driveMergeReportEditor(targetWCPath, url1, revision1, url2, revision2, null, isRollBack,
                depth, adminArea, getMergeCallback(adminArea), null);
View Full Code Here

                        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));
                    }

                    String addedPathStr = SVNPathUtil.validateFilePath(addedPath.getAbsolutePath());
                    String targetMergePathStr = SVNPathUtil.validateFilePath(targetMergePath.myPath.getAbsolutePath());
                    String commonAncestorPath = SVNPathUtil.getCommonPathAncestor(addedPathStr, targetMergePathStr);
View Full Code Here

      MergePath targetMergePath = (MergePath) myChildrenWithMergeInfo.get(0);
        myIsTargetMissingChild = targetMergePath.myHasMissingChildren;
       
        populateRemainingRanges(myChildrenWithMergeInfo, sourceRootURL, url1, revision1, url2, revision2, honorMergeInfo, repository, mergeInfoPath);
       
        SVNMergeRange range = new SVNMergeRange(revision1, revision2, true);
        ISVNReusableEditor editor = null;
        SVNErrorMessage err = null;
        if (honorMergeInfo && !myIsRecordOnly) {
          long startRev = getMostInclusiveStartRevision(myChildrenWithMergeInfo, isRollBack);
          if (SVNRevision.isValidRevisionNumber(startRev)) {
            range.setStartRevision(startRev);
                long endRev = getMostInclusiveEndRevision(myChildrenWithMergeInfo, isRollBack);
                while (SVNRevision.isValidRevisionNumber(endRev)) {
                    SVNURL realURL1 = url1;
                    SVNURL realURL2 = url2;
                    SVNURL oldURL1 = null;
                    SVNURL oldURL2 = null;
                    long nextEndRev = SVNRepository.INVALID_REVISION;
                   
                    sliceRemainingRanges(myChildrenWithMergeInfo, isRollBack, endRev);
                    myCurrentAncestorIndex = -1;
                    if (!sameURLs) {
                        if (isRollBack && endRev != revision2) {
                            realURL2 = url1;
                            oldURL2 = ensureSessionURL(myRepository2, realURL2);
                        }
                        if (!isRollBack && startRev != revision1) {
                            realURL1 = url2;
                            oldURL1 = ensureSessionURL(myRepository1, realURL1);
                        }
                    }
                   
                    try {
                        editor = driveMergeReportEditor(myTarget, realURL1, startRev, realURL2, endRev,
                                myChildrenWithMergeInfo, isRollBack, depth, adminArea, mergeCallback, editor);
                    } finally {
                        if (oldURL1 != null) {
                            myRepository1.setLocation(oldURL1, false);
                        }
                        if (oldURL2 != null) {
                            myRepository2.setLocation(oldURL2, false);
                        }
                    }
                   
                    processChildrenWithNewMergeInfo();
                    processChildrenWithDeletedMergeInfo();
                   
                    removeFirstRangeFromRemainingRanges(endRev, myChildrenWithMergeInfo);
                    nextEndRev = getMostInclusiveEndRevision(myChildrenWithMergeInfo, isRollBack);
                    if (SVNRevision.isValidRevisionNumber(nextEndRev) && myConflictedPaths != null &&
                            !myConflictedPaths.isEmpty() && !myIsDryRun) {
                        SVNMergeRange conflictedRange = new SVNMergeRange(startRev, endRev, false);
                        err = makeMergeConflictError(myTarget, conflictedRange);
                        range.setEndRevision(endRev);
                        break;
                    }
                    startRev = getMostInclusiveStartRevision(myChildrenWithMergeInfo, isRollBack);
View Full Code Here

               
                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) {
View Full Code Here

        for (Iterator mergeInfoIter = mergeInfo[0].keySet().iterator(); mergeInfoIter.hasNext();) {
            String mergeSourcePath = (String) mergeInfoIter.next();
            SVNMergeRangeList rangeList = (SVNMergeRangeList) mergeInfo[0].get(mergeSourcePath);
            SVNMergeRange[] ranges = rangeList.getRanges();
            for (int i = 0; i < ranges.length; i++) {
                SVNMergeRange range = ranges[i];
                if (range.getEndRevision() < revision) {
                    continue;
                }

                LinkedList youngerRanges = new LinkedList();
                for (int j = i; j < ranges.length; j++) {
                    SVNMergeRange youngerRange = ranges[j].dup();
                    if (j == i && youngerRange.getStartRevision() < revision) {
                        youngerRange.setStartRevision(revision);
                        range.setEndRevision(revision);
                    }
                    youngerRanges.add(youngerRange);   
                }
                   
View Full Code Here

            for (Iterator pathsIter = historyAsMergeInfo.keySet().iterator(); pathsIter.hasNext();) {
                String path = (String) pathsIter.next();
                SVNMergeRangeList rangeList = (SVNMergeRangeList) historyAsMergeInfo.get(path);
                SVNMergeRange[] ranges = rangeList.getRanges();
                for (int i = 0; i < ranges.length; i++) {
                    SVNMergeRange mergeRange = ranges[i];
                    if (mergeRange.getStartRevision() >= mergeRange.getEndRevision()) {
                        SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN, "range start >= end");
                        SVNErrorManager.error(err, SVNLogType.DEFAULT);
                    }
                   
                    SVNDirEntry dirEntry = repository.info(path, mergeRange.getEndRevision());
                    if (mergeRangeContainsRevision(mergeRange, dirEntry.getRevision())) {
                        SVNURL fullURL = repository.getLocation();
                        if (path.startsWith("/")) {
                            path = path.substring(1);
                        }
View Full Code Here

      }
     
      long rangeStartRev = getRevisionNumber(rangeStart, youngestRevision, repository, source);
      long rangeEndRev = getRevisionNumber(rangeEnd, youngestRevision, repository, source);
      if (rangeStartRev != rangeEndRev) {
        SVNMergeRange range = new SVNMergeRange(rangeStartRev, rangeEndRev, true);
        mergeRanges.add(range);
      }
      }
     
      SVNMergeRangeList mergeRangesList = SVNMergeRangeList.fromCollection(mergeRanges);
      mergeRanges = mergeRangesList.getRangesAsList();
      if (mergeRanges.isEmpty()) {
        return mergeRanges;
      }
     
      long oldestRequestedRev = SVNRepository.INVALID_REVISION;
      long youngestRequestedRev = SVNRepository.INVALID_REVISION;
      for (Iterator rangesIter = mergeRanges.iterator(); rangesIter.hasNext();) {
      SVNMergeRange range = (SVNMergeRange) rangesIter.next();
      long minRev = Math.min(range.getStartRevision(), range.getEndRevision());
      long maxRev = Math.max(range.getStartRevision(), range.getEndRevision());
     
      if (!SVNRevision.isValidRevisionNumber(oldestRequestedRev) || minRev < oldestRequestedRev) {
        oldestRequestedRev = minRev;
      }
      if (!SVNRevision.isValidRevisionNumber(youngestRequestedRev) || maxRev > youngestRequestedRev) {
        youngestRequestedRev = maxRev;
      }
    }
     
      if (pegRevNum < youngestRequestedRev) {
            getLocations(sourceURL, null, repository, SVNRevision.create(pegRevNum),
                    SVNRevision.create(youngestRequestedRev), SVNRevision.UNDEFINED);
            pegRevNum = youngestRequestedRev;
      }

      LinkedList segments = (LinkedList) repository.getLocationSegments("", pegRevNum, youngestRequestedRev,
          oldestRequestedRev);

    long trimRevision =  SVNRepository.INVALID_REVISION;
    if (!segments.isEmpty()) {
        SVNLocationSegment segment = (SVNLocationSegment) segments.get(0);
        if (segment.getStartRevision() != oldestRequestedRev) {
            trimRevision = segment.getStartRevision();
        } else if (segment.getPath() == null) {
            if (segments.size() > 1) {
                SVNLocationSegment segment2 = (SVNLocationSegment) segments.get(1);
                SVNURL segmentURL = sourceRootURL.appendPath(segment2.getPath(), false);
                SVNLocationEntry copyFromLocation = getCopySource(null, segmentURL,
                        SVNRevision.create(segment2.getStartRevision()));
                String copyFromPath = copyFromLocation.getPath();
                long copyFromRevision = copyFromLocation.getRevision();
                if (copyFromPath != null && SVNRevision.isValidRevisionNumber(copyFromRevision)) {
                    SVNLocationSegment newSegment = new SVNLocationSegment(copyFromRevision,
                            copyFromRevision, copyFromPath);
                    segment.setStartRevision(copyFromRevision + 1);
                    segments.addFirst(newSegment);
                }
            }
        }
    }

    SVNLocationSegment[] segmentsArray = (SVNLocationSegment[]) segments.toArray(new SVNLocationSegment[segments.size()]);
    List resultMergeSources = new LinkedList();
      for (Iterator rangesIter = mergeRanges.iterator(); rangesIter.hasNext();) {
      SVNMergeRange range = (SVNMergeRange) rangesIter.next();
      if (SVNRevision.isValidRevisionNumber(trimRevision)) {
          if (Math.max(range.getStartRevision(), range.getEndRevision()) < trimRevision) {
              continue;
          }
          if (range.getStartRevision() < trimRevision) {
              range.setStartRevision(trimRevision);
          }
          if (range.getEndRevision() < trimRevision) {
              range.setEndRevision(trimRevision);
          }
      }
      List mergeSources = combineRangeWithSegments(range, segmentsArray, sourceRootURL);
      resultMergeSources.addAll(mergeSources);
      }
View Full Code Here

        SVNMergeRangeList ranges1 = (SVNMergeRangeList) historyEntry.getValue();
        SVNMergeRangeList ranges2 = (SVNMergeRangeList) history2.get(path);
        if (ranges2 != null) {
          SVNMergeRangeList commonList = ranges2.intersect(ranges1, true);
          if (!commonList.isEmpty()) {
            SVNMergeRange commonRanges[] = commonList.getRanges();
            SVNMergeRange youngestCommonRange = commonRanges[commonRanges.length - 1];
            if (!SVNRevision.isValidRevisionNumber(youngestCommonRevision) ||
                youngestCommonRange.getEndRevision() > youngestCommonRevision) {
              youngestCommonRevision = youngestCommonRange.getEndRevision();
              youngestCommonPath = path;
            }
          }
        }
      }
View Full Code Here

            Collection pathRanges = (Collection) mergeInfo.get(sourcePath);
            if (pathRanges == null) {
                pathRanges = new LinkedList();
                mergeInfo.put(sourcePath, pathRanges);
            }
            SVNMergeRange range = new SVNMergeRange(Math.max(segment.getStartRevision() - 1, 0),
                    segment.getEndRevision(), true);
            pathRanges.add(range);
        }
        Map result = new TreeMap();
        for (Iterator paths = mergeInfo.keySet().iterator(); paths.hasNext();) {
View Full Code Here

TOP

Related Classes of org.tmatesoft.svn.core.SVNMergeRange

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.