diff options
author | Michael Valenta | 2004-05-10 01:30:25 +0000 |
---|---|---|
committer | Michael Valenta | 2004-05-10 01:30:25 +0000 |
commit | cbfb7de828dc3228524e7ae0d40456240824d2c6 (patch) | |
tree | 40e284e143a4965ddc5ed573c4721bcb7137d48c | |
parent | 561c41e37207d7d9f3891643fc98e0c837c3c59e (diff) | |
download | eclipse.platform.team-cbfb7de828dc3228524e7ae0d40456240824d2c6.tar.gz eclipse.platform.team-cbfb7de828dc3228524e7ae0d40456240824d2c6.tar.xz eclipse.platform.team-cbfb7de828dc3228524e7ae0d40456240824d2c6.zip |
Prime compare remote tree to avoid all outgoing
-rw-r--r-- | bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java index 9df040b87..3f3b26460 100644 --- a/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java +++ b/bundles/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCompareSubscriber.java @@ -18,6 +18,7 @@ import org.eclipse.team.core.TeamException; import org.eclipse.team.core.subscribers.*; import org.eclipse.team.core.variants.IResourceVariantTree; import org.eclipse.team.core.variants.SessionResourceVariantByteStore; +import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; import org.eclipse.team.internal.ccvs.core.syncinfo.CVSResourceVariantTree; import org.eclipse.team.internal.ccvs.core.syncinfo.MultiTagResourceVariantTree; @@ -218,4 +219,35 @@ public class CVSCompareSubscriber extends CVSSyncTreeSubscriber implements ISubs if (tag1 == null || tag2 == null) return false; return tag1.equals(tag2) && rootsEqual(s); } + + /** + * Prime the remote tree with the sync info from the local workspace. + * This is done to ensure that we don't get a huge nimber of outgoing + * changes before the first refresh. + * + */ + public void primeRemoteTree() throws CVSException { + for (int i = 0; i < resources.length; i++) { + IResource resource = resources[i]; + ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resource); + cvsResource.accept(new ICVSResourceVisitor() { + public void visitFile(ICVSFile file) throws CVSException { + byte[] bytes = file.getSyncBytes(); + if (bytes != null) { + try { + tree.getByteStore().setBytes(file.getIResource(), bytes); + } catch (TeamException e) { + throw CVSException.wrapException(e); + } + } + } + public void visitFolder(ICVSFolder folder) throws CVSException { + // No need to copy sync info for folders since + // CVS resource variant tree will get missing + // folder info from the local resources + folder.acceptChildren(this); + } + }); + } + } } |