use of org.tigris.subversion.subclipse.core.ISVNRemoteResource in project subclipse by subclipse.
the class RevisionAwareDifferencer method compareEditions.
/**
* Compares two nodes to determine if they are equal. Returns NODE_EQUAL of they are the same,
* NODE_NOT_EQUAL if they are different, and NODE_UNKNOWN if comparison was not possible.
*/
protected int compareEditions(Object left, Object right) {
// calculate the type for the left contribution
ISVNRemoteResource leftEdition = null;
if (left instanceof ResourceEditionNode) {
leftEdition = ((ResourceEditionNode) left).getRemoteResource();
}
// calculate the type for the right contribution
ISVNRemoteResource rightEdition = null;
if (right instanceof ResourceEditionNode)
rightEdition = ((ResourceEditionNode) right).getRemoteResource();
if (leftEdition == null || rightEdition == null) {
return NODE_UNKNOWN;
}
// if they're both non-files, they're the same
if (leftEdition.isContainer() && rightEdition.isContainer()) {
return NODE_EQUAL;
}
// if they have different types, they're different
if (leftEdition.isContainer() != rightEdition.isContainer()) {
return NODE_NOT_EQUAL;
}
String leftLocation = leftEdition.getRepository().getLocation();
String rightLocation = rightEdition.getRepository().getLocation();
if (!leftLocation.equals(rightLocation)) {
return NODE_UNKNOWN;
}
if (leftEdition.getUrl().equals(rightEdition.getUrl()) && leftEdition.getLastChangedRevision().equals(rightEdition.getLastChangedRevision())) {
return NODE_EQUAL;
} else {
// if(considerContentIfRevisionOrPathDiffers()) {
return NODE_UNKNOWN;
// } else {
// return NODE_NOT_EQUAL;
// }
}
}
use of org.tigris.subversion.subclipse.core.ISVNRemoteResource in project subclipse by subclipse.
the class SVNCompareEditorInput method getLabel.
/**
* Returns the label for the given input element (which is a ResourceEditionNode).
*/
private String getLabel(ITypedElement element) {
if (element instanceof ResourceEditionNode) {
ISVNRemoteResource edition = ((ResourceEditionNode) element).getRemoteResource();
SVNRevision revision = edition.getLastChangedRevision();
if (revision == null) {
revision = edition.getRevision();
}
if (edition instanceof ISVNRemoteFile) {
return Policy.bind("nameAndRevision", edition.getName(), // $NON-NLS-1$
revision.toString());
}
if (edition.isContainer()) {
// $NON-NLS-1$
return Policy.bind("SVNCompareEditorInput.inHead", edition.getName());
} else {
return Policy.bind("SVNCompareEditorInput.repository", // $NON-NLS-1$
new Object[] { edition.getName(), revision.toString() });
}
}
return element.getName();
}
use of org.tigris.subversion.subclipse.core.ISVNRemoteResource in project subclipse by subclipse.
the class SVNCompareEditorInput method getVersionLabel.
/**
* Returns the label for the given input element. (which is a ResourceEditionNode)
*/
private String getVersionLabel(ITypedElement element) {
if (element instanceof ResourceEditionNode) {
ISVNRemoteResource edition = ((ResourceEditionNode) element).getRemoteResource();
SVNRevision revision = edition.getLastChangedRevision();
if (revision == null) {
revision = edition.getRevision();
}
if (edition.isContainer()) {
// $NON-NLS-1$
return Policy.bind("SVNCompareEditorInput.headLabel");
} else {
return revision.toString();
}
}
return element.getName();
}
use of org.tigris.subversion.subclipse.core.ISVNRemoteResource in project subclipse by subclipse.
the class MergeWizardRevisionsPage method compareRevisions.
private void compareRevisions() {
IStructuredSelection sel = (IStructuredSelection) changePathsViewer.getSelection();
Object sel0 = sel.getFirstElement();
if (sel0 instanceof LogEntryChangePath) {
LogEntryChangePath logEntryChangePath = (LogEntryChangePath) sel0;
try {
if (!logEntryChangePath.getRemoteResource().isContainer()) {
ISVNRemoteResource left = logEntryChangePath.getRemoteResource();
compareInput = compareInputMap.get(left.getUrl().toString() + left.getRevision());
boolean run = compareInput == null;
if (compareInput == null) {
SVNRevision.Number selectedRevision = (SVNRevision.Number) left.getRevision();
SVNRevision.Number previousRevision = new SVNRevision.Number(selectedRevision.getNumber() - 1);
ISVNRemoteResource right = new RemoteFile(left.getRepository(), left.getUrl(), previousRevision);
compareInput = new SVNCompareEditorInput(new ResourceEditionNode(left), new ResourceEditionNode(right));
compareInputMap.put(left.getUrl().toString() + left.getRevision(), compareInput);
}
setCompareInput(compareInput, run);
showComparePane(true);
}
} catch (Exception e) {
MessageDialog.openError(getShell(), Messages.MergeWizardRevisionsPage_5, e.getMessage());
}
}
}
use of org.tigris.subversion.subclipse.core.ISVNRemoteResource in project subclipse by subclipse.
the class MergeWizardUnblockRevisionsPage method compareRevisions.
private void compareRevisions() {
IStructuredSelection sel = (IStructuredSelection) changePathsViewer.getSelection();
Object sel0 = sel.getFirstElement();
if (sel0 instanceof LogEntryChangePath) {
LogEntryChangePath logEntryChangePath = (LogEntryChangePath) sel0;
try {
if (!logEntryChangePath.getRemoteResource().isContainer()) {
ISVNRemoteResource left = logEntryChangePath.getRemoteResource();
compareInput = compareInputMap.get(left.getUrl().toString() + left.getRevision());
boolean run = compareInput == null;
if (compareInput == null) {
SVNRevision.Number selectedRevision = (SVNRevision.Number) left.getRevision();
SVNRevision.Number previousRevision = new SVNRevision.Number(selectedRevision.getNumber() - 1);
ISVNRemoteResource right = new RemoteFile(left.getRepository(), left.getUrl(), previousRevision);
compareInput = new SVNCompareEditorInput(new ResourceEditionNode(left), new ResourceEditionNode(right));
compareInputMap.put(left.getUrl().toString() + left.getRevision(), compareInput);
}
setCompareInput(compareInput, run);
showComparePane(true);
}
} catch (Exception e) {
MessageDialog.openError(getShell(), Messages.MergeWizardRevisionsPage_5, e.getMessage());
}
}
}
Aggregations