When to use invalidate()

Steve Borho steve at borho.org
Tue Feb 2 09:39:02 CST 2010


On Tue, Feb 2, 2010 at 7:55 AM, Dirkjan Ochtman <dirkjan at ochtman.nl> wrote:
> On Tue, Feb 2, 2010 at 14:29, Greg Ward <greg at gerg.ca> wrote:
>>  * hgweb re-reads config when 00changelog.i has changed, not when
>> config has changed... so if you edit config on the server, nothing in
>> hgweb changes until someone pushes to the repo.  If my analysis is
>> correct, that sounds confusing as heck!
>
> Maybe hgweb should check the mtime for .hg instead?
>
>>  * knowledge about repository structure lives in hgweb, not in
>> localrepository (so it's hard for e.g. THG to take advantage of this
>> to detect when it needs to refresh)
>
> Not sure why you think this.
>
>>  * no clear way for extensions to hook into the process and let their
>> state be torn down when the repo state is torn down
>>  * no clear way for extensions to detect/announce that they have
>> stale state that needs to be torn down
>>  * no consistent way for all long-running apps (hgweb, THG, hgview,
>> ...) to tear down repo state at the end of some processing phase (HTTP
>> request, window focus, user hits "refresh", ...)
>
> Maybe we want a hook for this?
>
>>  * constructor sets mtime (from 00changelog.i?)
>>  * isstale() compares current mtime of 00changelog.i to self.mtime
>>  * long-running apps call isstale() and do the right thing
>> (invalidate(), re-instantiate, whatever)
>>  * extensions with state can wrap isstale() and insert their own semantics

Perhaps this could be a short discussion point for the sprint.  THG
does need a better way to detect when the repository needs to be
invalidated, and it should be lightweight enough to do frequently
(each time a menu pops up, etc).

--
Steve Borho


More information about the Mercurial-devel mailing list