<div dir="ltr"><div>Hi, </div><div><br></div>2013/8/5 Giovanni Gherdovich <span dir="ltr"><<a href="mailto:g.gherdovich@gmail.com" target="_blank">g.gherdovich@gmail.com</a>></span><br><div class="gmail_extra"><div class="gmail_quote">

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hello Kevin,<br><br>Kevin wrote:<br>:::: On 1 Aug 2013, at 6:18 AM, Iulian Stana wrote:<br>
:::: ><br>
:::: > 2) I think that the best solution for all those commands<div><br>:::: >    will be to return a structure of the following form:<br>
:::: > struct hg_ret{<br>:::: >     int exitcode;<br>:::: >     char *out_data;<br>:::: >     char *err_data;<br>:::: > };<br>:::: <br>:::: Again, for things like `hg log`, you'll want to be able to read the output<br>


:::: (and errors) long before you could possibly get the exit code.<br>:::: <br>:::: I really think you need to nail down the full details of<br>:::: how level 0 will work before thinking about level 1.<br><br></div>Iulian and me long meditated over the IRC session<br>


held on July 2nd where Matt explained how exit codes works:<br><a href="http://bpaste.net/show/FW3tCYalMJIjNkgRwyOG/" target="_blank">http://bpaste.net/show/FW3tCYalMJIjNkgRwyOG/</a><br><br>line 28, "<mpm> You cannot return an exit code from hg_rawcommand."<br>


line 50-51 "<mpm> iulians: Ok, let's say I do<br>            hg_rawcommand("this command will run for four days and output 500G of data")..<br>            when does this API call return?<br>            Can I convince you that the answer should not be<br>


            "four days from now after trying to buffer 500G of data"?<br><br>Basically what we understood is that the level 0 function hg_rawcommand()<br>should just send the command, and a successfull return code would mean<br>


"command sent w/o problems". Then you read the answer with as many<br>hg_rawread()s as you need, and finally call hg_exitcode().<br><br>But when moving on to level 1, a function like hg_log() would be all-in-one,<br>


meaning it will be implemented like<br><br>int hg_log(...) {<br>    hg_rawcommand(...);<br>    while(hg_rawread(...)) {<br>        ...<br>    }<br>    return hg_exitcode(...);<br>}<br><br>which is, hg_log() *will* buffer data internally. Otherwise, as Idan notes<br>


in his previous email in this thread, there is no added value in writing<br>level 1 at all; we just stick to level 0.<br><br>But Matt also writes, in the backlog above (line 32)<br><br>"<mpm> The client library cannot/should not<br>


       internally buffer unknown huge masses of data."<br><br>which, at this point, confuses me.<br><br>I really hope we can have a discussion on IRC about this today.<br>It has been long since Iulian had some feedback from the seniors.<br>


<br>:::: I really think you need to nail down the full details of<div>:::: how level 0 will work before thinking about level 1.<br></div></div></blockquote></div><div class="gmail_extra"><br></div>I think that I cannot give a better explanation.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">I agree that some calls could run for a long period of time, but like </div><div class="gmail_extra">Giovanni said, I think that on level 1, the commands must be in a compact </div>
<div class="gmail_extra">form.</div><div class="gmail_extra"><div>Probably I'm not seeing this issue, from the best view point. If you really </div><div>want to process your data when you receive them, you can use level 0 to </div>
<div>build such kind of function.<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">From what I understand from your mail, you would like to do something like:</div><div class="gmail_extra"><br></div><div class="gmail_extra">
hg_log( ... ); /* Get the entire log history. Normally this call will take, 5 minutes.*/</div><div class="gmail_extra">/* You don't want to wait 5 minutes.*/</div><div class="gmail_extra">/* Start processing the log data, after 1 millisecond.*/</div>
<div class="gmail_extra">/* Continuing your work. */</div><div class="gmail_extra"><br></div><div class="gmail_extra">From my knowledge, a user can put the log command in a thread. I</div><div class="gmail_extra">don't know and I don't think that is't my job to make this processes. </div>
<div class="gmail_extra">I am not sure about my thoughts, please correct me.</div><div class="gmail_extra"><br></div>-- <br><div dir="ltr"><div>Iulian</div></div>
</div></div>