[PATCH 0 of 3 RFC -V3] c-hglib: level 1 models for mercurial commands (introduction)

Iulian Stana julian.stana at gmail.com
Thu Aug 22 09:19:59 CDT 2013

This is a draft of my work for c-hglib up to now, I am sending this to the list
for public review (even if this is not a patch for the core mercurial). I am
sure that the main developers following my work (Matt, Pierre-Yves, Idan and
others) will have important remarks on the architecture and on the style, and I
like to solicit those feedbacks.

This patchbomb will show the implementation for hg_log command using an
iterator-like mechanism and the implementation for hg_add command using on other

There are two possibilities on how level 1 commands can behave:

(1) Return immedietely after having sent the command to commandserv,
    just wrapping a call to hg_rawcommand().
    Other API functions are provided to retrieve:
    (a) the data sent in response by the commandserv, in parsed
(structured) form
    (b) the exitcode, i.e. the content of the 'r' channel after all things
        have happened.
(2) Wait for the commandserv to complete *all* his actions in response to
    the issued command, which is cache the commandserv response somewhere,
    and return the actual exitcode (channel 'r' from commandserv)
    as the result of the chglib API call


We called those two possibilities model (1) and model (2). The hg_log command
will use the first model (1) and the hg_add command will use second one, model

In this patchbomb I had implemented those two models. Those models will help me,
implementing the rest of the mercurial commands, so I would like know if those
two mechanims will fit with chglib API.

More information about the Mercurial-devel mailing list