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 123361

Summary: Revert modifications creates *.orig and starts update
Product: versioncontrol Reporter: Jiri Skrivanek <jskrivanek>
Component: MercurialAssignee: issues@versioncontrol <issues>
Status: VERIFIED FIXED    
Severity: blocker Keywords: RELNOTE
Priority: P3    
Version: 6.x   
Hardware: PC   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:
Attachments: Proposed patch

Description Jiri Skrivanek 2007-12-04 14:46:02 UTC
If you call Revert modification, it takes long time on big repository because it calls update afterwards. Also there are
*.orig files left and visible in Projects view. To reproduce:

- take repository from
http://deadlock.netbeans.org/hudson/job/hgimport/lastSuccessfulBuild/artifact/apisupportx/hgimport/out/main.tar.gz
- open o.o.util project in IDE
- modify e.g. org.netbeans.modules.openide.util.AWTBridge.java
- call 'Mercurial|Revert Modifications'. You can see 'Update' progress bar at the bottom which takes some time. Also
there is AWTBridge.java.orig in Projects view.

Mercurial plugin 1.4.1.42.1, Mercurial runtime 0.9.5, NetBeans IDE Dev (Build 20071204063712), WindowsXP.
Comment 1 John Rice 2007-12-05 16:39:51 UTC
Refer to 121715: Added to Mercurial Global Options checkbox to determine if backups of Locally Modified files are made
on Revert Modifications. Default setting is to make backups, which seems sensible given the comments on Local History.

This will allow you to turn off backups and stop the .orig files appearing.

I'll look into the Update issue.
Comment 2 John Rice 2007-12-06 14:12:05 UTC
I have looked into this, it appears to be a Hg issue due to the size of your repository with over 67k files. I run the
following revert command from the command line against your repository, having modified and saved to disc the
AWTBridge.java file, this is the exact same command we are running from within the IDE:

$ time hg revert --repository /export/home/jr140578/work/main --rev 0
/export/home/jr140578/work/main/o.o.util/src/org/netbeans/modules/openide/util/AWTBridge.java

real    0m59.899s
user    0m27.126s
sys     0m3.109s
bash-3.2$ ls
AWTBridge.java  AWTBridge.java.orig  ActionsBridge.java  NamedServicesProvider.java  PreferencesProvider.java

So this is pretty close to the profile timings I see in the IDE:
performRevert: 70 sec
  doRevert:    67 sec
  scanFolder:   3 sec

There are a number of hg status commands being run that could be optimized, but this accounts for only 3sec of the
overall 70 sec for the performRevert call. Also would like to know why in the IDE doing an exec it seems to take an
extra 7 sec.

We'll log a bug against Mercurial and see what comes of it.

Comment 3 John Rice 2007-12-06 14:24:20 UTC
Bug logged:
http://www.selenic.com/mercurial/bts/issue857

Will release note the issue.
Comment 4 Jiri Skrivanek 2007-12-06 14:54:42 UTC
Thank you for the evaluation. I thought it is problem of plugin but you are right it takes about 50s from command line
as well.
Comment 5 John Rice 2007-12-06 18:03:52 UTC
Changed the status bar text to Reverting... and removed a redundant refresh cache call.
Comment 6 John Rice 2007-12-06 18:06:04 UTC
Changed the status bar text to Reverting... and removed a redundant refresh cache call.
Comment 7 John Rice 2007-12-06 18:48:55 UTC
Created attachment 53960 [details]
Proposed patch
Comment 8 John Rice 2007-12-06 18:52:25 UTC
IDE:-------------------------------------------------
IDE: [06/12/07 18:50] Committing started
Checking in ui/update/Bundle.properties;
/shared/data/ccvs/repository/versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/update/Bundle.properties,v 
<--  Bundle.properties
new revision: 1.5; previous revision: 1.4
done
Checking in ui/update/RevertModificationsAction.java;
/shared/data/ccvs/repository/versioncontrol/mercurial/src/org/netbeans/modules/mercurial/ui/update/RevertModificationsAction.java,v
 <--  RevertModificationsAction.java
new revision: 1.7; previous revision: 1.6
done
Checking in util/HgUtils.java;
/shared/data/ccvs/repository/versioncontrol/mercurial/src/org/netbeans/modules/mercurial/util/HgUtils.java,v  <-- 
HgUtils.java
new revision: 1.23; previous revision: 1.22
done
IDE: [06/12/07 18:50] Committing finished
Comment 9 Jiri Skrivanek 2007-12-07 13:54:35 UTC
Verified.