[PATCH python-hglib] Add feature to allow hglib user to get call backs for prompts and output

Yuya Nishihara yuya at tcha.org
Sun Oct 16 10:36:51 EDT 2016


On Thu, 06 Oct 2016 17:52:38 +0100, Barry A. Scott wrote:
> # HG changeset patch
> # User Barry A. Scott <barry at barrys-emacs.org>
> # Date 1475772736 -3600
> #      Thu Oct 06 17:52:16 2016 +0100
> # Branch hglib-gui-features
> # Node ID 1ac3819a61527836d47f7cd6a113b194c307ffeb
> # Parent  efc527cc43d7394a5bd0deb1d29c4307592f7528
> Add feature to allow hglib user to get call backs for prompts and output.

> The cb prefix was choosen to avoid matching a hg long option name.

That seems fine. merge() already has "cb" argument.

> -    def rawcommand(self, args, eh=None, prompt=None, input=None):
> +    def rawcommand(self, args, eh=None, prompt=None, input=None, cbout=None,
> +                   cberr=None):
>          """
>          args is the cmdline (usually built using util.cmdbuilder)
>  
> @@ -173,9 +174,29 @@
>  
>          input is used to reply to bulk data requests by the server
>          It receives the max number of bytes to return
> +
> +        cbout is a function that will be called with the stdout data of the command
> +        as it runs.
> +
> +        cberr is a function that will be called with the stderr data of the command
> +        as it runs.
>          """

Do they need to be separate callbacks? I think prompt() can be extended to
take "err" value as an optional third argument.


More information about the Mercurial-devel mailing list