comparison mercurial/chgserver.py @ 32248:d74b0cff94a9

osutil: proxy through util (and platform) modules (API) See the previous commit for why. Marked as API change since osutil.listdir() seems widely used in third-party extensions. The win32mbcs extension is updated to wrap both util. and windows. aliases.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 26 Apr 2017 22:26:28 +0900
parents e518192d6bac
children c8b9943c07eb
comparison
equal deleted inserted replaced
32247:0c73634d0570 32248:d74b0cff94a9
52 from . import ( 52 from . import (
53 commandserver, 53 commandserver,
54 encoding, 54 encoding,
55 error, 55 error,
56 extensions, 56 extensions,
57 osutil,
58 pycompat, 57 pycompat,
59 util, 58 util,
60 ) 59 )
61 60
62 _log = commandserver.log 61 _log = commandserver.log
311 channels except cresult will no longer be used 310 channels except cresult will no longer be used
312 """ 311 """
313 # tell client to sendmsg() with 1-byte payload, which makes it 312 # tell client to sendmsg() with 1-byte payload, which makes it
314 # distinctive from "attachio\n" command consumed by client.read() 313 # distinctive from "attachio\n" command consumed by client.read()
315 self.clientsock.sendall(struct.pack('>cI', 'I', 1)) 314 self.clientsock.sendall(struct.pack('>cI', 'I', 1))
316 clientfds = osutil.recvfds(self.clientsock.fileno()) 315 clientfds = util.recvfds(self.clientsock.fileno())
317 _log('received fds: %r\n' % clientfds) 316 _log('received fds: %r\n' % clientfds)
318 317
319 ui = self.ui 318 ui = self.ui
320 ui.flush() 319 ui.flush()
321 first = self._saveio() 320 first = self._saveio()
456 'chdir': chdir, 455 'chdir': chdir,
457 'runcommand': runcommand, 456 'runcommand': runcommand,
458 'setenv': setenv, 457 'setenv': setenv,
459 'setumask': setumask}) 458 'setumask': setumask})
460 459
461 if util.safehasattr(osutil, 'setprocname'): 460 if util.safehasattr(util, 'setprocname'):
462 def setprocname(self): 461 def setprocname(self):
463 """Change process title""" 462 """Change process title"""
464 name = self._readstr() 463 name = self._readstr()
465 _log('setprocname: %r\n' % name) 464 _log('setprocname: %r\n' % name)
466 osutil.setprocname(name) 465 util.setprocname(name)
467 capabilities['setprocname'] = setprocname 466 capabilities['setprocname'] = setprocname
468 467
469 def _tempaddress(address): 468 def _tempaddress(address):
470 return '%s.%d.tmp' % (address, os.getpid()) 469 return '%s.%d.tmp' % (address, os.getpid())
471 470