use of org.tigris.subversion.svnclientadapter.SVNDiffSummary 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;
}
use of org.tigris.subversion.svnclientadapter.SVNDiffSummary in project subclipse by subclipse.
the class SVNLocalCompareSummaryInput method getDiffSummaryWithSubfolders.
private SVNDiffSummary[] getDiffSummaryWithSubfolders(SVNDiffSummary[] diffSummary) {
ArrayList paths = new ArrayList();
ArrayList diffs = new ArrayList();
for (int i = 0; i < diffSummary.length; i++) {
paths.add(diffSummary[i].getPath());
diffs.add(diffSummary[i]);
}
for (int i = 0; i < diffSummary.length; i++) {
File file = new File(diffSummary[i].getPath());
while (file.getParentFile() != null) {
file = file.getParentFile();
String path = file.getPath();
// $NON-NLS-1$ //$NON-NLS-2$
path = path.replaceAll("\\\\", "/");
if (!paths.contains(path)) {
paths.add(path);
SVNDiffSummary folder = new SVNDiffSummary(path, SVNDiffKind.NORMAL, false, SVNNodeKind.DIR.toInt());
diffs.add(folder);
}
}
}
diffSummary = new SVNDiffSummary[diffs.size()];
diffs.toArray(diffSummary);
return diffSummary;
}
Aggregations