[PATCH] serve: make proper webserver api

TK Soh teekaysoh at gmail.com
Wed Apr 9 00:30:22 CDT 2008


On Wed, Apr 9, 2008 at 12:46 AM, TK Soh <teekaysoh at gmail.com> wrote:
> On Tue, Apr 8, 2008 at 5:31 PM, Dirkjan Ochtman <dirkjan at ochtman.nl> wrote:
>  > Dirkjan Ochtman <dirkjan <at> ochtman.nl> writes:
>  >  > Would be nice if someone could validate this approach. I think it makes
>  >  > the web server more accessible from other Python code, which is what was
>  >  > the aim, and also makes it a little cleaner in some ways.
>  >
>  >  If there are no objections, I'll just push this in a few hours.
>
>  I've been rather busy lately (mostly on preparing the TortoiseHg 0.4
>  release), so I haven't really found time to look at it. With 0.4rc1
>  out of the door (thanks to Steve Borho), I should be able to take at
>  least a quick look into it. Though I suspect Steve might be the better
>  person to do this ;-)

This patch might be a little over my head now, but I'll try to give
some feedback:

1. there's a little too much stuff commands.serve() has to handle. Can
init() be moved into the server.py, and handled more 'transparently'?
Bottom line, the less things an API users has to setup, the better it
is.

2. from API standpoint, hgweb.server.service class should support a
stop() method to terminate the server. As a reference, TortoiseHg adds
the stop() method hack to kill the server:

   http://tortoisehg.sourceforge.net/hg/tortoisehg-dev/file/5a5341bda4c5/hggtk/serve.py

3. is there a way to capture or redirect accesslog or errorlog to a
storage class, a Queue object maybe, or mercurial.ui even? We'd like
to be able to show these log on the logging window of the TortoiseHg's
Serve dialog. Currently we have to redirect sys.stderr and sys.stdout,
making it rather difficult when debugging with pdb.

I am sure Steve will do a much better job assessing and commenting on the patch.


More information about the Mercurial-devel mailing list