When to use invalidate()

Dirkjan Ochtman dirkjan at ochtman.nl
Tue Feb 2 07:55:31 CST 2010


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

Cheers,

Dirkjan


More information about the Mercurial-devel mailing list