[PATCH c-hglib] Initial commit
Iulian Stana
julian.stana at gmail.com
Tue Jul 2 13:55:13 CDT 2013
2013/7/2 Matt Mackall <mpm at selenic.com>
> On Tue, 2013-07-02 at 00:31 +0300, Iulian Stana wrote:
> > + #define p_read rpipe[0]
> > + #define c_write rpipe[1]
> > + #define c_read wpipe[0]
> > + #define p_write wpipe[1]
>
> Yuck.
>
It's something new for me, but it seems to be very helpful.
> > +hg_header* readheader(hg_handle *handle)
>
> Please always put the * on the right side of the space. Why? Compare:
>
> char* a, b;
> char *a, b;
>
> In the first, you mislead the reader into thinking that a and b are the
> same type, and that C recognizes "char*" as a "thing". It does not, and
> it binds the "*" to the right side regardless of where you put the
> space.
>
> (In fact, I recently fixed a bug where someone had mislead themselves
> with exactly this nonsense.)
>
I know the difference... I will try to avoid this kind of mistakes from now
on.
> What if we want to run a command without a repository, like init or
> clone?
>
>
>From what Idan said last Wednesday, the init and the clone commands are
a little special. Until now I had focused on the raw level, like you said
in in
an older mail.
Level 0, raw level , "pass a raw command string, get unparsed results"
> How do we get exit codes?
> What does this return? (hg_close)
hg_rawcommand
>
> What does this return? How do we pass args with spaces?
>
> The hg_rawcommand and the hg_close will return the exit code, probably
0 for success and -1 for fail.
For the first commit I had tried to make the minimal to show you that the
level 0 it's working. I change a bit and now it's working to send commands
with multiple options arguments, pass with spaces.
> hg_rawread
What does this return?
>
Will return the number of bytes read. I had tried to make it looks like the
linux read command. http://linux.die.net/man/2/read
How do we send input to a command like 'hg import -'?
>
> How do we handle interactive commands like merge?
>
> How do we get error output and warnings?
>
>
I don't really know how to answer to those questions right now...
I will move this discussion on IRC.
Have a nice day,
Iulian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20130702/f1e25b5c/attachment.html>
More information about the Mercurial-devel
mailing list