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 244993 - Revert Modifications on open modified/dirty document does not work.
Summary: Revert Modifications on open modified/dirty document does not work.
Status: NEW
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: Git (show other bugs)
Version: 8.0
Hardware: PC Linux
: P4 normal (vote)
Assignee: Ondrej Vrabec
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-10 22:43 UTC by sproger1
Modified: 2014-06-11 20:59 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sproger1 2014-06-10 22:43:24 UTC
The "Revert Modifications" action does not work property for files that are currently open in a text editor AND which have unsaved changes.

The document for open text editors are being saved AFTER the revert action is completed thus undoing the revert.

The sequence of event when the "Revert Modifications" action is performed needs to be corrected. 

From: Revert --> Save Open Editors thus overwriting the Revert.
TO: Revert --> Reload Open Editors with reverted changes.


To reproduce:

1) Open a file that is under revision control in a text editor.
2) Make a change to it (do not hit save)
3) Select the "Revert Modifications action" (Team-->Revert Modifications)
4) Notice that the modifications were not reverted, instead, the unsaved changes have now been saved. This is not the expected behaviour, the expected behaviour if for the unsaved changes to go away and for the document in the text editor to be reloaded with the last committed version of the file. This is what would have happened if the document did not have unsaved changes.

This issue occurs with Git, and possible all the other revision control systems.
Comment 1 Ondrej Vrabec 2014-06-11 06:42:56 UTC
Just wait until the file's status gets refreshed and then you click on the revert button in the revert modifications dialog. Or simply close the file without saving it.
Comment 2 sproger1 2014-06-11 20:59:52 UTC
Agreed. This is not the highest priority issue, but it is annoying on the rare occasions I encounter it.

I work around it by performing the revert action TWICE. 

The first time, instead of reverting my unsaved changes, it saves it(I get annoyed, since I don't remember to WAIT a few seconds for the call to LifecycleManager.getDefault().saveAll() to complete "see GitAction.java"). Then I perform a revert action a second time and then the revert behaves correctly (since I don't have unsaved changes anymore).