Differences between revisions 1 and 7 (spanning 6 versions)
Revision 1 as of 2013-06-21 22:59:26
Size: 3297
Editor: 5-12-23-230
Comment:
Revision 7 as of 2013-08-12 10:57:22
Size: 1834
Editor: 5-12-22-129
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
'''C-Hglib''' = C-Hglib =
Line 11: Line 11:
== First plan == Also you can take a look on c-hglib [[http://swarm.cs.pub.ro/~istana/c-hglib/html|documentation]].
Line 13: Line 13:
Some steps that I want to do first:
 * create an open mechanism between Client (C library) and Server ( Mercurial Command Server)
 * close the connection
 * readchannel function that will get the channel and the length of message.
 * create the _hello function, that will receive the first message, after the connection.
 * cmdbuilder, will compute the command that will be sent to CommandServer.
 * runcommand, will send the build command to the server and will return the compute message.
 * mercurial commands.
== Plan to build c-hglib ==
Line 22: Line 15:
The implementation was split in three steps:
Line 23: Line 17:
How to make it happen:
 *Create an open mechanism between Client (C library) and Server ( Mercurial Command Server)
  *First I will try to compute a command that will be execute in the child process.
  *It will be of the form “HGPATH serve --cmdserver pipe --config ui.interactive=True” + “-R path ”
  *I will create two pipes for the bidirectional connection. Then I will fork a new process, where I’ll execute the command that will open the Command Server. In the child process I will redirect the input, the output and the error in to the pipes (for the communication Client-Server). In my case the child process will open the Command Server and the parent process will be the client.
  *The communication will be through the pipes descriptors.
  *The open function will return a Client structure that will contain the pipes descriptors and other useful information.
 * level 0 also called row level
   * pass a raw command string, get unparsed results
 * level 1 also called command level
   * function per command, returns results in native C datatypes
 * level 2 also called "object" level
   * emulate important Mercurial internal APIs like contexts with a native C paradigm
Line 31: Line 24:
 *Close the connection
  *Will kill the command server and will close the pipe descriptors for a specific Client.
 
 *readchannel function that will get the channel and the length of message.
  *Will read a char (the channel) and a uint (the length). There are chances for a problem to occur over here with the unsigned integer (the Command Server will send to me an integer in big endian form).
  *Most probably I will have to create a conversion mechanism.
 
 *create the _hello function that will receive the first message, after the connection.
  *This function will read the channel and the default data. Then I will check the correctness of data.
 
 *cmdbuilder, will compute the command that will be sent to CommandServer.
  *This function will return a list with a compute command that will be send to CommandServer. This function will be called by all mercurial commands.
For the moment level 0 is in the accepting phase, I need to get reviews before declared finished. You can see and review level 0 on this [[http://markmail.org/thread/hixvvvcpklfjnqze|patchbomb]].
Line 44: Line 26:
 *runcommand, will send the build command to the server and will return the compute message.
  *From this function I will sent through pipes the commands and I will receive the specific answers. This will be the function that will make the communication.
Meanwhile I started to make a sketch for level 1. You can also see and comment on this sketch over [[http://markmail.org/message/pofplkyodyoxp5mq|here]].
Line 54: Line 35:

{{{
Line 55: Line 38:
├── examples
│ └── level0.c
├── hglib
│ ├── main.c
│ ├── Makefile
│ ├── client.c
│ ├── client.h
│ ├── utils.c
│ └── utils.h
├── README.md
└── Makefile
}}}
Line 56: Line 51:
├── hglib == Reporting bugs ==
Bugs can be reported on [[https://bitbucket.org/istana/c-hglib/issues?status=new&status=open|bitbucket-issue list]].
Line 58: Line 54:
│ ├── main.c
Line 60: Line 55:
│ ├── Makefile.am

│ ├── utils.c

│ └── utils.h

├── Makefile.am

├── README.md

└── tests

└── Makefile.am
== See also ==
 * CommandServer
 * MercurialApi
 * PythonHglib
 

C-Hglib

A C library for interfacing with Mercurial's CommandServer.

1. Getting the source

You can clone the packeage from its primary repository c-hglib.

Also you can take a look on c-hglib documentation.

2. Plan to build c-hglib

The implementation was split in three steps:

  • level 0 also called row level
    • pass a raw command string, get unparsed results
  • level 1 also called command level
    • function per command, returns results in native C datatypes
  • level 2 also called "object" level
    • emulate important Mercurial internal APIs like contexts with a native C paradigm

For the moment level 0 is in the accepting phase, I need to get reviews before declared finished. You can see and review level 0 on this patchbomb.

Meanwhile I started to make a sketch for level 1. You can also see and comment on this sketch over here.

3. My starts points will be

4. Directory tree

.
├── examples
│   └── level0.c
├── hglib
│   ├── main.c
│   ├── Makefile
│   ├── client.c
│   ├── client.h
│   ├── utils.c
│   └── utils.h
├── README.md
└── Makefile

5. Reporting bugs

Bugs can be reported on bitbucket-issue list.

6. See also

C-Hglib (last edited 2014-11-11 22:05:57 by rcl)