mercurial/commandserver.py
changeset 45058 f43bc4ce0d69
parent 45057 d6e99a446eea
child 45682 d2e1dcd4490d
equal deleted inserted replaced
45057:d6e99a446eea 45058: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