comparison mercurial/util.py @ 25211:22f4ce49044d

util: drop the 'unpacker' helper It is not helping anything anymore.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 18 May 2015 23:43:36 -0500
parents b58dde1bb32f
children 504ef9c49f4a
comparison
equal deleted inserted replaced
25210:b58dde1bb32f 25211:22f4ce49044d
17 _ = i18n._ 17 _ = i18n._
18 import error, osutil, encoding, parsers 18 import error, osutil, encoding, parsers
19 import errno, shutil, sys, tempfile, traceback 19 import errno, shutil, sys, tempfile, traceback
20 import re as remod 20 import re as remod
21 import os, time, datetime, calendar, textwrap, signal, collections 21 import os, time, datetime, calendar, textwrap, signal, collections
22 import imp, socket, urllib, struct 22 import imp, socket, urllib
23 import gc 23 import gc
24 24
25 if os.name == 'nt': 25 if os.name == 'nt':
26 import windows as platform 26 import windows as platform
27 else: 27 else:
230 return memoryview(sliceable)[offset:] 230 return memoryview(sliceable)[offset:]
231 231
232 import subprocess 232 import subprocess
233 closefds = os.name == 'posix' 233 closefds = os.name == 'posix'
234 234
235 def unpacker(fmt):
236 """create a struct unpacker for the specified format"""
237 return struct.Struct(fmt).unpack
238
239 def popen2(cmd, env=None, newlines=False): 235 def popen2(cmd, env=None, newlines=False):
240 # Setting bufsize to -1 lets the system decide the buffer size. 236 # Setting bufsize to -1 lets the system decide the buffer size.
241 # The default for bufsize is 0, meaning unbuffered. This leads to 237 # The default for bufsize is 0, meaning unbuffered. This leads to
242 # poor performance on Mac OS X: http://bugs.python.org/issue4194 238 # poor performance on Mac OS X: http://bugs.python.org/issue4194
243 p = subprocess.Popen(cmd, shell=True, bufsize=-1, 239 p = subprocess.Popen(cmd, shell=True, bufsize=-1,