Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2002-04-22 16:36:43 +0000
committerJean Michel-Lemieux2002-04-22 16:36:43 +0000
commit9f89115ef9494b68794da0b87c48d3830c174de1 (patch)
treee96f0c0063cea391433f6a407a54f2de4d63f87b
parentce3b85325de6ae481f6064bb8bb5482b483cca1e (diff)
downloadeclipse.platform.team-9f89115ef9494b68794da0b87c48d3830c174de1.tar.gz
eclipse.platform.team-9f89115ef9494b68794da0b87c48d3830c174de1.tar.xz
eclipse.platform.team-9f89115ef9494b68794da0b87c48d3830c174de1.zip
*** empty log message ***
-rw-r--r--bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteSyncElement.java37
-rw-r--r--bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSCompareSyncElement.java46
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLocalCompareEditorInput.java78
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java31
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java14
5 files changed, 139 insertions, 67 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteSyncElement.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteSyncElement.java
index 8eb15d20f..15b2311c9 100644
--- a/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteSyncElement.java
+++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/core/sync/RemoteSyncElement.java
@@ -219,45 +219,20 @@ public abstract class RemoteSyncElement extends LocalSyncElement implements IRem
}
}
}
- } else { // three-way compare without access to base contents
+ } else { // two compare without access to base contents
if (remote == null) {
if (!localExists) {
- // this should never happen
Assert.isTrue(false);
+ // shouldn't happen
} else {
- // no remote but a local
- if (!isDirty && isOutOfDate) {
- description = INCOMING | DELETION;
- } else if (isDirty && isOutOfDate) {
- description = CONFLICTING | CHANGE;
- } else if (!isDirty && !isOutOfDate) {
- description = OUTGOING | ADDITION;
- }
+ description= ADDITION;
}
} else {
if (!localExists) {
- // a remote but no local
- if (!isDirty && !isOutOfDate) {
- description = INCOMING | ADDITION;
- } else if (isDirty && !isOutOfDate) {
- description = OUTGOING | DELETION;
- } else if (isDirty && isOutOfDate) {
- description = CONFLICTING | CHANGE;
- }
+ description= DELETION;
} else {
- // have a local and a remote
- if (!isDirty && !isOutOfDate && base != null) {
- // ignore, there is no change;
- } else if (!isDirty && isOutOfDate) {
- description = INCOMING | CHANGE;
- } else if (isDirty && !isOutOfDate) {
- description = OUTGOING | CHANGE;
- } else {
- description = CONFLICTING | CHANGE;
- }
- // if contents are the same, then mark as pseudo change
- if (description != IN_SYNC && compare(granularity, false, local, remote, progress))
- description |= PSEUDO_CONFLICT;
+ if (! compare(granularity, !isDirty, local, remote, Policy.subMonitorFor(progress, 30)))
+ description= CHANGE;
}
}
}
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSCompareSyncElement.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSCompareSyncElement.java
new file mode 100644
index 000000000..a3816cb83
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/resources/CVSCompareSyncElement.java
@@ -0,0 +1,46 @@
+package org.eclipse.team.internal.ccvs.core.resources;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.team.core.sync.IRemoteResource;
+import org.eclipse.team.internal.ccvs.core.CVSException;
+import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
+import org.eclipse.team.internal.ccvs.core.ICVSFile;
+import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo;
+
+public class CVSCompareSyncElement extends CVSRemoteSyncElement {
+
+ public CVSCompareSyncElement(IResource local, IRemoteResource remote) {
+ super(false /* two way */, local, null, remote);
+ }
+
+ /*
+ * Assume both resources exist.
+ * @see ILocalSyncElement#isDirty()
+ */
+ public boolean isDirty() {
+ IResource local = getLocal();
+ try {
+
+ if(local.getType()==IResource.FILE) {
+ ICVSFile file = CVSWorkspaceRoot.getCVSFileFor((IFile)local);
+ ResourceSyncInfo info = file.getSyncInfo();
+ if(info==null) {
+ return true;
+ }
+ boolean sameRevisions = ((RemoteFile)getRemote()).getRevision().equals(info.getRevision());
+ return !sameRevisions;
+ } else {
+ return false;
+ }
+ } catch(CVSException e) {
+ CVSProviderPlugin.log(e.getStatus());
+ return true;
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLocalCompareEditorInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLocalCompareEditorInput.java
new file mode 100644
index 000000000..3a6b8df8f
--- /dev/null
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLocalCompareEditorInput.java
@@ -0,0 +1,78 @@
+package org.eclipse.team.internal.ccvs.ui;
+
+/*
+ * (c) Copyright IBM Corp. 2000, 2002.
+ * All Rights Reserved.
+ */
+
+import org.eclipse.compare.structuremergeviewer.ICompareInput;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.team.core.TeamException;
+import org.eclipse.team.core.sync.IRemoteResource;
+import org.eclipse.team.core.sync.IRemoteSyncElement;
+import org.eclipse.team.internal.ccvs.core.CVSTag;
+import org.eclipse.team.internal.ccvs.core.resources.CVSCompareSyncElement;
+import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
+import org.eclipse.team.internal.ccvs.ui.sync.CVSSyncCompareInput;
+import org.eclipse.team.ui.sync.SyncView;
+
+public class CVSLocalCompareEditorInput extends CVSSyncCompareInput {
+ CVSTag tag;
+
+ public CVSLocalCompareEditorInput(IResource[] resources, CVSTag tag) {
+ super(resources);
+ this.tag = tag;
+ }
+
+ public Viewer createDiffViewer(Composite parent) {
+ Viewer viewer = super.createDiffViewer(parent);
+ getViewer().syncModeChanged(SyncView.SYNC_MERGE);
+ return viewer;
+ }
+
+ protected IRemoteSyncElement[] createSyncElements(IProgressMonitor monitor) throws TeamException {
+ IResource[] resources = getResources();
+ IRemoteSyncElement[] trees = new IRemoteSyncElement[resources.length];
+ int work = 100 * resources.length;
+ monitor.beginTask(null, work);
+ try {
+ for (int i = 0; i < trees.length; i++) {
+ IResource resource = resources[i];
+ IRemoteResource remote = CVSWorkspaceRoot.getRemoteTree(resource, tag, Policy.subMonitorFor(monitor, 50));
+ trees[i] = new CVSCompareSyncElement(resource, remote);
+ }
+ } finally {
+ monitor.done();
+ }
+ //getViewer().resetFilters();
+ return trees;
+ }
+
+ public CVSTag getTag() {
+ return tag;
+ }
+
+ public String getTitle() {
+ return "CVS Compare [" + tag.getName() +"]";
+ }
+
+ public boolean isSaveNeeded() {
+ return false;
+ }
+
+ protected void contentsChanged(ICompareInput source) {
+ }
+
+ /*
+ * @see SyncCompareInput#getSyncGranularity()
+ */
+ protected int getSyncGranularity() {
+ // we have to perform content comparison since files in different branches
+ // may have different revisions but the same contents. Consider these files
+ // for merge purposes as equal.
+ return IRemoteSyncElement.GRANULARITY_CONTENTS;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
index d39cd68de..5d685f739 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
@@ -22,6 +22,7 @@ import org.eclipse.team.internal.ccvs.core.CVSTag;
import org.eclipse.team.internal.ccvs.core.ICVSRemoteResource;
import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot;
import org.eclipse.team.internal.ccvs.ui.CVSCompareEditorInput;
+import org.eclipse.team.internal.ccvs.ui.CVSLocalCompareEditorInput;
import org.eclipse.team.internal.ccvs.ui.CVSResourceNode;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.internal.ccvs.ui.ResourceEditionNode;
@@ -62,35 +63,7 @@ public class CompareWithTagAction extends TeamAction {
if (tag[0] == null) return;
-
- for (int i = 0; i < resources.length; i++) {
- // Show a progress dialog while fethcing the remote tree
- final IResource resource = resources[i];
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- try {
- monitor.beginTask(Policy.bind("CompareWithTagAction.fetching", tag[0].getName()), 100); //$NON-NLS-1$
- remoteResource[0] = CVSWorkspaceRoot.getRemoteTree(resource, tag[0], Policy.subMonitorFor(monitor, 100));
- monitor.done();
- } catch (TeamException e) {
- throw new InvocationTargetException(e);
- }
- }
- }, Policy.bind("CompareWithTagAction.compare"), PROGRESS_DIALOG); //$NON-NLS-1$
-
- // Just to be safe...
- if (remoteResource[0] == null) {
- MessageDialog.openInformation(getShell(), Policy.bind("CompareWithTagAction.noRemote"), Policy.bind("CompareWithTagAction.noRemoteLong")); //$NON-NLS-1$ //$NON-NLS-2$
- return;
- }
-
- // Show a busy cursor while opening the compare view
- run(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
- CompareUI.openCompareEditor(new CVSCompareEditorInput(new CVSResourceNode(resource), new ResourceEditionNode(remoteResource[0])));
- }
- }, Policy.bind("CompareWithTagAction.compare"), PROGRESS_BUSYCURSOR); //$NON-NLS-1$
- }
+ CompareUI.openCompareEditor(new CVSLocalCompareEditorInput(resources, tag[0]));
}
protected boolean isEnabled() {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java
index 4e1f38051..b1cb7868f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/sync/CVSSyncCompareInput.java
@@ -71,13 +71,13 @@ public class CVSSyncCompareInput extends SyncCompareInput {
} else file = null;
// avoid redundant updates -- identity test is good enough here
- if (file == previousTeamFile) return;
- previousTeamFile = file;
- getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- updateToolTip(tree, file);
- }
- });
+// if (file == previousTeamFile || file == null) return;
+// previousTeamFile = file;
+// getShell().getDisplay().asyncExec(new Runnable() {
+// public void run() {
+// updateToolTip(tree, file);
+// }
+// });
}
});
return catchupReleaseViewer;

Back to the top