comparison mercurial/chgserver.py @ 40842:82210d88d814

commandserver: install logger to record server events through canonical API The global commandserver.log() will be replaced with this.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 10 Nov 2018 19:00:17 +0900
parents c93d046d4300
children eaabcb689747
comparison
equal deleted inserted replaced
40841:368ecbf734af 40842:82210d88d814
217 cmdtable={'attachio': attachio}) 217 cmdtable={'attachio': attachio})
218 return True 218 return True
219 219
220 return chgui(srcui) 220 return chgui(srcui)
221 221
222 def _loadnewui(srcui, args): 222 def _loadnewui(srcui, args, cdebug):
223 from . import dispatch # avoid cycle 223 from . import dispatch # avoid cycle
224 224
225 newui = srcui.__class__.load() 225 newui = srcui.__class__.load()
226 for a in ['fin', 'fout', 'ferr', 'environ']: 226 for a in ['fin', 'fout', 'ferr', 'environ']:
227 setattr(newui, a, getattr(srcui, a)) 227 setattr(newui, a, getattr(srcui, a))
245 cwd = cwd and os.path.realpath(cwd) or None 245 cwd = cwd and os.path.realpath(cwd) or None
246 rpath = options['repository'] 246 rpath = options['repository']
247 path, newlui = dispatch._getlocal(newui, rpath, wd=cwd) 247 path, newlui = dispatch._getlocal(newui, rpath, wd=cwd)
248 248
249 extensions.populateui(newui) 249 extensions.populateui(newui)
250 commandserver.setuplogging(newui, fp=cdebug)
250 if newui is not newlui: 251 if newui is not newlui:
251 extensions.populateui(newlui) 252 extensions.populateui(newlui)
253 commandserver.setuplogging(newlui, fp=cdebug)
252 254
253 return (newui, newlui) 255 return (newui, newlui)
254 256
255 class channeledsystem(object): 257 class channeledsystem(object):
256 """Propagate ui.system() request in the following format: 258 """Propagate ui.system() request in the following format:
421 """ 423 """
422 from . import dispatch # avoid cycle 424 from . import dispatch # avoid cycle
423 425
424 args = self._readlist() 426 args = self._readlist()
425 try: 427 try:
426 self.ui, lui = _loadnewui(self.ui, args) 428 self.ui, lui = _loadnewui(self.ui, args, self.cdebug)
427 except error.ParseError as inst: 429 except error.ParseError as inst:
428 dispatch._formatparse(self.ui.warn, inst) 430 dispatch._formatparse(self.ui.warn, inst)
429 self.ui.flush() 431 self.ui.flush()
430 self.cresult.write('exit 255') 432 self.cresult.write('exit 255')
431 return 433 return