Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 26712 - [CVS Watch/Edit] Watch/Edit and "cvs added" resources
Summary: [CVS Watch/Edit] Watch/Edit and "cvs added" resources
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Team (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Target Milestone: 3.1 M6   Edit
Assignee: Platform-VCM-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 36470 63644 82960 83752 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-11-19 16:10 EST by Michael Valenta CLA
Modified: 2005-03-14 09:48 EST (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Valenta CLA 2002-11-19 16:10:41 EST
When watch/edit is being used, files are checked out read-only. A file must 
be "cvs edited" before it can be modified. Committing the resource then resets 
the file to read-only by the client (I should verify this using the command 
line). What happens for files that are added and then committed? The 
modification case can be detected by looking in the Baserev file. What is done 
(or can be done) for adds.
Comment 1 Richard Birenheide CLA 2003-08-21 12:16:29 EDT
When adding files in projects where watch/edit is enabled, the newly added 
files are not read only after the commit and thus there will no edit 
notification be sent to the server if the user continues to work with such a 
file. If you add files to CVS with watch/edit, then you have to open the 
project properties, uncheck 'enable watch edit', apply and recheck the 
property. Then all and committed files are read only. This should be an 
automatic behaviour on commit of added files.

Richard
Comment 2 Michael Valenta CLA 2004-05-24 21:36:49 EDT
*** Bug 63644 has been marked as a duplicate of this bug. ***
Comment 3 Michael Valenta CLA 2004-10-15 09:22:16 EDT
*** Bug 36470 has been marked as a duplicate of this bug. ***
Comment 4 Michael Valenta CLA 2005-01-17 10:24:14 EST
*** Bug 82960 has been marked as a duplicate of this bug. ***
Comment 5 Chris Nappin CLA 2005-01-17 10:36:36 EST
Hi,

  Are there any plans to fix this bug? It seems to have been around for a 
couple of years, and users are regularly asking for a fix (hence the 
duplicated bug reports). 

I'm currently trying to migrate a team of developers from proprietary tools 
and pessimistic locking to using Eclipse and CVS. Issues like this are an 
important stumbling block to this?

Thanks,

  Chris.
Comment 6 Michael Valenta CLA 2005-01-17 10:47:32 EST
There is currently no plan to fix this bug. If it is important to you, perhaps 
you should consider providing a patch.
Comment 7 Michael Valenta CLA 2005-01-26 15:20:08 EST
*** Bug 83752 has been marked as a duplicate of this bug. ***
Comment 8 Bruce CLA 2005-01-27 17:12:41 EST
What is the work around if it is not going to be fixed? 

Ask the user to toggle Watch/Edit twice? Ask the user to check out the folder 
again? Ask the user to set the file to read only with the OS? 
Comment 9 Michael Valenta CLA 2005-01-28 09:05:26 EST
You can manually make the file read-only on the file's properties page.
Comment 10 Bruce CLA 2005-01-28 09:25:58 EST
Works for me. Thanks. 
Comment 11 Bruce CLA 2005-03-14 08:28:12 EST
We are getting complaints from our users about this bug so we took some time to 
fix it last week. Here is a patch for 3.1. A patch for 3.0.1 is below the batch 
for 3.1. 

Index: CommitOperation.java
===================================================================
RCS 
file: /home/eclipse/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/u
i/operations/CommitOperation.java,v
retrieving revision 1.11
diff -u -r1.11 CommitOperation.java
--- CommitOperation.java	22 Feb 2005 19:46:33 -0000	1.11
+++ CommitOperation.java	14 Mar 2005 13:23:33 -0000
@@ -38,6 +38,20 @@
 	 * @see 
org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#executeComma
nd(org.eclipse.team.internal.ccvs.core.client.Session, 
org.eclipse.team.internal.ccvs.core.CVSTeamProvider, 
org.eclipse.team.internal.ccvs.core.ICVSResource[], 
org.eclipse.core.runtime.IProgressMonitor)
 	 */
 	protected IStatus executeCommand(Session session, CVSTeamProvider 
provider, ICVSResource[] resources, boolean recurse, IProgressMonitor monitor) 
throws CVSException, InterruptedException {
+		// if watch/edit is enabled, set files read only.
+		if (provider.isWatchEditEnabled()) {
+		    for (int i = 0; i < resources.length; i++) {
+                ICVSResource cvsResource = resources[i];
+                if (!cvsResource.isFolder()){//File handle
+                    IResource localResource=cvsResource.getIResource();
+                    if ((localResource.getType())==IResource.FILE){
+        			    if (!localResource.isReadOnly()){
+        			        localResource.setReadOnly(true);    	
						        
+        			    }                   
+                    }                    
+                }
+            }
+		}
 		return Command.COMMIT.execute(session,
 				Command.NO_GLOBAL_OPTIONS,
 				getLocalOptions(recurse),
Index: .project
===================================================================
RCS file: .project
diff -N .project
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ .project	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>operations</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+	</buildSpec>
+	<natures>
+	</natures>
+</projectDescription>


Here is a patch for 3.0.1. 

Index: CommitOperation.java
===================================================================
RCS 
file: /home/eclipse/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/u
i/operations/CommitOperation.java,v
retrieving revision 1.3
diff -u -r1.3 CommitOperation.java
--- CommitOperation.java	7 Jun 2004 03:05:02 -0000	1.3
+++ CommitOperation.java	14 Mar 2005 13:15:21 -0000
@@ -72,6 +72,20 @@
 	 * @see 
org.eclipse.team.internal.ccvs.ui.operations.SingleCommandOperation#executeComma
nd(org.eclipse.team.internal.ccvs.core.client.Session, 
org.eclipse.team.internal.ccvs.core.CVSTeamProvider, 
org.eclipse.team.internal.ccvs.core.ICVSResource[], 
org.eclipse.core.runtime.IProgressMonitor)
 	 */
 	protected IStatus executeCommand(Session session, CVSTeamProvider 
provider, ICVSResource[] resources, IProgressMonitor monitor) throws 
CVSException, InterruptedException {
+		// if watch/edit is enabled, set files read only.
+		if (provider.isWatchEditEnabled()) {
+		    for (int i = 0; i < resources.length; i++) {
+                ICVSResource cvsResource = resources[i];
+                if (!cvsResource.isFolder()){//File handle
+                    IResource localResource=cvsResource.getIResource();
+                    if ((localResource.getType())==IResource.FILE){
+        			    if (!localResource.isReadOnly()){
+        			        localResource.setReadOnly(true);    	
						        
+        			    }                   
+                    }                    
+                }
+            }
+		}
 		return Command.COMMIT.execute(session,
 				Command.NO_GLOBAL_OPTIONS,
 				getLocalOptions(),
Comment 12 Michael Valenta CLA 2005-03-14 09:48:10 EST
Thanks for the patch but it's really not the right way to do it. The proper 
place is the EclipseFile#checkedIn method since this is where it is done for 
the other cases.Since the nature of the change is much different from what you 
did, I have made the change in the proper place and released the change to 
HEAD. There is no plan to patch the 3.0 stream.