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 206646 - Svn diff: impossible to get out of diff without save.
Summary: Svn diff: impossible to get out of diff without save.
Status: REOPENED
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.0.1
Hardware: PC Linux
: P2 normal (vote)
Assignee: Ondrej Vrabec
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-22 17:04 UTC by nb_johan1
Modified: 2014-06-05 12:20 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nb_johan1 2011-12-22 17:04:57 UTC
I rightclick on a file -> Subversion -> Diff

I edit the file in the diff view.

Now I want to leave the view and discard the changes, without saving.
I click on the [x] but the dialog I get is:

- Save          (Saves)
- Save All      (Saves)
- Keep Modified (Saves)
- Cancel        (Does not discard)

So there is no way to close the diff view without saving.

NOTE: This happens when the file is open ONLY in the diff view (Should not be opened in the editor at the same time).
Comment 1 Ondrej Vrabec 2011-12-22 21:27:45 UTC
Can't reproduce.
> - Keep Modified (Saves)
No the changes are not saved. Open the file in an external editor and you'll see the changes are not there. Also when you reopen the file in editor in NetBeans, its name in the editor is bold - meaning the changes are not yet saved to disk.
Please check again, reopen if the changes are indeed saved on disk.
Comment 2 nb_johan1 2011-12-23 08:26:47 UTC
I figured out when this happens.
If you perform the diff twice.
- The first time you click on Keep all modified.
- The second time you diff it saves without asking you.

So you have a save that you din't even request.


Consider the following:
1. You diff 100 files, which have uncommited changes.
2. You perform new changes to them.
3. Now you want to discard all the new changes.

Lets say you click on Keep all Modified (because there is no Discard button).

Then you diff again the 100 files. They are automatically saved.
!!HUGE DATA LOSS!!

P.S (1)
Even if the bug would not exist, it is a very dangerous feature to have modified files that are not opened in the editor.

P.S. (2)
I believe apart from fixing this bug, you should also add a discard button. There should be always a safe "Understandable" exit point on every editor.
"Keep all Modified" has an unclean meaning. It could mean "Keep all the modified files". (Keep can be intercepted as "Save" by a user).
Comment 3 Ondrej Vrabec 2011-12-23 08:51:23 UTC
> Then you diff again the 100 files. They are automatically saved.
Yes, true. We were thinking about saving just opened files before any versioning action.
> !!HUGE DATA LOSS!!
ok please. If you do changes in 100 than you can also use the Undo action 100 times.

> Even if the bug would not exist, it is a very dangerous feature to have
modified files that are not opened in the editor.
Sure, that's why the warning is displayed and you're notified about it.

> I believe apart from fixing this bug, you should also add a discard button. There should be always a safe "Understandable" exit point on every editor. "Keep all Modified" has an unclean meaning. It could mean "Keep all the modified files". (Keep can be intercepted as "Save" by a user).
I agree, there should be a discard button. But there's no API for that AFAIK. But i agree we should make it possible.
Comment 4 nb_johan1 2011-12-23 09:33:04 UTC
>> !!HUGE DATA LOSS!!
>ok please. If you do changes in 100 than you can also use the Undo action 100
>times.
What if I close Netbeans expecting that it will throw a dialogue about discarding the changes, but this never appears, because it auto-saved. 
Where is my undo then?

I think its definately a DEFECT.
Comment 5 Ondrej Vrabec 2011-12-23 10:18:35 UTC
> What if I close Netbeans expecting that it will throw a dialogue about
> discarding the changes, but this never appears, because it auto-saved. 
> Where is my undo then?
If you close the IDE right after the diff view was closed, then you're asked if you want to save or not (because the changes were not yet been saved to disk).
If you're talking about closing the IDE after the second invocation if the diff (which actually saves the files) then it's a different issue (look at the summary of this one). If you think we should not save modified files upon Subversion -> Diff action, file a separate issue.
Comment 6 nb_johan1 2011-12-23 12:06:19 UTC
> If you're talking about closing the IDE after the second invocation if the diff
> (which actually saves the files) then it's a different issue (look at the
> summary of this one)


Ok I will not file a new issue.
I will leave it to netbeans team, to decide if they need to file a P1(defect) or any other issue based on my report.