Patchwork [2,of,2] cmdserver: document message-encodings and channel output options

login
register
mail settings
Submitter Yuya Nishihara
Date June 28, 2020, 9:10 a.m.
Message ID <e2d5e74938e320a2c957.1593335455@mimosa>
Download mbox | patch
Permalink /patch/46586/
State Accepted
Headers show

Comments

Yuya Nishihara - June 28, 2020, 9:10 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1593333152 -32400
#      Sun Jun 28 17:32:32 2020 +0900
# Node ID e2d5e74938e320a2c9579489527603efc4f300c7
# Parent  4b402b5a3c2ec00bc4e730b46817fcbf937c8d84
cmdserver: document message-encodings and channel output options

While writing the previous patch, I noticed these options are undocumented.
In my testing, a separate status/error message channel works well in GUI
frontend as we no longer have to sort out data and message from mixed outputs.
So let's mark it as not experimental.
Augie Fackler - July 8, 2020, 4:26 p.m.
queued, thanks

> On Jun 28, 2020, at 05:10, Yuya Nishihara <yuya@tcha.org> wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1593333152 -32400
> #      Sun Jun 28 17:32:32 2020 +0900
> # Node ID e2d5e74938e320a2c9579489527603efc4f300c7
> # Parent  4b402b5a3c2ec00bc4e730b46817fcbf937c8d84
> cmdserver: document message-encodings and channel output options
> 
> While writing the previous patch, I noticed these options are undocumented.
> In my testing, a separate status/error message channel works well in GUI
> frontend as we no longer have to sort out data and message from mixed outputs.
> So let's mark it as not experimental.
> 
> diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py
> --- a/mercurial/commandserver.py
> +++ b/mercurial/commandserver.py
> @@ -191,7 +191,6 @@ class channeledinput(object):
> 
> 
> def _selectmessageencoder(ui):
> -    # experimental config: cmdserver.message-encodings
>     encnames = ui.configlist(b'cmdserver', b'message-encodings')
>     for n in encnames:
>         f = _messageencoders.get(n)
> @@ -234,9 +233,6 @@ class server(object):
>             self.ui = self.ui.copy()
>             setuplogging(self.ui, repo=None, fp=self.cdebug)
> 
> -        # TODO: add this to help/config.txt when stabilized
> -        # ``channel``
> -        #   Use separate channel for structured output. (Command-server only)
>         self.cmsg = None
>         if ui.config(b'ui', b'message-output') == b'channel':
>             encname, encfn = _selectmessageencoder(ui)
> diff --git a/mercurial/configitems.py b/mercurial/configitems.py
> --- a/mercurial/configitems.py
> +++ b/mercurial/configitems.py
> @@ -204,7 +204,7 @@ coreconfigitem(
>     b'cmdserver', b'max-repo-cache', default=0, experimental=True,
> )
> coreconfigitem(
> -    b'cmdserver', b'message-encodings', default=list, experimental=True,
> +    b'cmdserver', b'message-encodings', default=list,
> )
> coreconfigitem(
>     b'cmdserver',
> diff --git a/mercurial/helptext/config.txt b/mercurial/helptext/config.txt
> --- a/mercurial/helptext/config.txt
> +++ b/mercurial/helptext/config.txt
> @@ -413,6 +413,12 @@ for credentials as usual if required by 
> 
> Controls command server settings. (ADVANCED)
> 
> +``message-encodings``
> +    List of encodings for the ``m`` (message) channel. The first encoding
> +    supported by the server will be selected and advertised in the hello
> +    message. This is useful only when ``ui.message-output`` is set to
> +    ``channel``. Supported encodings are ``cbor``.
> +
> ``shutdown-on-interrupt``
>     If set to false, the server's main loop will continue running after
>     SIGINT received. ``runcommand`` requests can still be interrupted by
> @@ -2383,6 +2389,8 @@ User interface controls.
> ``message-output``
>     Where to write status and error messages. (default: ``stdio``)
> 
> +    ``channel``
> +      Use separate channel for structured output. (Command-server only)
>     ``stderr``
>       Everything to stderr.
>     ``stdio``
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py
--- a/mercurial/commandserver.py
+++ b/mercurial/commandserver.py
@@ -191,7 +191,6 @@  class channeledinput(object):
 
 
 def _selectmessageencoder(ui):
-    # experimental config: cmdserver.message-encodings
     encnames = ui.configlist(b'cmdserver', b'message-encodings')
     for n in encnames:
         f = _messageencoders.get(n)
@@ -234,9 +233,6 @@  class server(object):
             self.ui = self.ui.copy()
             setuplogging(self.ui, repo=None, fp=self.cdebug)
 
-        # TODO: add this to help/config.txt when stabilized
-        # ``channel``
-        #   Use separate channel for structured output. (Command-server only)
         self.cmsg = None
         if ui.config(b'ui', b'message-output') == b'channel':
             encname, encfn = _selectmessageencoder(ui)
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -204,7 +204,7 @@  coreconfigitem(
     b'cmdserver', b'max-repo-cache', default=0, experimental=True,
 )
 coreconfigitem(
-    b'cmdserver', b'message-encodings', default=list, experimental=True,
+    b'cmdserver', b'message-encodings', default=list,
 )
 coreconfigitem(
     b'cmdserver',
diff --git a/mercurial/helptext/config.txt b/mercurial/helptext/config.txt
--- a/mercurial/helptext/config.txt
+++ b/mercurial/helptext/config.txt
@@ -413,6 +413,12 @@  for credentials as usual if required by 
 
 Controls command server settings. (ADVANCED)
 
+``message-encodings``
+    List of encodings for the ``m`` (message) channel. The first encoding
+    supported by the server will be selected and advertised in the hello
+    message. This is useful only when ``ui.message-output`` is set to
+    ``channel``. Supported encodings are ``cbor``.
+
 ``shutdown-on-interrupt``
     If set to false, the server's main loop will continue running after
     SIGINT received. ``runcommand`` requests can still be interrupted by
@@ -2383,6 +2389,8 @@  User interface controls.
 ``message-output``
     Where to write status and error messages. (default: ``stdio``)
 
+    ``channel``
+      Use separate channel for structured output. (Command-server only)
     ``stderr``
       Everything to stderr.
     ``stdio``