cmdserver protocol questions

Martin Geisler mg at aragost.com
Thu Jun 30 03:08:13 CDT 2011


Hi guys,

Jan is writing a Java library for the cmdserver and he had a number of
questions for me about the protocol. I've tried to sum them up below:

* Right now, you must always run the cmdserver in an existing repository
  even if you want to run a commands.norepo command like 'hg init'.

  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.

* Parsing of server's hello block: it would have been nicer if this had
  been a standard format such as JSON -- now everyone has to implement
  the parsing by themselves.

  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?

* 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?

* Input/line channels: what is the precise difference between the two
  and why do we need both?

  It seems to me that the 'I' channel would be enough, also for reading
  patches from stdin. Since the 'I' channel is not line-oriented, it
  does not have the 4096 byte line length maximum.

-- 
Martin Geisler

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


More information about the Mercurial-devel mailing list