Java Code Examples for org.tigris.subversion.svnclientadapter.SVNDiffSummary.SVNDiffKind#MODIFIED

The following examples show how to use org.tigris.subversion.svnclientadapter.SVNDiffSummary.SVNDiffKind#MODIFIED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractJhlClientAdapter.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private SVNDiffKind getDiffKind(String changedResource,
		boolean deletedLines, boolean addedLines, boolean contextLines,
		boolean oldRev0, boolean newRev0) {
	SVNDiffKind diffKind;
	if (oldRev0 && newRev0) {
		diffKind = SVNDiffKind.DELETED;
	} else if (addedLines && !deletedLines && !contextLines)
		diffKind = SVNDiffKind.ADDED;
	else if ((!deletedLines && !addedLines) || deletedLines && !addedLines
			&& !contextLines) {
		if (exists(changedResource)) {
			diffKind = SVNDiffKind.DELETED;
		} else {
			diffKind = SVNDiffKind.ADDED;
		}
	} else
		diffKind = SVNDiffKind.MODIFIED;
	return diffKind;
}
 
Example 2
Source File: SvnClientJavaHl.java    From MergeProcessor with Apache License 2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public List<SvnDiff> diff(final URL url, long fromRevision, long toRevision) throws SvnClientException {
	final List<SvnDiff> list = new ArrayList<>();
	try {
		final SVNDiffSummary[] diffSummarize = client.diffSummarize(toSVNUrl(url), new Number(fromRevision),
				toSVNUrl(url), new Number(toRevision), Depth.infinity, true);
		for (final SVNDiffSummary svnDiffSummary : diffSummarize) {
			final SvnDiffAction action;
			if (svnDiffSummary.getDiffKind() == SVNDiffKind.ADDED) {
				action = SvnDiffAction.ADDED;
			} else if (svnDiffSummary.getDiffKind() == SVNDiffKind.DELETED) {
				action = SvnDiffAction.DELETED;
			} else if (svnDiffSummary.getDiffKind() == SVNDiffKind.MODIFIED) {
				action = SvnDiffAction.MODIFIED;
			} else if (svnDiffSummary.getDiffKind() == SVNDiffKind.NORMAL) {
				if (svnDiffSummary.propsChanged()) {
					action = SvnDiffAction.PROPERTY_CHANGED;
				} else {
					throw LogUtil
							.throwing(new SvnClientException("Unknown state of SVNDiffSummary " + svnDiffSummary));
				}
			} else {
				throw LogUtil
						.throwing(new SvnClientException("Unknown SvnDiffAction " + svnDiffSummary.getDiffKind()));
			}
			list.add(new SvnDiff(action, new URL(convertURLToString(url) + '/' + svnDiffSummary.getPath())));
		}
	} catch (MalformedURLException | SVNClientException e) {
		throw new SvnClientException(e);
	}
	return list;
}
 
Example 3
Source File: SVNLocalCompareSummaryInput.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private SVNDiffSummary[] getDiffSummary(RemoteResourceStatus[] statuses, ISVNLocalResource resource) {
	List diffSummaryList = new ArrayList();
	int rootPathLength = resource.getResource().getLocation().toString().length() + 1;
	for (int i = 0; i < statuses.length; i++) {
		if (statuses[i].getFile() != null && !statuses[i].getNodeKind().equals(SVNNodeKind.DIR)) {
			SVNStatusKind textStatus = statuses[i].getTextStatus();
			boolean propertyChanges = !statuses[i].getPropStatus().equals(SVNStatusKind.NORMAL) && !statuses[i].getPropStatus().equals(SVNStatusKind.NONE);
			boolean localChanges = false;
			if (textStatus.equals(SVNStatusKind.NONE) && propertyChanges && statuses[i].getNodeKind().equals(SVNNodeKind.FILE)) {
				IFile file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(statuses[i].getPath()));
				if (file != null) {
					ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(file);
					try {
						LocalResourceStatus localStatus = svnResource.getStatus();
						if (localStatus != null) {
							localChanges = localStatus.isAdded() || localStatus.isDirty();
						}
					} catch (SVNException e) {}
				}
			}
			if (!textStatus.equals(SVNStatusKind.NONE) || !propertyChanges || localChanges) {
				SVNDiffKind diffKind = null;
				if (statuses[i].getTextStatus().equals(SVNStatusKind.ADDED)) diffKind = SVNDiffKind.ADDED;
				else if (statuses[i].getTextStatus().equals(SVNStatusKind.DELETED)) diffKind = SVNDiffKind.DELETED;
				else diffKind = SVNDiffKind.MODIFIED;
				SVNDiffSummary diffSummary = new SVNDiffSummary(statuses[i].getPath().substring(rootPathLength).replaceAll("\\\\", "/"), diffKind, propertyChanges, statuses[i].getNodeKind().toInt()); //$NON-NLS-1$ //$NON-NLS-2$
				diffSummaryList.add(diffSummary);
			}
		}
	}
	SVNDiffSummary[] diffSummaries = new SVNDiffSummary[diffSummaryList.size()];
	diffSummaryList.toArray(diffSummaries);
	return diffSummaries;
}