This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 162868 - Changes done in the diff windows are saved without confirmation dialog
Summary: Changes done in the diff windows are saved without confirmation dialog
Status: RESOLVED FIXED
Alias: None
Product: utilities
Classification: Unclassified
Component: Diff (show other bugs)
Version: 6.x
Hardware: All Linux
: P3 blocker with 1 vote (vote)
Assignee: Marian Petras
URL:
Keywords: UI
Depends on:
Blocks:
 
Reported: 2009-04-16 17:50 UTC by jdavi
Modified: 2009-12-04 07:20 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
patch for Subversion, Mercurial, CVS, ClearCase (57.68 KB, patch)
2009-09-25 10:35 UTC, Marian Petras
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jdavi 2009-04-16 17:50:28 UTC
If you diff a file, change anything in the "local copy" pane  and close the diff window 

The file is SAVED  WITHOUT any type of warning or confirmation dialog.

That is not the behavior of the normal windows, if you close an edit window with unsaved code you get a confirmation
dialog. I would expect the same behavior in the diff window to protect against accidental code changes.
Comment 1 tdwinnell 2009-07-28 16:47:23 UTC
Also, to make things worse, I can't seem to find an 'undo' either.   So if you accidentally merge one change to 
another file, it is automatically saved no matter what you do.
Comment 2 jdavi 2009-08-26 15:10:51 UTC
It really bothers me that after 4 months this issue is still "new".

Is it only happening to me or can anyone confirm it? 

Luckily there is the local history because I garbaged lots of files accidentally and only noticed it time after...

Should it have a higher priority?

Cheers 
Comment 3 Ondrej Vrabec 2009-08-26 17:13:52 UTC
It's not just you. It happens to everyone, but the feature has been here for more than two years (issue #76681) and no
one seems to be unhappy with that. 
BTW, undo is not enough? Or is undo feature not allowed in your case? I tried with a java file and even after closing
the diff i could still undo the changes when i opened the file.
Comment 4 jdavi 2009-09-03 01:34:19 UTC
Sorry for not been able to explain myself,
I don't have any problem with the feature #76681 (I think it is a good thing) the problem is that, from my point of
view, there is an inconsistence in its implementation.

In ANY  edit window, if your try to close it after you did some changes, it will warn you and ask what you want to do
(save the changes, discard them or keep editing)

On the contrary, If you change a "diff window" (especially by mistake, e.g. pasting in the wrong position or clicking on
one of the "transfer" arrows) those changes are AUTOMATICALLY saved to the local file when you close the window.

That is not only different from the other windows in netbeans but from any other "diff" software that I used previously,
that will prompt the usual confirmation dialog.

Will be it possible to add a confirmation dialog when you close a changed "diff window"?

PS: No, undo is not enough because it happened to me that I DIDN'T KNOW that the file was changed and that you needed to
"undo" those changes until a few days latter when you try to figure out why some code doesn't work like before
Comment 5 Ondrej Vrabec 2009-09-03 07:50:34 UTC
> Will be it possible to add a confirmation dialog when you close a changed "diff window"?
I think it will.
Comment 6 Marian Petras 2009-09-25 10:35:31 UTC
Created attachment 88339 [details]
patch for Subversion, Mercurial, CVS, ClearCase
Comment 7 Marian Petras 2009-09-25 10:40:53 UTC
I attached a patch for modules Subversion, Mercurial, CVS and ClearCase.

The implemented solution needs to be discussed some more (next week) and I will not work on it until we agree on a
definite solution.

Even if the current solution (implemented by the patch) is accepted, the patch needs some more work, for example extract
common code and put it to module versioning.util to make it shared.
Comment 8 Marian Petras 2009-12-04 07:20:43 UTC
Fixed.

The UI changes are completely different from those defined by the attached patch.

Names of modified files are now rendered bold in the table.
The user is not notified about the need to save files until they start the commit procedure or until they close the diff window.

If the user is about to commit the modified files, they are asked whether to save unsaved files. All unsaved files from the diff window are listed in the save-dialogue.

If the user is about to close the diff window, they are asked whether to save modified files. Files that are opened both in the diff window and in an editor are excluded from the save-dialogue.

This change was made for modules Subversion, Mercurial, CVS and Clearcase.

Changeset:
cdev #6e0249dfbe6e