Command Server

John Arbash Meinel john at arbash-meinel.com
Wed Dec 6 02:05:16 GMT 2006


Michal Gornisiewicz wrote:
> Hi all,
> 
> 
> I created a quick hack of a "command server" plugin which speeds up bzr
> for really basic operations - making things /feel/ more responsive.  The
> idea is similar to the shell plugin, but without having to use a
> different shell.
> 
> Instead you start a server process which listens on a UNIX socket and
> instead of bzr, run a script ("fbzr") which connects to the server and
> just passes the command line arguments.
> 
> This should work with most commands, but I've only tested with a few
> simple ones (diff, log, status).
> 
> I thought I'd post it here in case someone finds this useful.
> 
> 
> Some example timings:
> bzr rocks  0.88s user 0.09s system 100% cpu 0.970 total
> fbzr.py rocks  0.04s user 0.02s system 100% cpu 0.060 total
> 
> bzr status  1.24s user 0.17s system 100% cpu 1.408 total
> fbzr.py status  0.05s user 0.01s system 15% cpu 0.386 total
> 
> 
> Caveats:
> 1. You need to use bzr (not fbzr) to control the command server.
> 2. Only stdout (not stderr) is passed from the server.
> 	eg. --version won't show anything
> 3. The environment used is that of the server, not client (except for
> 	the working dir).
> 4. No bells or whistles whatsoever.
> 
> 
> Attached:
> __init__.py	- the plugin
> fbzr.py		- run instead of bzr
> 
> 
> 
> Michal
> 
> PS - I'm NOT subscribed to the list.
> 

This is very similar to a plugin I wrote a while back "bzr service".

http://bzr.arbash-meinel.com/plugins/service/

It actually does handle stdin and stderr, and it has a C front end that
you can compile.

When I did it, I found it worked pretty well, except for the environment
issues. Because it meant stuff like "gpg --clearsign" would occur in the
wrong place.

My version uses regular socket, but it should be easy to switch to a
Unix socket. The only reason I didn't is because there isn't such a
thing as a Unix socket on windows. So I was actually thinking to switch
over to 'named pipes' on win32, and unix socket otherwise.

I guess it also uses forking which isn't directly supported on windows.
But I wanted to avoid having any sort of global state between runs.

I guess the other issues were how to pass around where the socket would
be. You pretty much have to use an ENV var, but then you need to set
that up during startup. Either that, or use a standard location like
~/.bazaar/service.socket

But certainly, something along these lines can help the interactiveness
of 'bzr'. Startup time is definitely something we've been trying to address.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20061205/5d5369b8/attachment.pgp 


More information about the bazaar mailing list