When to use invalidate()

Dirkjan Ochtman dirkjan at ochtman.nl
Tue Feb 2 01:44:55 CST 2010


On Tue, Feb 2, 2010 at 01:34, Greg Ward <greg at gerg.ca> wrote:
>  * MySQL errors because the database connection used by the extension
> stays open and the server got restarted
>  * out-of-date information: someone pushes new changesets to the
> repo, and hgweb correctly shows them, but bugmap fails to augment the
> display with bug info (which it correctly does for changesets that
> existed initially)
>
> In all cases, the workaround is to restart the long-running process.  Lame.
>
> I *thought* the right fix was to wrap localrepository.invalidate() and
> use that to discard my extension's state.  Then on the next request,
> it would re-read the local bugmap file, reopen the database
> connection, etc.  But that doesn't work: hgweb doesn't even call
> invalidate()!  TortoiseHg seems to call it a lot, but I have not read
> the code to see when or why.

hgweb (in hgweb_mod.py) should re-instantiate the repo on each request
where the mtime for .hg has changed. If you think there's something to
be improved there, let's hear it (though I think invalidate()ing just
before discarding the repo probably doesn't make much sense).

Cheers,

Dirkjan


More information about the Mercurial-devel mailing list