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 126588

Summary: Changing task is running when userdir is in mercurial repository
Product: versioncontrol Reporter: Jiri Skrivanek <jskrivanek>
Component: MercurialAssignee: issues@versioncontrol <issues>
Status: VERIFIED FIXED    
Severity: blocker CC: msandor
Priority: P1    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: messages.log with mercurial logging.
proposed patch
additional patch

Description Jiri Skrivanek 2008-02-04 07:52:43 UTC
Mercurial "Changing" task is running when you open IDE with userdir under mercurial repository. I think it should not do
anything until you open a project or a file. To reproduce:

- run IDE with usedir in Hg repository (e.g. main/myuserdir - this case is common when you run UI tests)
- "Changing..." task is running in progress bar. It takes some time before it finishes (see messages.log where mercurial
logging is on).

Product Version: NetBeans IDE Dev (Build 20080204054559)
Java: 1.6.0_04; Java HotSpot(TM) Client VM 10.0-b19
System: Windows XP version 5.1 running on x86; Cp1250; cs_CZ (nb)
Comment 1 Jiri Skrivanek 2008-02-04 07:53:28 UTC
Created attachment 55973 [details]
messages.log with mercurial logging.
Comment 2 Padraig Obriain 2008-02-05 13:29:18 UTC
Added Maros to CC list so we can discuss whether we should or can restrict change notifications.

The file for which we get Change notification being complained of is build.properties.

Should we special case ignoring changes to that file?
Comment 3 Maros Sandor 2008-02-05 13:32:34 UTC
It is OK for mercurial to react to file change events and I think it should not be hacked in any way. I see a lot of
changes to build.properties file in the log, maybe the problem is in the module that touches the file so frequently.
Comment 4 Jiri Skrivanek 2008-02-05 14:05:30 UTC
Or it might the problem that every change of this file adds a new "Changing..." task to the queue. And it waits until
previously started task for the same file finishes. IMO, if there is a new change event for the same file, it should
cancel previous "Changing..." task.
Comment 5 Maros Sandor 2008-02-05 14:10:09 UTC
Yes, this can also be the case. Maybe all change events could be coalesced, not just events for one file.
Comment 6 John Rice 2008-02-05 14:31:26 UTC
Ok - if we are getting lots of changing events then who is responsible for coalescing them? 

I assume its the component that's generating them, or do you mean we should be coalescing them at our end?
Comment 7 Maros Sandor 2008-02-05 14:59:45 UTC
Yes, mercurial could be doing that. Subversion does that too in its cache. It collects file changes that happen while a
refresh is in progress and then when refresh finishes it looks if there are any new events and processes them. This way
refresh tasks do not stack in the queue.
Comment 8 Padraig Obriain 2008-02-06 08:53:34 UTC
I have noticed an error in fileChangedImpl which causes refresh to be done twice. I will fix that first.
Comment 9 Padraig Obriain 2008-02-06 09:00:22 UTC
Created attachment 56139 [details]
proposed patch
Comment 10 Padraig Obriain 2008-02-06 09:05:22 UTC
changeset:   66044:b9d6fd22c4b0
tag:         tip
user:        padraigob@netbeans.org
date:        Wed Feb 06 08:49:26 2008 +0000
files:       mercurial/src/org/netbeans/modules/mercurial/MercurialInterceptor.java
description:
Correct change to fileChangedImpl to not refresh ignored files.

I have pushed this change.
Comment 11 Padraig Obriain 2008-02-06 10:07:00 UTC
Created attachment 56147 [details]
additional patch
Comment 12 Padraig Obriain 2008-02-06 10:24:01 UTC
changeset:   66051:84ed214820b7
tag:         tip
user:        padraigob@netbeans.org
date:        Wed Feb 06 10:05:15 2008 +0000
files:       mercurial/src/org/netbeans/modules/mercurial/FileStatusCache.java
mercurial/src/org/netbeans/modules/mercurial/MercurialInterceptor.java
description:
126588: Reduce number of FileStatusCache.refresh calls for FileCreation and FileChanged events


I have committed the additional patch.

This should reduce the 1 the total number of "hg status" calls made because of changes to build.properties for the
attached messages.log.
Comment 13 Jiri Skrivanek 2008-02-06 13:41:25 UTC
Verified. Thanks.