comparison mercurial/chgserver.py @ 37120:a8a902d7176e

procutil: bulk-replace function calls to point to new module
author Yuya Nishihara <yuya@tcha.org>
date Sat, 24 Mar 2018 15:10:51 +0900
parents d4a2e0d5d042
children a93fe297dfb3 1b9be0b26511
comparison
equal deleted inserted replaced
37119:d4a2e0d5d042 37120:a8a902d7176e
203 # (e.g. stderr, cStringIO), because the chg client is not aware of 203 # (e.g. stderr, cStringIO), because the chg client is not aware of
204 # these situations and will behave differently (write to stdout). 204 # these situations and will behave differently (write to stdout).
205 if (out is not self.fout 205 if (out is not self.fout
206 or not util.safehasattr(self.fout, 'fileno') 206 or not util.safehasattr(self.fout, 'fileno')
207 or self.fout.fileno() != procutil.stdout.fileno()): 207 or self.fout.fileno() != procutil.stdout.fileno()):
208 return util.system(cmd, environ=environ, cwd=cwd, out=out) 208 return procutil.system(cmd, environ=environ, cwd=cwd, out=out)
209 self.flush() 209 self.flush()
210 return self._csystem(cmd, util.shellenviron(environ), cwd) 210 return self._csystem(cmd, procutil.shellenviron(environ), cwd)
211 211
212 def _runpager(self, cmd, env=None): 212 def _runpager(self, cmd, env=None):
213 self._csystem(cmd, util.shellenviron(env), type='pager', 213 self._csystem(cmd, procutil.shellenviron(env), type='pager',
214 cmdtable={'attachio': attachio}) 214 cmdtable={'attachio': attachio})
215 return True 215 return True
216 216
217 return chgui(srcui) 217 return chgui(srcui)
218 218
269 self.in_ = in_ 269 self.in_ = in_
270 self.out = out 270 self.out = out
271 self.channel = channel 271 self.channel = channel
272 272
273 def __call__(self, cmd, environ, cwd=None, type='system', cmdtable=None): 273 def __call__(self, cmd, environ, cwd=None, type='system', cmdtable=None):
274 args = [type, util.quotecommand(cmd), os.path.abspath(cwd or '.')] 274 args = [type, procutil.quotecommand(cmd), os.path.abspath(cwd or '.')]
275 args.extend('%s=%s' % (k, v) for k, v in environ.iteritems()) 275 args.extend('%s=%s' % (k, v) for k, v in environ.iteritems())
276 data = '\0'.join(args) 276 data = '\0'.join(args)
277 self.out.write(struct.pack('>cI', self.channel, len(data))) 277 self.out.write(struct.pack('>cI', self.channel, len(data)))
278 self.out.write(data) 278 self.out.write(data)
279 self.out.flush() 279 self.out.flush()
475 'chdir': chdir, 475 'chdir': chdir,
476 'runcommand': runcommand, 476 'runcommand': runcommand,
477 'setenv': setenv, 477 'setenv': setenv,
478 'setumask': setumask}) 478 'setumask': setumask})
479 479
480 if util.safehasattr(util, 'setprocname'): 480 if util.safehasattr(procutil, 'setprocname'):
481 def setprocname(self): 481 def setprocname(self):
482 """Change process title""" 482 """Change process title"""
483 name = self._readstr() 483 name = self._readstr()
484 _log('setprocname: %r\n' % name) 484 _log('setprocname: %r\n' % name)
485 util.setprocname(name) 485 procutil.setprocname(name)
486 capabilities['setprocname'] = setprocname 486 capabilities['setprocname'] = setprocname
487 487
488 def _tempaddress(address): 488 def _tempaddress(address):
489 return '%s.%d.tmp' % (address, os.getpid()) 489 return '%s.%d.tmp' % (address, os.getpid())
490 490