Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 23386 Details for
Bug 87202
(PatchAttached)[Watch/Edit] automatic 'editors' check doesn't check for updated versions.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
cvs core project patch (3.1 RC2 sources)
cvs-core.patch (text/plain), 13.96 KB, created by
Rob Hughes
on 2005-06-16 17:10:30 EDT
(
hide
)
Description:
cvs core project patch (3.1 RC2 sources)
Filename:
MIME Type:
Creator:
Rob Hughes
Created:
2005-06-16 17:10:30 EDT
Size:
13.96 KB
patch
obsolete
>Index: src/org/eclipse/team/internal/ccvs/core/CVSCoreFileModificationValidator.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSCoreFileModificationValidator.java,v >retrieving revision 1.4 >diff -u -r1.4 CVSCoreFileModificationValidator.java >--- src/org/eclipse/team/internal/ccvs/core/CVSCoreFileModificationValidator.java 7 Apr 2005 15:37:15 -0000 1.4 >+++ src/org/eclipse/team/internal/ccvs/core/CVSCoreFileModificationValidator.java 13 Jun 2005 18:43:50 -0000 >@@ -120,6 +120,10 @@ > protected void performEdit(IFile[] files, IProgressMonitor monitor) throws CVSException { > getProvider(files).edit(files, false /* recurse */, true /* notify server */, true /* notify for writtable files */, ICVSFile.NO_NOTIFICATION, monitor); > } >+ >+ protected void performUpdate(IFile[] files, IProgressMonitor monitor) throws CVSException { >+ getProvider(files).update(files, monitor); >+ } > > private boolean needsCheckout(IFile file) { > try { >@@ -134,6 +138,16 @@ > } > return false; > } >+ >+ protected boolean needsUpdate(IFile file, IProgressMonitor monitor) { >+ try { >+ return getProvider(new IFile[]{file}).needsUpdate(file, monitor); >+ } catch (CVSException e) { >+ // Log the exception and assume we don't need to update it >+ CVSProviderPlugin.log(e); >+ } >+ return false; >+ } > > protected IStatus setWritable(final IFile[] files) { > for (int i = 0; i < files.length; i++) { >Index: src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java,v >retrieving revision 1.169 >diff -u -r1.169 CVSTeamProvider.java >--- src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java 7 Apr 2005 15:37:15 -0000 1.169 >+++ src/org/eclipse/team/internal/ccvs/core/CVSTeamProvider.java 13 Jun 2005 18:43:52 -0000 >@@ -30,8 +30,6 @@ > import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; > import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer; > import org.eclipse.team.internal.ccvs.core.syncinfo.*; >-import org.eclipse.team.internal.ccvs.core.syncinfo.FolderSyncInfo; >-import org.eclipse.team.internal.ccvs.core.syncinfo.ResourceSyncInfo; > import org.eclipse.team.internal.ccvs.core.util.*; > import org.eclipse.team.internal.core.streams.CRLFtoLFInputStream; > import org.eclipse.team.internal.core.streams.LFtoCRLFInputStream; >@@ -996,4 +994,126 @@ > public IResourceRuleFactory getRuleFactory() { > return RESOURCE_RULE_FACTORY; > } >+ >+ /** >+ * Determine if this file needs updated by calling the <code>cvs status</code> command. >+ * >+ * @author <a href="mailto:gregor.kohlwes@csc.com,kohlwes@gmx.net">Gregor Kohlwes</a> >+ * @param resources >+ * @param progress >+ * @return IEditorsInfo[] >+ * @throws CVSException >+ */ >+ public boolean needsUpdate( >+ IFile resource, >+ IProgressMonitor progress) >+ throws CVSException { >+ >+ // Build the local options >+ LocalOption[] commandOptions = new LocalOption[] { Command.DO_NOT_RECURSE }; >+ progress.worked(10); >+ // Build the arguments list >+ String[] arguments = getValidArguments(new IResource[]{resource}, commandOptions); >+ >+ // Build the listener for the command >+ final String[] revision = new String[1]; >+ IStatusListener listener = new IStatusListener(){ >+ public void fileStatus(ICVSFolder commandRoot, String path, String remoteRevision) { >+ revision[0] = remoteRevision; >+ } >+ }; >+ >+ // Check if canceled >+ if (progress.isCanceled()) { >+ return false; >+ } >+ // Build the session >+ Session session = >+ new Session( >+ workspaceRoot.getRemoteLocation(), >+ workspaceRoot.getLocalRoot()); >+ >+ // Check if canceled >+ if (progress.isCanceled()) { >+ return false; >+ } >+ progress.beginTask(null, 100); >+ try { >+ // Opening the session takes 20% of the time >+ session.open(Policy.subMonitorFor(progress, 20), false /* read-only */); >+ >+ if (!progress.isCanceled()) { >+ // Execute the editors command >+ Command.UP_TO_DATE.execute( >+ session, >+ Command.NO_GLOBAL_OPTIONS, >+ commandOptions, >+ arguments, >+ new StatusListener(listener), >+ Policy.subMonitorFor(progress, 80)); >+ } >+ } finally { >+ session.close(); >+ progress.done(); >+ } >+ // Return whether this file needs updated >+ ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor(resource); >+ return !cvsFile.getSyncInfo().getRevision().equals(revision[0]); >+ } >+ >+ /** >+ * Update the resources by calling the <code>cvs update</code> command. >+ * >+ * @author <a href="mailto:gregor.kohlwes@csc.com,kohlwes@gmx.net">Gregor Kohlwes</a> >+ * @param resources >+ * @param progress >+ * @return IEditorsInfo[] >+ * @throws CVSException >+ */ >+ public void update( >+ IResource[] resources, >+ IProgressMonitor progress) >+ throws CVSException { >+ >+ // Build the local options >+ LocalOption[] commandOptions = new LocalOption[] { Command.DO_NOT_RECURSE }; >+ progress.worked(10); >+ // Build the arguments list >+ String[] arguments = getValidArguments(resources, commandOptions); >+ >+ // Check if canceled >+ if (progress.isCanceled()) { >+ return; >+ } >+ // Build the session >+ Session session = >+ new Session( >+ workspaceRoot.getRemoteLocation(), >+ workspaceRoot.getLocalRoot()); >+ >+ // Check if canceled >+ if (progress.isCanceled()) { >+ return; >+ } >+ progress.beginTask(null, 100); >+ try { >+ // Opening the session takes 20% of the time >+ session.open(Policy.subMonitorFor(progress, 20), false /* read-only */); >+ >+ if (!progress.isCanceled()) { >+ // Execute the update command locking on the first resource >+ Command.UPDATE.execute( >+ session, >+ resources[0], >+ Command.NO_GLOBAL_OPTIONS, >+ commandOptions, >+ arguments, >+ null, >+ Policy.subMonitorFor(progress, 80)); >+ } >+ } finally { >+ session.close(); >+ progress.done(); >+ } >+ } > } >Index: src/org/eclipse/team/internal/ccvs/core/client/Command.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.team.cvs.core/src/org/eclipse/team/internal/ccvs/core/client/Command.java,v >retrieving revision 1.68 >diff -u -r1.68 Command.java >--- src/org/eclipse/team/internal/ccvs/core/client/Command.java 28 Apr 2005 13:22:06 -0000 1.68 >+++ src/org/eclipse/team/internal/ccvs/core/client/Command.java 13 Jun 2005 18:43:52 -0000 >@@ -14,10 +14,14 @@ > > import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IResource; >+import org.eclipse.core.resources.IWorkspaceRunnable; >+import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.*; >+import org.eclipse.core.runtime.jobs.ISchedulingRule; > import org.eclipse.osgi.util.NLS; > import org.eclipse.team.internal.ccvs.core.*; > import org.eclipse.team.internal.ccvs.core.client.listeners.ICommandOutputListener; >+import org.eclipse.team.internal.ccvs.core.resources.EclipseSynchronizer; > > /** > * Abstract base class for command requests. >@@ -37,6 +41,7 @@ > public final static Log LOG = new Log(); > public final static Remove REMOVE = new Remove(); > public final static Status STATUS = new Status(); >+ public final static Status UP_TO_DATE = new StatusUpdateCheck(); > public final static Tag TAG = new Tag(); > // The CUSTOM_TAG command has special handling for added and removed resources. > // This behavior supports branching with local changes in the workspace >@@ -339,6 +344,92 @@ > return status[0]; > } > >+ /** >+ * Executes a CVS command. >+ * <p> >+ * Dispatches the commands, retrieves the results, and determines whether or >+ * not an error occurred. A listener may be supplied to capture message text >+ * that would normally be written to the standard error and standard output >+ * streams of a command line CVS client. >+ * </p> >+ * @param session the open CVS session >+ * @param schedulingRule the scheduling rule to use when executing this command >+ * @param globalOptions the array of global options, or NO_GLOBAL_OPTIONS >+ * @param localOptions the array of local options, or NO_LOCAL_OPTIONS >+ * @param arguments the array of arguments (usually filenames relative to localRoot), or NO_ARGUMENTS >+ * @param listener the command output listener, or null to discard all messages >+ * @param monitor the progress monitor >+ * @return a status code indicating success or failure of the operation >+ * @throws CVSException if a fatal error occurs (e.g. connection timeout) >+ */ >+ public final IStatus execute(final Session session, ISchedulingRule schedulingRule, final GlobalOption[] globalOptions, >+ final LocalOption[] localOptions, final String[] arguments, final ICommandOutputListener listener, >+ IProgressMonitor pm) throws CVSException { >+ final IStatus[] status = new IStatus[1]; >+ ICVSRunnable job = new ICVSRunnable() { >+ public void run(IProgressMonitor monitor) throws CVSException { >+ // update the global and local options >+ GlobalOption[] gOptions = filterGlobalOptions(session, globalOptions); >+ LocalOption[] lOptions = filterLocalOptions(session, gOptions, localOptions); >+ >+ // print the invocation string to the console >+ if (session.isOutputToConsole() || Policy.isDebugProtocol()) { >+ IPath commandRootPath; >+ IResource resource = session.getLocalRoot().getIResource(); >+ if (resource == null) { >+ commandRootPath = Path.EMPTY; >+ } else { >+ commandRootPath = resource.getFullPath(); >+ } >+ String line = constructCommandInvocationString(commandRootPath, gOptions, lOptions, arguments); >+ ConsoleListeners.getInstance().commandInvoked(session, line); >+ if (Policy.isDebugProtocol()) Policy.printProtocolLine("CMD> " + line); //$NON-NLS-1$ >+ } >+ >+ // run the command >+ try { >+ session.setCurrentCommand(Command.this); >+ status[0] = doExecute(session, gOptions, lOptions, arguments, listener, monitor); >+ notifyConsoleOnCompletion(session, status[0], null); >+ } catch (CVSException e) { >+ notifyConsoleOnCompletion(session, null, e); >+ throw e; >+ } catch (RuntimeException e) { >+ notifyConsoleOnCompletion(session, null, e); >+ throw e; >+ } >+ } >+ }; >+ if (isWorkspaceModification()) { >+ run(schedulingRule, job, pm); >+ } else { >+ job.run(pm); >+ } >+ return status[0]; >+ } >+ >+ public void run(final ISchedulingRule schedulingRule, final ICVSRunnable job, IProgressMonitor monitor) throws CVSException { >+ final CVSException[] error = new CVSException[1]; >+ try { >+ // Do not use a scheduling rule in the workspace run since one >+ // will be obtained by the EclipseSynchronizer >+ ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() { >+ public void run(IProgressMonitor monitor) throws CoreException { >+ try { >+ EclipseSynchronizer.getInstance().run(schedulingRule, job, monitor); >+ } catch(CVSException e) { >+ error[0] = e; >+ } >+ } >+ }, null /* no rule */, 0, monitor); >+ } catch(CoreException e) { >+ throw CVSException.wrapException(e); >+ } >+ if(error[0]!=null) { >+ throw error[0]; >+ } >+ } >+ > /** > * Return whether this command modifies the workspace. > * If <code>true</code> is returned, a scheduling rule on >Index: src/org/eclipse/team/internal/ccvs/core/client/StatusUpdateCheck.java >=================================================================== >RCS file: src/org/eclipse/team/internal/ccvs/core/client/StatusUpdateCheck.java >diff -N src/org/eclipse/team/internal/ccvs/core/client/StatusUpdateCheck.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/team/internal/ccvs/core/client/StatusUpdateCheck.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,22 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2003 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.team.internal.ccvs.core.client; >+ >+ >+public class StatusUpdateCheck extends Status { >+ /*** Local options: specific to status ***/ >+ >+ protected StatusUpdateCheck() { } >+ >+ protected boolean isWorkspaceModification() { >+ return false; >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 87202
: 23386 |
23387