use of org.tigris.subversion.svnclientadapter.SVNStatusKind in project subclipse by subclipse.
the class SVNLocalCompareSummaryInput method getDiffSummary.
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, // $NON-NLS-1$ //$NON-NLS-2$
statuses[i].getNodeKind().toInt());
diffSummaryList.add(diffSummary);
}
}
}
SVNDiffSummary[] diffSummaries = new SVNDiffSummary[diffSummaryList.size()];
diffSummaryList.toArray(diffSummaries);
return diffSummaries;
}
Aggregations