[PATCH python-hglib v3] Allow hglib user to get call backs for prompts, output and errors

Yuya Nishihara yuya at tcha.org
Fri Oct 28 09:24:22 EDT 2016


On Fri, 28 Oct 2016 11:35:27 +0100, Barry A. Scott wrote:
> # HG changeset patch
> # User Barry A. Scott <barry at barrys-emacs.org>
> # Date 1477650800 -3600
> #      Fri Oct 28 11:33:20 2016 +0100
> # Node ID dd7ce6a2c32d179eb2881d08e13d11631bf341fa
> # Parent  6f15cb7cc9cb4427f35c60080f85dbf4ca5abd10
> Allow hglib user to get call backs for prompts, output and errors.
> 
> setcbout(cbout), setcberr(cberr) and setcbprompt(cbprompt) are used to
> set the call back function used by the hgclient class. cb stands for
> call back.
> 
> cbout is a function that will be called with the stdout data of the
> command as it runs. cbout is called with output as it is made available,
> which can be as partial lines or multiple lines.
> 
> cberr is a function that will be called with the stderr data of the
> command as it runs. cberr is called with output as it is made available,
> which can be as partial lines or multiple lines.
> 
> Command that make remote connects can prompt for username and password
> for HTTP/HTTPS connections.
> 
> cbprompt is called when hgclient need a response to a prompt from the
> server. It receives the max number of bytes to return and the contents
> of stdout received so far. The last text sent to either cbout or cberr
> will contain the prompt text itself.

I'm not a big fan of these APIs, but they look okay and solve the real
problem, so seem good. Marked as pre-reviewed, thanks.

Can you add some tests as a follow-up?


More information about the Mercurial-devel mailing list