Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commandserver.py @ 45059:f43bc4ce0d69
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.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 28 Jun 2020 17:32:32 +0900 |
parents | d6e99a446eea |
children | d2e1dcd4490d |
comparison
equal
deleted
inserted
replaced
45058:d6e99a446eea | 45059:f43bc4ce0d69 |
---|---|
189 b'cbor': lambda v: b''.join(cborutil.streamencode(v)), | 189 b'cbor': lambda v: b''.join(cborutil.streamencode(v)), |
190 } | 190 } |
191 | 191 |
192 | 192 |
193 def _selectmessageencoder(ui): | 193 def _selectmessageencoder(ui): |
194 # experimental config: cmdserver.message-encodings | |
195 encnames = ui.configlist(b'cmdserver', b'message-encodings') | 194 encnames = ui.configlist(b'cmdserver', b'message-encodings') |
196 for n in encnames: | 195 for n in encnames: |
197 f = _messageencoders.get(n) | 196 f = _messageencoders.get(n) |
198 if f: | 197 if f: |
199 return n, f | 198 return n, f |
232 # switch log stream of server's ui to the 'd' (debug) channel | 231 # switch log stream of server's ui to the 'd' (debug) channel |
233 # (don't touch repo.ui as its lifetime is longer than the server) | 232 # (don't touch repo.ui as its lifetime is longer than the server) |
234 self.ui = self.ui.copy() | 233 self.ui = self.ui.copy() |
235 setuplogging(self.ui, repo=None, fp=self.cdebug) | 234 setuplogging(self.ui, repo=None, fp=self.cdebug) |
236 | 235 |
237 # TODO: add this to help/config.txt when stabilized | |
238 # ``channel`` | |
239 # Use separate channel for structured output. (Command-server only) | |
240 self.cmsg = None | 236 self.cmsg = None |
241 if ui.config(b'ui', b'message-output') == b'channel': | 237 if ui.config(b'ui', b'message-output') == b'channel': |
242 encname, encfn = _selectmessageencoder(ui) | 238 encname, encfn = _selectmessageencoder(ui) |
243 self.cmsg = channeledmessage(fout, b'm', encname, encfn) | 239 self.cmsg = channeledmessage(fout, b'm', encname, encfn) |
244 | 240 |