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(); } } });
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; }
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; }
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; }
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; }
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); }
private void checkGetSegments(@NotNull SVNRepository repo, @NotNull String path, long pegRev, long startRev, long endRev, @NotNull String... expected) throws SVNException { final List<String> actual = new ArrayList<>(); repo.getLocationSegments(path, pegRev, startRev, endRev, locationEntry -> { actual.add(locationEntry.getPath() + "@" + locationEntry.getStartRevision() + ":" + locationEntry.getEndRevision()); }); Assert.assertEquals(actual.toArray(new String[actual.size()]), expected); } }
SVNLocationSegment segment = segments[i]; if (segment.getEndRevision() < minRev || segment.getStartRevision() > maxRev || segment.getPath() == null) { continue; if (minRev <= segment.getStartRevision()) { if (i > 0) { path1 = segments[i - 1].getPath(); path1 = segments[i - 2].getPath(); rev1 = segments[i - 2].getEndRevision(); path1 = segment.getPath(); if (path1 == null || segment.getPath() == null) { continue; mergeSource.myURL2 = sourceRootURL.appendPath(segment.getPath(), false); mergeSource.myRevision1 = rev1; mergeSource.myRevision2 = Math.min(segment.getEndRevision(), maxRev);
SVNLocationSegment segment = segments[i]; if (segment.getEndRevision() < minRev || segment.getStartRevision() > maxRev || segment.getPath() == null) { continue; if (minRev <= segment.getStartRevision()) { if (i > 0) { path1 = segments[i - 1].getPath(); path1 = segments[i - 2].getPath(); rev1 = segments[i - 2].getEndRevision(); path1 = segment.getPath(); if (path1 == null || segment.getPath() == null) { continue; mergeSource.myURL2 = sourceRootURL.appendPath(segment.getPath(), false); mergeSource.myRevision1 = rev1; mergeSource.myRevision2 = Math.min(segment.getEndRevision(), maxRev);
SVNLocationSegment segment = segments[i]; if (segment.getEndRevision() < minRev || segment.getStartRevision() > maxRev || segment.getPath() == null) { continue; if (minRev <= segment.getStartRevision()) { if (i > 0) { path1 = segments[i - 1].getPath(); path1 = segments[i - 2].getPath(); rev1 = segments[i - 2].getEndRevision(); path1 = segment.getPath(); if (path1 == null || segment.getPath() == null) { continue; mergeSource.url2 = sourceRootURL.appendPath(segment.getPath(), false); mergeSource.rev1 = rev1; mergeSource.rev2 = Math.min(segment.getEndRevision(), maxRev);
SVNLocationSegment segment = segments[i]; if (segment.getEndRevision() < minRev || segment.getStartRevision() > maxRev || segment.getPath() == null) { continue; if (minRev <= segment.getStartRevision()) { if (i > 0) { path1 = segments[i - 1].getPath(); path1 = segments[i - 2].getPath(); rev1 = segments[i - 2].getEndRevision(); path1 = segment.getPath(); if (path1 == null || segment.getPath() == null) { continue; mergeSource.myURL2 = sourceRootURL.appendPath(segment.getPath(), false); mergeSource.myRevision1 = rev1; mergeSource.myRevision2 = Math.min(segment.getEndRevision(), maxRev);
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)); return SvnTarget.fromURL(sourceReposRoot.appendPath(yc.getPath(), false), SVNRevision.create(yc.getStartRevision())); } else { Structure<LocationsInfo> locations = getRepositoryAccess().getLocations(targetRepository, SvnTarget.fromURL(targetUrl),
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()));
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()));
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()));
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();
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)); String ycPath = yc.getPath(); if (ycPath.startsWith("/")) { ycPath = ycPath.substring(1);
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);