Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367891 - Replace With on package uses file system hierarchy instead of operating on package
Summary: Replace With on package uses file system hierarchy instead of operating on pa...
Status: NEW
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: 1.3   Edit
Hardware: PC Windows 7
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-04 15:33 EST by Jeremy Mack CLA
Modified: 2013-05-26 17:53 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 Jeremy Mack CLA 2012-01-04 15:33:30 EST
Build Identifier: 3.7.1

From within the Package Explorer.

Using the context menu Replace With command on a package within a plugin causes all files within the _file system folder_ for that package to be replaced. This means that it is possible to lose data on packages not selected by the Replace With command.

I've had a few users already lose data from this bug.

This errors occurs on 1.1.0 and 1.3.0.201201041014 of EGit.

Reproducible: Always

Steps to Reproduce:
1. Clone http://egit.eclipse.org/egit-training.git
2. Make a change to org.eclipse.example.calc.internal.operations/AbstractOperation.java
3. Open the Project Explorer to src -> org.eclipse.example.calc
4. Right click on org.eclipse.example.calc
5. Select Replace With -> Head Revision
6. Click OK to the dialog box
7. The changes in AbstractOperation.java will be lost even though they do not fall under the hierarchy of org.eclipse.example.calc
Comment 1 Remy Suen CLA 2012-01-20 14:30:33 EST
(In reply to comment #0)
> 2. Make a change to
> org.eclipse.example.calc.internal.operations/AbstractOperation.java
> 3. Open the Project Explorer to src -> org.eclipse.example.calc
> 4. Right click on org.eclipse.example.calc
> 5. Select Replace With -> Head Revision
> 6. Click OK to the dialog box
> 7. The changes in AbstractOperation.java will be lost even though they do not
> fall under the hierarchy of org.eclipse.example.calc

AbstractOperation, at a filesystem level, is nested within the org.eclipse.example.calc folder. When you ask that folder to have its contents replaced, then your AbstractOperation will also be replaced. The "hierarchy" shown in the view is merely a visual representation. If you changed the setting to not show packages as being "flat" then they would be nested like subfolders.
Comment 2 Robin Rosenberg CLA 2013-05-26 17:53:20 EDT
What's the API to use for getting the information about packages, considering the EGit is project-type agnostic? 

We need to be able to iterate both the file system (which I guess is the easy part), but also index and a tree according to the same rules.