mercurial/chgserver.py
changeset 52643 5cc8deb96b48
parent 51859 f4733654f144
child 52744 25b344f2aeef
equal deleted inserted replaced
52642:73ab542565e0 52643:5cc8deb96b48
   221 
   221 
   222 
   222 
   223 def _newchgui(srcui, csystem, attachio):
   223 def _newchgui(srcui, csystem, attachio):
   224     class chgui(srcui.__class__):
   224     class chgui(srcui.__class__):
   225         def __init__(self, src=None):
   225         def __init__(self, src=None):
   226             super(chgui, self).__init__(src)
   226             super().__init__(src)
   227             if src:
   227             if src:
   228                 self._csystem = getattr(src, '_csystem', csystem)
   228                 self._csystem = getattr(src, '_csystem', csystem)
   229             else:
   229             else:
   230                 self._csystem = csystem
   230                 self._csystem = csystem
   231 
   231 
   357 
   357 
   358 class chgcmdserver(commandserver.server):
   358 class chgcmdserver(commandserver.server):
   359     def __init__(
   359     def __init__(
   360         self, ui, repo, fin, fout, sock, prereposetups, hashstate, baseaddress
   360         self, ui, repo, fin, fout, sock, prereposetups, hashstate, baseaddress
   361     ):
   361     ):
   362         super(chgcmdserver, self).__init__(
   362         super().__init__(
   363             _newchgui(ui, channeledsystem(fin, fout, b'S'), self.attachio),
   363             _newchgui(ui, channeledsystem(fin, fout, b'S'), self.attachio),
   364             repo,
   364             repo,
   365             fin,
   365             fin,
   366             fout,
   366             fout,
   367             prereposetups,
   367             prereposetups,
   374         if hashstate is not None:
   374         if hashstate is not None:
   375             self.capabilities = self.capabilities.copy()
   375             self.capabilities = self.capabilities.copy()
   376             self.capabilities[b'validate'] = chgcmdserver.validate
   376             self.capabilities[b'validate'] = chgcmdserver.validate
   377 
   377 
   378     def cleanup(self):
   378     def cleanup(self):
   379         super(chgcmdserver, self).cleanup()
   379         super().cleanup()
   380         # dispatch._runcatch() does not flush outputs if exception is not
   380         # dispatch._runcatch() does not flush outputs if exception is not
   381         # handled by dispatch._dispatch()
   381         # handled by dispatch._dispatch()
   382         self.ui.flush()
   382         self.ui.flush()
   383         self._restoreio()
   383         self._restoreio()
   384         self._ioattached = False
   384         self._ioattached = False
   570         # be detached at the end of the session. otherwise the pager wouldn't
   570         # be detached at the end of the session. otherwise the pager wouldn't
   571         # receive EOF.
   571         # receive EOF.
   572         globaloldios = self._oldios
   572         globaloldios = self._oldios
   573         self._oldios = []
   573         self._oldios = []
   574         try:
   574         try:
   575             return super(chgcmdserver, self).runcommand()
   575             return super().runcommand()
   576         finally:
   576         finally:
   577             self._restoreio()
   577             self._restoreio()
   578             self._oldios = globaloldios
   578             self._oldios = globaloldios
   579 
   579 
   580     def setenv(self):
   580     def setenv(self):