public void handleLocationSegment(SVNLocationSegment locationSegment) throws SVNException { maybeSendOpener(); Map attrs = new HashMap(); String path = locationSegment.getPath(); if (path != null) { path = DAVPathUtil.dropLeadingSlash(path); String quotedPath = SVNEncodingUtil.xmlEncodeCDATA(path, true); attrs.put(PATH_ATTR, quotedPath); attrs.put(RANGE_START_ATTR, String.valueOf(locationSegment.getStartRevision())); attrs.put(RANGE_END_ATTR, String.valueOf(locationSegment.getEndRevision())); } else { attrs.put(RANGE_START_ATTR, String.valueOf(locationSegment.getStartRevision())); attrs.put(RANGE_END_ATTR, String.valueOf(locationSegment.getEndRevision())); } StringBuffer buffer = SVNXMLUtil.openXMLTag(SVNXMLUtil.SVN_NAMESPACE_PREFIX, LOCATION_SEGMENT_TAG, SVNXMLUtil.XML_STYLE_SELF_CLOSING, attrs, null); write(buffer); }
public void maybeCropAndSendSegment(String path, long startRevision, long rangeStart, long rangeEnd, ISVNLocationSegmentHandler handler) throws SVNException { long segmentRangeStart = rangeStart; long segmentRangeEnd = rangeEnd; if (segmentRangeStart <= startRevision) { if (segmentRangeEnd > startRevision) { segmentRangeEnd = startRevision; } if (handler != null) { handler.handleLocationSegment(new SVNLocationSegment(segmentRangeStart, segmentRangeEnd, path)); myCount += segmentRangeEnd - segmentRangeStart + 1; } } }
public void handleLocationSegment(SVNLocationSegment locationSegment) throws SVNException { // skip first. if (copyFrom[0] == null) { copyFrom[0] = Boolean.TRUE; } else if (copyFrom[1] != null) { return; } else if (locationSegment.getPath() != null) { copyFrom[1] = locationSegment.getPath(); copyFrom[2] = locationSegment.getEndRevision(); } } });
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);
SVNURL targetUrl = SVNWCUtils.join(targetReposRoot, targetReposRelPath); SVNLocationSegment yc = getRepositoryAccess().getYoungestCommonAncestor(sourceUrl, sourceRev, targetUrl, targetRev); if (!(yc != null && yc.getPath() != null && yc.getStartRevision() >= 0)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_NOT_READY_TO_MERGE, "''{0}''@''{1}'' must be ancestrally related to ''{2}''@''{3}''", sourceUrl, new Long(sourceRev), targetUrl, new Long(targetRev)); if (sourceRev == yc.getStartRevision()) { return null; mergedToSourceCatalog.putAll(mergeInfoCatalog); UnmergedMergeInfo unmergedMergeInfo = findUnmergedMergeInfo(yc.getStartRevision(), mergeInfoCatalog, segmentsMap, sourceReposRelPath, targetReposRelPath, targetRev, sourceRev, sourceRepository, targetRepository); unmergedMergeInfo.catalog = SVNMergeInfoUtil.elideMergeInfoCatalog(unmergedMergeInfo.catalog); if (unmergedToSourceCatalog != null && unmergedMergeInfo.catalog != null) { return SvnTarget.fromURL(sourceReposRoot.appendPath(yc.getPath(), false), SVNRevision.create(yc.getStartRevision())); } else { Structure<LocationsInfo> locations = getRepositoryAccess().getLocations(targetRepository, SvnTarget.fromURL(targetUrl),
public int compare(Object o1, Object o2) { if (o1 == o2) { return 0; } else if (o1 == null) { return -1; } else if (o2 == null) { return 1; } SVNLocationSegment segment1 = (SVNLocationSegment) o1; SVNLocationSegment segment2 = (SVNLocationSegment) o2; if (segment1.getStartRevision() == segment2.getStartRevision()) { return 0; } return segment1.getStartRevision() < segment2.getStartRevision() ? -1 : 1; } });
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 yc = getRepositoryAccess().getYoungestCommonAncestor(url2, rev2, url1.getURL(), rev1); if (yc == null || !(yc.getPath() != null && yc.getStartRevision() >= 0)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_NOT_READY_TO_MERGE, "''{0}''@''{1}'' must be ancestrally related to ''{2}''@''{3}''", url1, new Long(rev1), url2, new Long(rev2)); if (rev1 > yc.getStartRevision()) { Map<File, Map<String, SVNMergeRangeList>> finalUnmergedCatalog = new HashMap<File, Map<String,SVNMergeRangeList>>(); String ycPath = yc.getPath(); if (ycPath.startsWith("/")) { ycPath = ycPath.substring(1); "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[] {new Long(yc.getStartRevision() + 1), new Long(rev2), targetUrl, catalog}); SVNErrorManager.error(err, SVNLogType.WC); url1.getURL(), rev1, url2, rev2, yc.getStartRevision(), sourceReposRoot, wcReposRoot,
public int compare(Object o1, Object o2) { if (o1 == o2) { return 0; } else if (o1 == null) { return -1; } else if (o2 == null) { return 1; } SVNLocationSegment segment1 = (SVNLocationSegment) o1; SVNLocationSegment segment2 = (SVNLocationSegment) o2; if (segment1.getStartRevision() == segment2.getStartRevision()) { return 0; } return segment1.getStartRevision() < segment2.getStartRevision() ? -1 : 1; } });
public static Map<String, SVNMergeRangeList> getMergeInfoFromSegments(Collection segments) { Map mergeInfo = new TreeMap(); for (Iterator segmentsIter = segments.iterator(); segmentsIter.hasNext();) { SVNLocationSegment segment = (SVNLocationSegment) segmentsIter.next(); if (segment.getPath() == null) { continue; } String sourcePath = segment.getPath(); 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<String, SVNMergeRangeList> result = new TreeMap<String, SVNMergeRangeList>(); for (Iterator paths = mergeInfo.keySet().iterator(); paths.hasNext();) { String path = (String) paths.next(); Collection pathRanges = (Collection) mergeInfo.get(path); result.put(path, SVNMergeRangeList.fromCollection(pathRanges)); } return result; }
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);
boolean sourcesRelated = false; if (yc != null && yc.getPath() != null && yc.getStartRevision() >= 0) { sourcesRelated = true; SVNURL ycURL = sourceReposRootURL.appendPath(yc.getPath(), false); if (url2.equals(ycURL) && yc.getStartRevision() == rev2) { sourcesAncestral = true; SVNRevisionRange range = new SVNRevisionRange(SVNRevision.create(rev1), SVNRevision.create(yc.getStartRevision())); Collection<SVNRevisionRange> ranges = new ArrayList<SVNRevisionRange>(); ranges.add(range); sources = mergeDriver.normalizeMergeSources(SvnTarget.fromURL(url1), url1, sourceReposRootURL, SVNRevision.create(rev1), ranges, repos1); } else if (url1.equals(ycURL) && yc.getStartRevision() == rev1) { sourcesAncestral = true; SVNRevisionRange range = new SVNRevisionRange(SVNRevision.create(yc.getStartRevision()), SVNRevision.create(rev2)); Collection<SVNRevisionRange> ranges = new ArrayList<SVNRevisionRange>(); ranges.add(range); repos2, url1, rev1, url2, rev2, yc.getStartRevision(), sourceReposRootURL, wcReposRootURL, getOperation().getDepth(),
public int compare(Object o1, Object o2) { if (o1 == o2) { return 0; } else if (o1 == null) { return -1; } else if (o2 == null) { return 1; } SVNLocationSegment segment1 = (SVNLocationSegment) o1; SVNLocationSegment segment2 = (SVNLocationSegment) o2; if (segment1.getStartRevision() == segment2.getStartRevision()) { return 0; } return segment1.getStartRevision() < segment2.getStartRevision() ? -1 : 1; } });
public void maybeCropAndSendSegment(String path, long startRevision, long rangeStart, long rangeEnd, ISVNLocationSegmentHandler handler) throws SVNException { long segmentRangeStart = rangeStart; long segmentRangeEnd = rangeEnd; if (segmentRangeStart <= startRevision) { if (segmentRangeEnd > startRevision) { segmentRangeEnd = startRevision; } if (handler != null) { handler.handleLocationSegment(new SVNLocationSegment(segmentRangeStart, segmentRangeEnd, path)); myCount += segmentRangeEnd - segmentRangeStart + 1; } } }
public static Map<String, SVNMergeRangeList> getMergeInfoFromSegments(Collection<SVNLocationSegment> segments) { Map<String, Collection<SVNMergeRange>> mergeInfo = new TreeMap<String, Collection<SVNMergeRange>>(); for (Iterator<SVNLocationSegment> segmentsIter = segments.iterator(); segmentsIter.hasNext();) { SVNLocationSegment segment = (SVNLocationSegment) segmentsIter.next(); if (segment.getPath() == null) { continue; } String sourcePath = segment.getPath(); Collection<SVNMergeRange> pathRanges = mergeInfo.get(sourcePath); if (pathRanges == null) { pathRanges = new LinkedList<SVNMergeRange>(); mergeInfo.put(sourcePath, pathRanges); } SVNMergeRange range = new SVNMergeRange(Math.max(segment.getStartRevision() - 1, 0), segment.getEndRevision(), true); pathRanges.add(range); } Map<String, SVNMergeRangeList> result = new TreeMap<String, SVNMergeRangeList>(); for (Iterator<String> paths = mergeInfo.keySet().iterator(); paths.hasNext();) { String path = (String) paths.next(); Collection<SVNMergeRange> pathRanges = mergeInfo.get(path); result.put(path, SVNMergeRangeList.fromCollection(pathRanges)); } return result; }
if (!segments.isEmpty()) { SVNLocationSegment segment = segments.get(0); if (segment.getStartRevision() != oldestRequested) { 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 = repositoryAccess.getCopySource(SvnTarget.fromURL(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.add(0, newSegment);
long targetRev = getWcContext().getNodeBaseRev(localAbsPath); SVNLocationSegment ancestor = getRepositoryAccess().getYoungestCommonAncestor(switchRevUrl, revnum, targetUrl, targetRev); if (!(ancestor.getPath() != null && ancestor.getStartRevision() >= 0)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_UNRELATED_RESOURCES, "''{0}'' shares no common ancestry with ''{1}''", switchUrl, localAbsPath);
if (!segments.isEmpty() && hasZero != null && hasZero.length > 0) { SVNLocationSegment oldest = segments.get(0); hasZero[0] = oldest.getStartRevision() == 0;
public void maybeCropAndSendSegment(String path, long startRevision, long rangeStart, long rangeEnd, ISVNLocationSegmentHandler handler) throws SVNException { long segmentRangeStart = rangeStart; long segmentRangeEnd = rangeEnd; if (segmentRangeStart <= startRevision) { if (segmentRangeEnd > startRevision) { segmentRangeEnd = startRevision; } if (handler != null) { handler.handleLocationSegment(new SVNLocationSegment(segmentRangeStart, segmentRangeEnd, path)); myCount += segmentRangeEnd - segmentRangeStart + 1; } } }
private Map getMergeInfoFromSegments(Collection segments) { Map mergeInfo = new TreeMap(); for (Iterator segmentsIter = segments.iterator(); segmentsIter.hasNext();) { SVNLocationSegment segment = (SVNLocationSegment) segmentsIter.next(); if (segment.getPath() == null) { continue; } String sourcePath = segment.getPath(); 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();) { String path = (String) paths.next(); Collection pathRanges = (Collection) mergeInfo.get(path); result.put(path, SVNMergeRangeList.fromCollection(pathRanges)); } return result; }