cmdserver protocol questions

Martin Geisler mg at aragost.com
Fri Jul 1 05:13:07 CDT 2011


Kevin Bullock <kbullock+mercurial at ringworld.org> writes:

> On Jun 30, 2011, at 3:08 AM, Martin Geisler wrote:
>
>>  Perhaps we should have both 'hg serve' that does what it used to do
>>  and a new 'hg cmdserver' command -- the latter should be in
>>  commands.optionalrepo whereas the first cannot be there.
>
> Can we do that, given the fact that the command server is due to
> appear in 1.9 tomorrow?

Of course we can add DEPRECATED to the --cmdserver option for 'hg serve'
and introduce a new 'hg cmdserver' command.

>>  This is of course not difficult in itself, but now implementors must
>>  decide if whitespace should be trimmed from each line? It is also
>>  not clearly specified what a "field" is -- is it something that
>>  matches "[a-z]+:" or can there be other characters in a field? The
>>  safe choice must be to split (once!) on ':', but will all
>>  implementations do this?
>> 
>>  Field names will presumably always be in ASCII?
>
> Specifying RFC822-style headers would fix this without introducing
> anything so cumbersome as JSON. Please let's not have a
> block-structured format for something that can easily be
> line-structured.

Sure, I agree that the current line-oriented format is enough.

But instead of thinking "ah, neat, I'll just use a JSON parser for
this!" I bet people will think "oh, so it's a email-like format that
I'll have to parse myself?".

It's not written anywhere that the headers are truely RFC 822 compliant,
so people will natually wonder if they can let a email library parse
them. I suggested declaring that the headers are RFC 822 complient, but
Augie commented on IRC that many email libraries are buggy.

>> * Termination of server's hello block: how many 'o' channel writes
>> can a client expect? The example shows several writes on the 'o'
>> channel, but in practice it seems that there is only one and I think
>> this was also mentioned somewhere on this mailinglist?
>
> I thought we'd established that the hello block will always be sent in
> a single chunk? <http://www.selenic.com/hg/rev/c19de7f32961>?

Yes, Idan confirmed this and updated the protocol documentation on the
wiki. I'm sure we both agree that commit messages don't count as a
protocol specification :-)

-- 
Martin Geisler

aragost Trifork
Professional Mercurial support
http://mercurial.aragost.com/kick-start/


More information about the Mercurial-devel mailing list