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 215099 - SVN REVERT does not refresh file in editor
Summary: SVN REVERT does not refresh file in editor
Status: VERIFIED FIXED
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: Subversion (show other bugs)
Version: 7.2
Hardware: PC Windows 7
: P1 normal (vote)
Assignee: Ondrej Vrabec
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-02 23:02 UTC by mhankus
Modified: 2012-07-19 11:32 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (332.72 KB, text/plain)
2012-07-02 23:02 UTC, mhankus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mhankus 2012-07-02 23:02:21 UTC
Product Version = NetBeans IDE 7.2 RC1 (Build 201206272359)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0_05
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.1-b03


When files are reverted, operation finishes, but file open in editor is not refreshed - which can cause major problem.

Steps to reproduce:

1. Check out file from svn
2. Modify it
3. save
4. From Subversion menu select "Revert modifications"
5. File on disk is reverted, but editor keeps modified version
Comment 1 mhankus 2012-07-02 23:02:33 UTC
Created attachment 121674 [details]
IDE log
Comment 2 mhankus 2012-07-03 07:59:55 UTC
I've changed priority to P1, because according to 

http://wiki.netbeans.org/BugPriorityGuidelines

it can be classified as "User's data are corrupted or lost"


This revert issue already caused some problems for me.
Comment 3 Stepan Zebra 2012-07-03 13:06:23 UTC
Reproducible in both 7.2 RC and trunk on default settings.
Doesn't happen with javahl and cmd clients, just with svnkit. Also it doesn't happen on working copies in svn 1.6 format.
If the problem is coming from svnkit, at least hotfix to prevent this behavior should be put into 7.2.
Comment 4 Tomas Stupka 2012-07-03 15:26:41 UTC
svnkit restores the files timestamp back to the past value when the last commit was made. 
CloneableEditorSupport.Listener.propertyChange is notified about the file change but doesn't reload the document because the delivered PROP_TIME new value (files timestamp) < lastSaveTime. 

one more thing:
a) the problem is reproducible on Mac only when the revert action is invoked from the editor tab context menu or the main menu - in such case usually PROP_TIME new value = files timestamp, but might be from time to time also -1 like in b)
b) in case the revert action is invoked from the versioning status view or the projects view then PROP_TIME new value = -1 and the document is refreshed

a possible workaround in subversion would be to reset the files timestamp to lastSaveTime after revert, don't know though what side effects that would have on the svnkit-s behavior. Also that other similar commands may cause the same problem - e.g. svn update $rev, svn switch, ...

Preferably the IDE should reload the document even if the timestamp is older then lastSaveTime. Other external tools might cause similar scenarios!

cc Mila and Jarda, maybe they will have some idea ...
Comment 5 Miloslav Metelka 2012-07-03 17:05:42 UTC
I've made a fix in CloneableEditorSupport with an initial threshold of 10secs time difference - we should discuss the fix once Yarda is back.
Initial testing of behavior is ok - the file with an older timestamp reloads opened editor. Tests in openide.text pass ok after the fix.
http://hg.netbeans.org/jet-main/rev/29758473fe48
Comment 6 Quality Engineering 2012-07-04 03:08:46 UTC
Integrated into 'main-golden', will be available in build *201207040002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/29758473fe48
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #215099 - SVN REVERT does not refresh file in editor.
Comment 7 Jiri Rechtacek 2012-07-04 11:34:20 UTC
mhankus, please could you verify the fix on bits from http://bits.netbeans.org/download/trunk/nightly/2012-07-04_00-02-20/

Thanks
Comment 8 mhankus 2012-07-04 12:33:40 UTC
Works for me too. Thank you for quick fix ;)
Comment 9 Stepan Zebra 2012-07-09 12:57:25 UTC
Fix verified by QE in trunk. If there are no objections, please integrate into release72 branch.
Comment 10 Jiri Rechtacek 2012-07-09 13:11:52 UTC
(In reply to comment #9)
> Fix verified by QE in trunk. If there are no objections, please integrate into
> release72 branch.

Thanks for verification - backported to release72 - http://hg.netbeans.org/releases/rev/53c0450cbe9b
Comment 11 Quality Engineering 2012-07-10 06:42:55 UTC
Integrated into 'releases', will be available in build *201207092359* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/53c0450cbe9b
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #215099 - SVN REVERT does not refresh file in editor.
(transplanted from 29758473fe48b727aae81091cbb3fe6a0062b390)
Comment 12 Stepan Zebra 2012-07-19 11:32:47 UTC
verified in 7.2