Bug 205882 - [CVS UI] Renaming a file in a branch causes deletion of the file in other branches
Summary: [CVS UI] Renaming a file in a branch causes deletion of the file in other bra...
Status: RESOLVED INVALID
Alias: None
Product: Platform
Classification: Eclipse Project
Component: CVS (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 3.4.1   Edit
Assignee: Pawel Pogorzelski CLA
QA Contact:
URL:
Whiteboard:
Keywords: investigate
Depends on:
Blocks:
 
Reported: 2007-10-09 19:19 EDT by Barys Dubauski CLA
Modified: 2008-08-20 05:36 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Barys Dubauski CLA 2007-10-09 19:19:40 EDT
Build ID: I20070517-1700

Steps To Reproduce:
1. add file a.txt to a project
2. share the project in CVS 
3. create new CVS branch of the project: "branchX"
4. create another CVS branch of the project: "branchY"
5. switch to branchX
6. rename file a.txt to b.txt
7. commit the change
8. switch to branchY 
PROBLEM: a.txt is gone.


More information:
Comment 1 Tomasz Zarna CLA 2007-10-10 05:22:03 EDT
I'm not able to reproduce that following the steps you provided. Have you tried selecting the project, clicking "Replace with> Another branch or version" and then selecting the "branchY" branch? It does work for me - b.txt from branchX is gone but the a.txt reappears.
Comment 2 Szymon Brandys CLA 2007-10-11 04:07:02 EDT
I was trying to reproduce the problem using N20071010-0010 and 3.3. In both cases I couldn't reproduce it. 

Can you see the issue using 3.3?
Comment 3 Barys Dubauski CLA 2007-10-11 16:25:55 EDT
Yes, I can reproduce the problem using:

Version: 3.3.0
Build id: I20070517-1700.

Comment 4 Barys Dubauski CLA 2007-10-11 16:31:30 EDT
To clarify steps further:

Steps To Reproduce:
1. add file a.txt to a project P1.
2. share the project in CVS 
3. create new CVS branch of the project: "branchX". Branching is done from project's HEAD.
4. create another CVS branch of the project: "branchY". Branching is done from project's HEAD.
5. switch to branchX (right click on project P1 and select "Team | Switch to Another Branch or Version...")
6. rename file a.txt to b.txt
7. commit the change
8. switch to branchY (right click on project P1 and select "Team | Switch to Another Branch or Version...")
PROBLEM: a.txt is gone from project P1. I.e. both Project Explorer and Navigator views don't show a.txt file.
Comment 5 Tomasz Zarna CLA 2007-10-12 04:31:39 EDT
What version of CVS server are you using? Can you see anything odd in the Error log? If not, please turn the "Display detailed protocol output to stdout"[1] option to on and then check the Console view.

[1] Team > CVS > General tab > Display detailed protocol output to stdout (for debugging)
Comment 6 Barys Dubauski CLA 2007-10-12 15:12:35 EDT
Log for step #7:

***
cvs add -kkv "/bug205882/b.txt"
    cvs add: file `b.txt' will be added on branch `branchX' from version 1.1.2.2
    cvs add: use 'cvs commit' to add this file permanently
ok (took 0:00.266)
Error: The following warnings were reported while performing the "cvs add" command.
   Error: bug205882: cvs add: file `b.txt' will be added on branch `branchX' from version 1.1.2.2
***

***
cvs ci -m "10112007 verify bugzilla 205882" -l "/bug205882/b.txt"
    Checking in b.txt;
    /cvsroot/centaur/dubauski/defects_temp/bug205882/Attic/b.txt,v  <--  b.txt
    new revision: 1.1.2.3; previous revision: 1.1.2.2
    done
    Mailing centaur-commits@cs.opensource.ibm.com...
    Generating notification message...
    Generating notification message... done.
ok (took 0:03.562)
***



Log for step #8:

***
cvs update -r "branchY" -d -P "/bug205882"
    cvs update: Updating .
    R a.txt
    cvs update: b.txt is no longer in the repository
ok (took 0:00.453)
***
Comment 7 Barys Dubauski CLA 2007-10-12 18:10:50 EDT
Regarding to CVS server version question. How do I get this information?
Comment 8 Barys Dubauski CLA 2007-10-12 18:13:21 EDT
On the other hand the CVS server I'm using is: cvs.cs.opensource.ibm.com. 
Comment 9 Michael Valenta CLA 2008-04-11 15:35:44 EDT
This looks related to bug 121433 and bug 80514. Tomek, if you are able to reproduce this problem using the provided steps, it may indicate that there is a problem in the underlying CVS operation. If you are able to reproduce it, you should probably trace the responses received from the server to see if that is the source of the problem (i.e. the responses from the switch operation).
Comment 10 Tomasz Zarna CLA 2008-06-04 10:30:09 EDT
I will have a second look at it during 3.4.1.
Comment 11 Tomasz Zarna CLA 2008-07-24 09:14:27 EDT
Pawel, could you give me a helping hand here?
Comment 12 Pawel Pogorzelski CLA 2008-08-01 09:19:25 EDT
Build id: I20080724-1200

I managed to reproduce the problem with the steps provided by Barys in the first comment. 

It's a bit tricky since you have to commit a change by clicking on the renamed file. If you do so only b.txt gets uploaded into the repository and a.txt is not removed:

cvs ci -m "Renaming a.txt to b.txt" -l "/205882/src/b.txt"
    RCS file: /TEST/205882/src/b.txt,v
    done
    Checking in src/b.txt;
    /TEST/205882/src/b.txt,v  <--  b.txt
    new revision: 1.1.2.1; previous revision: 1.1
    done
ok (took 0:00.125)

Compare it with the following output if you commit by clicking on a parent directory or the whole project:

cvs ci -m "Renaming a.txt to b.txt" -l "/205882/src/a.txt" "/205882/src/b.txt"
    Removing src/a.txt;
    /TEST/205882/src/a.txt,v  <--  a.txt
    new revision: delete; previous revision: 1.1.2
    done
    RCS file: /TEST/205882/src/b.txt,v
    done
    Checking in src/b.txt;
    /TEST/205882/src/b.txt,v  <--  b.txt
    new revision: 1.1.2.1; previous revision: 1.1
    done
ok (took 0:00.171)

IMO committing the change on a file should remove the old one from CVS and add the new one.
Comment 13 Pawel Pogorzelski CLA 2008-08-04 10:51:15 EDT
I spent some time investigating the problem and it seems like the „missing files” behavior might be a proper one. This is because the nature of the command, it differs from “Replace with Another Branch or Version” in that uncommitted changes are not replaced but moved to the resources from selected tag. And this gives surprising results some time, like missing files or files appearing from nowhere (when an uncommitted change applies to a file that is not present in a branch you want to switch to).

In case of file renaming it would be possible (don't know if feasible) to commit both removal of the old file and addition of the new one in the same CVS operation. IMO this has some sense since that’s probably what you want to do when committing a renamed file. But in general those situations are impossible to avoid without redefinition of the “Switch to…” operation.

Guys, what do you think about this?
Comment 14 Tomasz Zarna CLA 2008-08-08 03:26:08 EDT
Barys, can you confirm that using the "Replace with Another Branch" operation works as expected in your case?
Comment 15 Barys Dubauski CLA 2008-08-08 15:16:09 EDT
Replace with another branch works fine.
Comment 16 Pawel Pogorzelski CLA 2008-08-12 06:15:22 EDT
Barys, I checked the behavior of the "Switch to..." command in WinCVS and it works exactly in the same way. So I think the current behavior is OK.
 
However if this might be confusing to some CVS users, maybe a dialog with a message should be shown. Barys, what do you think about it? Or should the bug simply be closed?
Comment 17 Barys Dubauski CLA 2008-08-12 13:45:42 EDT
"Barys, I checked the behavior of the "Switch to..." command in WinCVS and it&#13;&#10;works exactly in the same way. So I think the current behavior is OK."&#13;&#10;:&#13;&#10; Pawel, I'm not following you here. "Switch to ..." and "Replace with..." used to be different (at least when I actively used them over a year ago).&#13;&#10;&#13;&#10; If you are seeing consistent correct behavior for both operations then close the defect,&#13;&#10;&#13;&#10; Otherwise for any "confusing" behavior showing a warning dialog will be very useful to avoid panic from user who may think that he just lost his sources.&#13;&#10;&#13;&#10;Thank you,&#13;&#10;Barys
Comment 18 Tomasz Zarna CLA 2008-08-14 10:25:56 EDT
(In reply to comment #17)
> "Barys, I checked the behavior of the "Switch to..." command in WinCVS and
> it&#13;&#10;works exactly in the same way. So I think the current behavior is
> OK."&#13;&#10;:&#13;&#10; Pawel, I'm not following you here. "Switch to ..." and
> "Replace with..." used to be different (at least when I actively used them over
> a year ago).

I think, what Pawel meant to say was that the result of "Switch to..." command in Eclipse is exactly the same as the result of the same operation called in WinCVS (for the same input). The "Switch to..." and "Replace with..." commands from Eclipse are different (ie give different results in some cases).
Comment 19 Szymon Brandys CLA 2008-08-20 05:26:38 EDT
Pawel is right that "Switch to.." works as expected. See "Workbench User Guide > Tasks > Working in the team environment with CVS".

Team > Switch to Another Branch or Version - this update will replace Workbench resources with those on the tag specified in the Update dialog. The behavior differs from the above replace operations in that uncommitted modifications in the Workbench are not replaced but instead are "moved" to the resources from the selected tag. 

So the fact that a.txt is gone (the steps from comment 0) should not be confusing for users. I would close this as INVALID.

Comment 20 Pawel Pogorzelski CLA 2008-08-20 05:36:27 EDT
Barys, I'm closing the bug with resolution INVALID. Initially I thought about providing a message box to avoid confusion. However I dropped the idea since it would bring an additional dialog with purpose to warn about the plain operation of the “Switch to…” command.