##// END OF EJS Templates
py3: use unicode literals in pure/osutil.py...
Pulkit Goyal -
r29698:f15f3150 default
parent child Browse files
Show More
@@ -1,361 +1,361
1 # osutil.py - pure Python version of osutil.c
1 # osutil.py - pure Python version of osutil.c
2 #
2 #
3 # Copyright 2009 Matt Mackall <mpm@selenic.com> and others
3 # Copyright 2009 Matt Mackall <mpm@selenic.com> and others
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from __future__ import absolute_import
8 from __future__ import absolute_import
9
9
10 import ctypes
10 import ctypes
11 import ctypes.util
11 import ctypes.util
12 import os
12 import os
13 import socket
13 import socket
14 import stat as statmod
14 import stat as statmod
15 import sys
15 import sys
16
16
17 from . import policy
17 from . import policy
18 modulepolicy = policy.policy
18 modulepolicy = policy.policy
19 policynocffi = policy.policynocffi
19 policynocffi = policy.policynocffi
20
20
21 def _mode_to_kind(mode):
21 def _mode_to_kind(mode):
22 if statmod.S_ISREG(mode):
22 if statmod.S_ISREG(mode):
23 return statmod.S_IFREG
23 return statmod.S_IFREG
24 if statmod.S_ISDIR(mode):
24 if statmod.S_ISDIR(mode):
25 return statmod.S_IFDIR
25 return statmod.S_IFDIR
26 if statmod.S_ISLNK(mode):
26 if statmod.S_ISLNK(mode):
27 return statmod.S_IFLNK
27 return statmod.S_IFLNK
28 if statmod.S_ISBLK(mode):
28 if statmod.S_ISBLK(mode):
29 return statmod.S_IFBLK
29 return statmod.S_IFBLK
30 if statmod.S_ISCHR(mode):
30 if statmod.S_ISCHR(mode):
31 return statmod.S_IFCHR
31 return statmod.S_IFCHR
32 if statmod.S_ISFIFO(mode):
32 if statmod.S_ISFIFO(mode):
33 return statmod.S_IFIFO
33 return statmod.S_IFIFO
34 if statmod.S_ISSOCK(mode):
34 if statmod.S_ISSOCK(mode):
35 return statmod.S_IFSOCK
35 return statmod.S_IFSOCK
36 return mode
36 return mode
37
37
38 def listdirpure(path, stat=False, skip=None):
38 def listdirpure(path, stat=False, skip=None):
39 '''listdir(path, stat=False) -> list_of_tuples
39 '''listdir(path, stat=False) -> list_of_tuples
40
40
41 Return a sorted list containing information about the entries
41 Return a sorted list containing information about the entries
42 in the directory.
42 in the directory.
43
43
44 If stat is True, each element is a 3-tuple:
44 If stat is True, each element is a 3-tuple:
45
45
46 (name, type, stat object)
46 (name, type, stat object)
47
47
48 Otherwise, each element is a 2-tuple:
48 Otherwise, each element is a 2-tuple:
49
49
50 (name, type)
50 (name, type)
51 '''
51 '''
52 result = []
52 result = []
53 prefix = path
53 prefix = path
54 if not prefix.endswith(os.sep):
54 if not prefix.endswith(os.sep):
55 prefix += os.sep
55 prefix += os.sep
56 names = os.listdir(path)
56 names = os.listdir(path)
57 names.sort()
57 names.sort()
58 for fn in names:
58 for fn in names:
59 st = os.lstat(prefix + fn)
59 st = os.lstat(prefix + fn)
60 if fn == skip and statmod.S_ISDIR(st.st_mode):
60 if fn == skip and statmod.S_ISDIR(st.st_mode):
61 return []
61 return []
62 if stat:
62 if stat:
63 result.append((fn, _mode_to_kind(st.st_mode), st))
63 result.append((fn, _mode_to_kind(st.st_mode), st))
64 else:
64 else:
65 result.append((fn, _mode_to_kind(st.st_mode)))
65 result.append((fn, _mode_to_kind(st.st_mode)))
66 return result
66 return result
67
67
68 ffi = None
68 ffi = None
69 if modulepolicy not in policynocffi and sys.platform == 'darwin':
69 if modulepolicy not in policynocffi and sys.platform == 'darwin':
70 try:
70 try:
71 from _osutil_cffi import ffi, lib
71 from _osutil_cffi import ffi, lib
72 except ImportError:
72 except ImportError:
73 if modulepolicy == 'cffi': # strict cffi import
73 if modulepolicy == 'cffi': # strict cffi import
74 raise
74 raise
75
75
76 if sys.platform == 'darwin' and ffi is not None:
76 if sys.platform == 'darwin' and ffi is not None:
77 listdir_batch_size = 4096
77 listdir_batch_size = 4096
78 # tweakable number, only affects performance, which chunks
78 # tweakable number, only affects performance, which chunks
79 # of bytes do we get back from getattrlistbulk
79 # of bytes do we get back from getattrlistbulk
80
80
81 attrkinds = [None] * 20 # we need the max no for enum VXXX, 20 is plenty
81 attrkinds = [None] * 20 # we need the max no for enum VXXX, 20 is plenty
82
82
83 attrkinds[lib.VREG] = statmod.S_IFREG
83 attrkinds[lib.VREG] = statmod.S_IFREG
84 attrkinds[lib.VDIR] = statmod.S_IFDIR
84 attrkinds[lib.VDIR] = statmod.S_IFDIR
85 attrkinds[lib.VLNK] = statmod.S_IFLNK
85 attrkinds[lib.VLNK] = statmod.S_IFLNK
86 attrkinds[lib.VBLK] = statmod.S_IFBLK
86 attrkinds[lib.VBLK] = statmod.S_IFBLK
87 attrkinds[lib.VCHR] = statmod.S_IFCHR
87 attrkinds[lib.VCHR] = statmod.S_IFCHR
88 attrkinds[lib.VFIFO] = statmod.S_IFIFO
88 attrkinds[lib.VFIFO] = statmod.S_IFIFO
89 attrkinds[lib.VSOCK] = statmod.S_IFSOCK
89 attrkinds[lib.VSOCK] = statmod.S_IFSOCK
90
90
91 class stat_res(object):
91 class stat_res(object):
92 def __init__(self, st_mode, st_mtime, st_size):
92 def __init__(self, st_mode, st_mtime, st_size):
93 self.st_mode = st_mode
93 self.st_mode = st_mode
94 self.st_mtime = st_mtime
94 self.st_mtime = st_mtime
95 self.st_size = st_size
95 self.st_size = st_size
96
96
97 tv_sec_ofs = ffi.offsetof("struct timespec", "tv_sec")
97 tv_sec_ofs = ffi.offsetof("struct timespec", "tv_sec")
98 buf = ffi.new("char[]", listdir_batch_size)
98 buf = ffi.new("char[]", listdir_batch_size)
99
99
100 def listdirinternal(dfd, req, stat, skip):
100 def listdirinternal(dfd, req, stat, skip):
101 ret = []
101 ret = []
102 while True:
102 while True:
103 r = lib.getattrlistbulk(dfd, req, buf, listdir_batch_size, 0)
103 r = lib.getattrlistbulk(dfd, req, buf, listdir_batch_size, 0)
104 if r == 0:
104 if r == 0:
105 break
105 break
106 if r == -1:
106 if r == -1:
107 raise OSError(ffi.errno, os.strerror(ffi.errno))
107 raise OSError(ffi.errno, os.strerror(ffi.errno))
108 cur = ffi.cast("val_attrs_t*", buf)
108 cur = ffi.cast("val_attrs_t*", buf)
109 for i in range(r):
109 for i in range(r):
110 lgt = cur.length
110 lgt = cur.length
111 assert lgt == ffi.cast('uint32_t*', cur)[0]
111 assert lgt == ffi.cast('uint32_t*', cur)[0]
112 ofs = cur.name_info.attr_dataoffset
112 ofs = cur.name_info.attr_dataoffset
113 str_lgt = cur.name_info.attr_length
113 str_lgt = cur.name_info.attr_length
114 base_ofs = ffi.offsetof('val_attrs_t', 'name_info')
114 base_ofs = ffi.offsetof('val_attrs_t', 'name_info')
115 name = str(ffi.buffer(ffi.cast("char*", cur) + base_ofs + ofs,
115 name = str(ffi.buffer(ffi.cast("char*", cur) + base_ofs + ofs,
116 str_lgt - 1))
116 str_lgt - 1))
117 tp = attrkinds[cur.obj_type]
117 tp = attrkinds[cur.obj_type]
118 if name == "." or name == "..":
118 if name == "." or name == "..":
119 continue
119 continue
120 if skip == name and tp == statmod.S_ISDIR:
120 if skip == name and tp == statmod.S_ISDIR:
121 return []
121 return []
122 if stat:
122 if stat:
123 mtime = cur.time.tv_sec
123 mtime = cur.time.tv_sec
124 mode = (cur.accessmask & ~lib.S_IFMT)| tp
124 mode = (cur.accessmask & ~lib.S_IFMT)| tp
125 ret.append((name, tp, stat_res(st_mode=mode, st_mtime=mtime,
125 ret.append((name, tp, stat_res(st_mode=mode, st_mtime=mtime,
126 st_size=cur.datalength)))
126 st_size=cur.datalength)))
127 else:
127 else:
128 ret.append((name, tp))
128 ret.append((name, tp))
129 cur += lgt
129 cur += lgt
130 return ret
130 return ret
131
131
132 def listdir(path, stat=False, skip=None):
132 def listdir(path, stat=False, skip=None):
133 req = ffi.new("struct attrlist*")
133 req = ffi.new("struct attrlist*")
134 req.bitmapcount = lib.ATTR_BIT_MAP_COUNT
134 req.bitmapcount = lib.ATTR_BIT_MAP_COUNT
135 req.commonattr = (lib.ATTR_CMN_RETURNED_ATTRS |
135 req.commonattr = (lib.ATTR_CMN_RETURNED_ATTRS |
136 lib.ATTR_CMN_NAME |
136 lib.ATTR_CMN_NAME |
137 lib.ATTR_CMN_OBJTYPE |
137 lib.ATTR_CMN_OBJTYPE |
138 lib.ATTR_CMN_ACCESSMASK |
138 lib.ATTR_CMN_ACCESSMASK |
139 lib.ATTR_CMN_MODTIME)
139 lib.ATTR_CMN_MODTIME)
140 req.fileattr = lib.ATTR_FILE_DATALENGTH
140 req.fileattr = lib.ATTR_FILE_DATALENGTH
141 dfd = lib.open(path, lib.O_RDONLY, 0)
141 dfd = lib.open(path, lib.O_RDONLY, 0)
142 if dfd == -1:
142 if dfd == -1:
143 raise OSError(ffi.errno, os.strerror(ffi.errno))
143 raise OSError(ffi.errno, os.strerror(ffi.errno))
144
144
145 try:
145 try:
146 ret = listdirinternal(dfd, req, stat, skip)
146 ret = listdirinternal(dfd, req, stat, skip)
147 finally:
147 finally:
148 try:
148 try:
149 lib.close(dfd)
149 lib.close(dfd)
150 except BaseException:
150 except BaseException:
151 pass # we ignore all the errors from closing, not
151 pass # we ignore all the errors from closing, not
152 # much we can do about that
152 # much we can do about that
153 return ret
153 return ret
154 else:
154 else:
155 listdir = listdirpure
155 listdir = listdirpure
156
156
157 if os.name != 'nt':
157 if os.name != 'nt':
158 posixfile = open
158 posixfile = open
159
159
160 _SCM_RIGHTS = 0x01
160 _SCM_RIGHTS = 0x01
161 _socklen_t = ctypes.c_uint
161 _socklen_t = ctypes.c_uint
162
162
163 if sys.platform == 'linux2':
163 if sys.platform == 'linux2':
164 # socket.h says "the type should be socklen_t but the definition of
164 # socket.h says "the type should be socklen_t but the definition of
165 # the kernel is incompatible with this."
165 # the kernel is incompatible with this."
166 _cmsg_len_t = ctypes.c_size_t
166 _cmsg_len_t = ctypes.c_size_t
167 _msg_controllen_t = ctypes.c_size_t
167 _msg_controllen_t = ctypes.c_size_t
168 _msg_iovlen_t = ctypes.c_size_t
168 _msg_iovlen_t = ctypes.c_size_t
169 else:
169 else:
170 _cmsg_len_t = _socklen_t
170 _cmsg_len_t = _socklen_t
171 _msg_controllen_t = _socklen_t
171 _msg_controllen_t = _socklen_t
172 _msg_iovlen_t = ctypes.c_int
172 _msg_iovlen_t = ctypes.c_int
173
173
174 class _iovec(ctypes.Structure):
174 class _iovec(ctypes.Structure):
175 _fields_ = [
175 _fields_ = [
176 ('iov_base', ctypes.c_void_p),
176 (u'iov_base', ctypes.c_void_p),
177 ('iov_len', ctypes.c_size_t),
177 (u'iov_len', ctypes.c_size_t),
178 ]
178 ]
179
179
180 class _msghdr(ctypes.Structure):
180 class _msghdr(ctypes.Structure):
181 _fields_ = [
181 _fields_ = [
182 ('msg_name', ctypes.c_void_p),
182 (u'msg_name', ctypes.c_void_p),
183 ('msg_namelen', _socklen_t),
183 (u'msg_namelen', _socklen_t),
184 ('msg_iov', ctypes.POINTER(_iovec)),
184 (u'msg_iov', ctypes.POINTER(_iovec)),
185 ('msg_iovlen', _msg_iovlen_t),
185 (u'msg_iovlen', _msg_iovlen_t),
186 ('msg_control', ctypes.c_void_p),
186 (u'msg_control', ctypes.c_void_p),
187 ('msg_controllen', _msg_controllen_t),
187 (u'msg_controllen', _msg_controllen_t),
188 ('msg_flags', ctypes.c_int),
188 (u'msg_flags', ctypes.c_int),
189 ]
189 ]
190
190
191 class _cmsghdr(ctypes.Structure):
191 class _cmsghdr(ctypes.Structure):
192 _fields_ = [
192 _fields_ = [
193 ('cmsg_len', _cmsg_len_t),
193 (u'cmsg_len', _cmsg_len_t),
194 ('cmsg_level', ctypes.c_int),
194 (u'cmsg_level', ctypes.c_int),
195 ('cmsg_type', ctypes.c_int),
195 (u'cmsg_type', ctypes.c_int),
196 ('cmsg_data', ctypes.c_ubyte * 0),
196 (u'cmsg_data', ctypes.c_ubyte * 0),
197 ]
197 ]
198
198
199 _libc = ctypes.CDLL(ctypes.util.find_library('c'), use_errno=True)
199 _libc = ctypes.CDLL(ctypes.util.find_library(u'c'), use_errno=True)
200 _recvmsg = getattr(_libc, 'recvmsg', None)
200 _recvmsg = getattr(_libc, 'recvmsg', None)
201 if _recvmsg:
201 if _recvmsg:
202 _recvmsg.restype = getattr(ctypes, 'c_ssize_t', ctypes.c_long)
202 _recvmsg.restype = getattr(ctypes, 'c_ssize_t', ctypes.c_long)
203 _recvmsg.argtypes = (ctypes.c_int, ctypes.POINTER(_msghdr),
203 _recvmsg.argtypes = (ctypes.c_int, ctypes.POINTER(_msghdr),
204 ctypes.c_int)
204 ctypes.c_int)
205 else:
205 else:
206 # recvmsg isn't always provided by libc; such systems are unsupported
206 # recvmsg isn't always provided by libc; such systems are unsupported
207 def _recvmsg(sockfd, msg, flags):
207 def _recvmsg(sockfd, msg, flags):
208 raise NotImplementedError('unsupported platform')
208 raise NotImplementedError('unsupported platform')
209
209
210 def _CMSG_FIRSTHDR(msgh):
210 def _CMSG_FIRSTHDR(msgh):
211 if msgh.msg_controllen < ctypes.sizeof(_cmsghdr):
211 if msgh.msg_controllen < ctypes.sizeof(_cmsghdr):
212 return
212 return
213 cmsgptr = ctypes.cast(msgh.msg_control, ctypes.POINTER(_cmsghdr))
213 cmsgptr = ctypes.cast(msgh.msg_control, ctypes.POINTER(_cmsghdr))
214 return cmsgptr.contents
214 return cmsgptr.contents
215
215
216 # The pure version is less portable than the native version because the
216 # The pure version is less portable than the native version because the
217 # handling of socket ancillary data heavily depends on C preprocessor.
217 # handling of socket ancillary data heavily depends on C preprocessor.
218 # Also, some length fields are wrongly typed in Linux kernel.
218 # Also, some length fields are wrongly typed in Linux kernel.
219 def recvfds(sockfd):
219 def recvfds(sockfd):
220 """receive list of file descriptors via socket"""
220 """receive list of file descriptors via socket"""
221 dummy = (ctypes.c_ubyte * 1)()
221 dummy = (ctypes.c_ubyte * 1)()
222 iov = _iovec(ctypes.cast(dummy, ctypes.c_void_p), ctypes.sizeof(dummy))
222 iov = _iovec(ctypes.cast(dummy, ctypes.c_void_p), ctypes.sizeof(dummy))
223 cbuf = ctypes.create_string_buffer(256)
223 cbuf = ctypes.create_string_buffer(256)
224 msgh = _msghdr(None, 0,
224 msgh = _msghdr(None, 0,
225 ctypes.pointer(iov), 1,
225 ctypes.pointer(iov), 1,
226 ctypes.cast(cbuf, ctypes.c_void_p), ctypes.sizeof(cbuf),
226 ctypes.cast(cbuf, ctypes.c_void_p), ctypes.sizeof(cbuf),
227 0)
227 0)
228 r = _recvmsg(sockfd, ctypes.byref(msgh), 0)
228 r = _recvmsg(sockfd, ctypes.byref(msgh), 0)
229 if r < 0:
229 if r < 0:
230 e = ctypes.get_errno()
230 e = ctypes.get_errno()
231 raise OSError(e, os.strerror(e))
231 raise OSError(e, os.strerror(e))
232 # assumes that the first cmsg has fds because it isn't easy to write
232 # assumes that the first cmsg has fds because it isn't easy to write
233 # portable CMSG_NXTHDR() with ctypes.
233 # portable CMSG_NXTHDR() with ctypes.
234 cmsg = _CMSG_FIRSTHDR(msgh)
234 cmsg = _CMSG_FIRSTHDR(msgh)
235 if not cmsg:
235 if not cmsg:
236 return []
236 return []
237 if (cmsg.cmsg_level != socket.SOL_SOCKET or
237 if (cmsg.cmsg_level != socket.SOL_SOCKET or
238 cmsg.cmsg_type != _SCM_RIGHTS):
238 cmsg.cmsg_type != _SCM_RIGHTS):
239 return []
239 return []
240 rfds = ctypes.cast(cmsg.cmsg_data, ctypes.POINTER(ctypes.c_int))
240 rfds = ctypes.cast(cmsg.cmsg_data, ctypes.POINTER(ctypes.c_int))
241 rfdscount = ((cmsg.cmsg_len - _cmsghdr.cmsg_data.offset) /
241 rfdscount = ((cmsg.cmsg_len - _cmsghdr.cmsg_data.offset) /
242 ctypes.sizeof(ctypes.c_int))
242 ctypes.sizeof(ctypes.c_int))
243 return [rfds[i] for i in xrange(rfdscount)]
243 return [rfds[i] for i in xrange(rfdscount)]
244
244
245 else:
245 else:
246 import msvcrt
246 import msvcrt
247
247
248 _kernel32 = ctypes.windll.kernel32
248 _kernel32 = ctypes.windll.kernel32
249
249
250 _DWORD = ctypes.c_ulong
250 _DWORD = ctypes.c_ulong
251 _LPCSTR = _LPSTR = ctypes.c_char_p
251 _LPCSTR = _LPSTR = ctypes.c_char_p
252 _HANDLE = ctypes.c_void_p
252 _HANDLE = ctypes.c_void_p
253
253
254 _INVALID_HANDLE_VALUE = _HANDLE(-1).value
254 _INVALID_HANDLE_VALUE = _HANDLE(-1).value
255
255
256 # CreateFile
256 # CreateFile
257 _FILE_SHARE_READ = 0x00000001
257 _FILE_SHARE_READ = 0x00000001
258 _FILE_SHARE_WRITE = 0x00000002
258 _FILE_SHARE_WRITE = 0x00000002
259 _FILE_SHARE_DELETE = 0x00000004
259 _FILE_SHARE_DELETE = 0x00000004
260
260
261 _CREATE_ALWAYS = 2
261 _CREATE_ALWAYS = 2
262 _OPEN_EXISTING = 3
262 _OPEN_EXISTING = 3
263 _OPEN_ALWAYS = 4
263 _OPEN_ALWAYS = 4
264
264
265 _GENERIC_READ = 0x80000000
265 _GENERIC_READ = 0x80000000
266 _GENERIC_WRITE = 0x40000000
266 _GENERIC_WRITE = 0x40000000
267
267
268 _FILE_ATTRIBUTE_NORMAL = 0x80
268 _FILE_ATTRIBUTE_NORMAL = 0x80
269
269
270 # open_osfhandle flags
270 # open_osfhandle flags
271 _O_RDONLY = 0x0000
271 _O_RDONLY = 0x0000
272 _O_RDWR = 0x0002
272 _O_RDWR = 0x0002
273 _O_APPEND = 0x0008
273 _O_APPEND = 0x0008
274
274
275 _O_TEXT = 0x4000
275 _O_TEXT = 0x4000
276 _O_BINARY = 0x8000
276 _O_BINARY = 0x8000
277
277
278 # types of parameters of C functions used (required by pypy)
278 # types of parameters of C functions used (required by pypy)
279
279
280 _kernel32.CreateFileA.argtypes = [_LPCSTR, _DWORD, _DWORD, ctypes.c_void_p,
280 _kernel32.CreateFileA.argtypes = [_LPCSTR, _DWORD, _DWORD, ctypes.c_void_p,
281 _DWORD, _DWORD, _HANDLE]
281 _DWORD, _DWORD, _HANDLE]
282 _kernel32.CreateFileA.restype = _HANDLE
282 _kernel32.CreateFileA.restype = _HANDLE
283
283
284 def _raiseioerror(name):
284 def _raiseioerror(name):
285 err = ctypes.WinError()
285 err = ctypes.WinError()
286 raise IOError(err.errno, '%s: %s' % (name, err.strerror))
286 raise IOError(err.errno, '%s: %s' % (name, err.strerror))
287
287
288 class posixfile(object):
288 class posixfile(object):
289 '''a file object aiming for POSIX-like semantics
289 '''a file object aiming for POSIX-like semantics
290
290
291 CPython's open() returns a file that was opened *without* setting the
291 CPython's open() returns a file that was opened *without* setting the
292 _FILE_SHARE_DELETE flag, which causes rename and unlink to abort.
292 _FILE_SHARE_DELETE flag, which causes rename and unlink to abort.
293 This even happens if any hardlinked copy of the file is in open state.
293 This even happens if any hardlinked copy of the file is in open state.
294 We set _FILE_SHARE_DELETE here, so files opened with posixfile can be
294 We set _FILE_SHARE_DELETE here, so files opened with posixfile can be
295 renamed and deleted while they are held open.
295 renamed and deleted while they are held open.
296 Note that if a file opened with posixfile is unlinked, the file
296 Note that if a file opened with posixfile is unlinked, the file
297 remains but cannot be opened again or be recreated under the same name,
297 remains but cannot be opened again or be recreated under the same name,
298 until all reading processes have closed the file.'''
298 until all reading processes have closed the file.'''
299
299
300 def __init__(self, name, mode='r', bufsize=-1):
300 def __init__(self, name, mode='r', bufsize=-1):
301 if 'b' in mode:
301 if 'b' in mode:
302 flags = _O_BINARY
302 flags = _O_BINARY
303 else:
303 else:
304 flags = _O_TEXT
304 flags = _O_TEXT
305
305
306 m0 = mode[0]
306 m0 = mode[0]
307 if m0 == 'r' and '+' not in mode:
307 if m0 == 'r' and '+' not in mode:
308 flags |= _O_RDONLY
308 flags |= _O_RDONLY
309 access = _GENERIC_READ
309 access = _GENERIC_READ
310 else:
310 else:
311 # work around http://support.microsoft.com/kb/899149 and
311 # work around http://support.microsoft.com/kb/899149 and
312 # set _O_RDWR for 'w' and 'a', even if mode has no '+'
312 # set _O_RDWR for 'w' and 'a', even if mode has no '+'
313 flags |= _O_RDWR
313 flags |= _O_RDWR
314 access = _GENERIC_READ | _GENERIC_WRITE
314 access = _GENERIC_READ | _GENERIC_WRITE
315
315
316 if m0 == 'r':
316 if m0 == 'r':
317 creation = _OPEN_EXISTING
317 creation = _OPEN_EXISTING
318 elif m0 == 'w':
318 elif m0 == 'w':
319 creation = _CREATE_ALWAYS
319 creation = _CREATE_ALWAYS
320 elif m0 == 'a':
320 elif m0 == 'a':
321 creation = _OPEN_ALWAYS
321 creation = _OPEN_ALWAYS
322 flags |= _O_APPEND
322 flags |= _O_APPEND
323 else:
323 else:
324 raise ValueError("invalid mode: %s" % mode)
324 raise ValueError("invalid mode: %s" % mode)
325
325
326 fh = _kernel32.CreateFileA(name, access,
326 fh = _kernel32.CreateFileA(name, access,
327 _FILE_SHARE_READ | _FILE_SHARE_WRITE | _FILE_SHARE_DELETE,
327 _FILE_SHARE_READ | _FILE_SHARE_WRITE | _FILE_SHARE_DELETE,
328 None, creation, _FILE_ATTRIBUTE_NORMAL, None)
328 None, creation, _FILE_ATTRIBUTE_NORMAL, None)
329 if fh == _INVALID_HANDLE_VALUE:
329 if fh == _INVALID_HANDLE_VALUE:
330 _raiseioerror(name)
330 _raiseioerror(name)
331
331
332 fd = msvcrt.open_osfhandle(fh, flags)
332 fd = msvcrt.open_osfhandle(fh, flags)
333 if fd == -1:
333 if fd == -1:
334 _kernel32.CloseHandle(fh)
334 _kernel32.CloseHandle(fh)
335 _raiseioerror(name)
335 _raiseioerror(name)
336
336
337 f = os.fdopen(fd, mode, bufsize)
337 f = os.fdopen(fd, mode, bufsize)
338 # unfortunately, f.name is '<fdopen>' at this point -- so we store
338 # unfortunately, f.name is '<fdopen>' at this point -- so we store
339 # the name on this wrapper. We cannot just assign to f.name,
339 # the name on this wrapper. We cannot just assign to f.name,
340 # because that attribute is read-only.
340 # because that attribute is read-only.
341 object.__setattr__(self, 'name', name)
341 object.__setattr__(self, 'name', name)
342 object.__setattr__(self, '_file', f)
342 object.__setattr__(self, '_file', f)
343
343
344 def __iter__(self):
344 def __iter__(self):
345 return self._file
345 return self._file
346
346
347 def __getattr__(self, name):
347 def __getattr__(self, name):
348 return getattr(self._file, name)
348 return getattr(self._file, name)
349
349
350 def __setattr__(self, name, value):
350 def __setattr__(self, name, value):
351 '''mimics the read-only attributes of Python file objects
351 '''mimics the read-only attributes of Python file objects
352 by raising 'TypeError: readonly attribute' if someone tries:
352 by raising 'TypeError: readonly attribute' if someone tries:
353 f = posixfile('foo.txt')
353 f = posixfile('foo.txt')
354 f.name = 'bla' '''
354 f.name = 'bla' '''
355 return self._file.__setattr__(name, value)
355 return self._file.__setattr__(name, value)
356
356
357 def __enter__(self):
357 def __enter__(self):
358 return self._file.__enter__()
358 return self._file.__enter__()
359
359
360 def __exit__(self, exc_type, exc_value, exc_tb):
360 def __exit__(self, exc_type, exc_value, exc_tb):
361 return self._file.__exit__(exc_type, exc_value, exc_tb)
361 return self._file.__exit__(exc_type, exc_value, exc_tb)
@@ -1,176 +1,174
1 #require test-repo
1 #require test-repo
2
2
3 $ . "$TESTDIR/helpers-testrepo.sh"
3 $ . "$TESTDIR/helpers-testrepo.sh"
4 $ cd "$TESTDIR"/..
4 $ cd "$TESTDIR"/..
5
5
6 $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs python contrib/check-py3-compat.py
6 $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs python contrib/check-py3-compat.py
7 hgext/fsmonitor/pywatchman/__init__.py not using absolute_import
7 hgext/fsmonitor/pywatchman/__init__.py not using absolute_import
8 hgext/fsmonitor/pywatchman/__init__.py requires print_function
8 hgext/fsmonitor/pywatchman/__init__.py requires print_function
9 hgext/fsmonitor/pywatchman/capabilities.py not using absolute_import
9 hgext/fsmonitor/pywatchman/capabilities.py not using absolute_import
10 hgext/fsmonitor/pywatchman/pybser.py not using absolute_import
10 hgext/fsmonitor/pywatchman/pybser.py not using absolute_import
11 i18n/check-translation.py not using absolute_import
11 i18n/check-translation.py not using absolute_import
12 setup.py not using absolute_import
12 setup.py not using absolute_import
13 tests/test-demandimport.py not using absolute_import
13 tests/test-demandimport.py not using absolute_import
14
14
15 #if py3exe
15 #if py3exe
16 $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py
16 $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs $PYTHON3 contrib/check-py3-compat.py
17 doc/hgmanpage.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
17 doc/hgmanpage.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
18 hgext/acl.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
18 hgext/acl.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
19 hgext/automv.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
19 hgext/automv.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
20 hgext/blackbox.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
20 hgext/blackbox.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
21 hgext/bugzilla.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
21 hgext/bugzilla.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
22 hgext/censor.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
22 hgext/censor.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
23 hgext/chgserver.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
23 hgext/chgserver.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
24 hgext/children.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
24 hgext/children.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
25 hgext/churn.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
25 hgext/churn.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
26 hgext/clonebundles.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
26 hgext/clonebundles.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
27 hgext/color.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
27 hgext/color.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
28 hgext/convert/bzr.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
28 hgext/convert/bzr.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
29 hgext/convert/common.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
29 hgext/convert/common.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
30 hgext/convert/convcmd.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
30 hgext/convert/convcmd.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
31 hgext/convert/cvs.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
31 hgext/convert/cvs.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
32 hgext/convert/cvsps.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
32 hgext/convert/cvsps.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
33 hgext/convert/darcs.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
33 hgext/convert/darcs.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
34 hgext/convert/filemap.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
34 hgext/convert/filemap.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
35 hgext/convert/git.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
35 hgext/convert/git.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
36 hgext/convert/gnuarch.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
36 hgext/convert/gnuarch.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
37 hgext/convert/hg.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
37 hgext/convert/hg.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
38 hgext/convert/monotone.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
38 hgext/convert/monotone.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
39 hgext/convert/p4.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
39 hgext/convert/p4.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
40 hgext/convert/subversion.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
40 hgext/convert/subversion.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
41 hgext/convert/transport.py: error importing module: <ImportError> No module named 'svn.client' (line *) (glob)
41 hgext/convert/transport.py: error importing module: <ImportError> No module named 'svn.client' (line *) (glob)
42 hgext/eol.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
42 hgext/eol.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
43 hgext/extdiff.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
43 hgext/extdiff.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
44 hgext/factotum.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
44 hgext/factotum.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
45 hgext/fetch.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
45 hgext/fetch.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
46 hgext/fsmonitor/state.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
46 hgext/fsmonitor/state.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
47 hgext/fsmonitor/watchmanclient.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
47 hgext/fsmonitor/watchmanclient.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
48 hgext/gpg.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
48 hgext/gpg.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
49 hgext/graphlog.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
49 hgext/graphlog.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
50 hgext/hgk.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
50 hgext/hgk.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
51 hgext/highlight/highlight.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
51 hgext/highlight/highlight.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
52 hgext/histedit.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
52 hgext/histedit.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
53 hgext/journal.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
53 hgext/journal.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
54 hgext/keyword.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
54 hgext/keyword.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
55 hgext/largefiles/basestore.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
55 hgext/largefiles/basestore.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
56 hgext/largefiles/lfcommands.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
56 hgext/largefiles/lfcommands.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
57 hgext/largefiles/lfutil.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
57 hgext/largefiles/lfutil.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
58 hgext/largefiles/localstore.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
58 hgext/largefiles/localstore.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
59 hgext/largefiles/overrides.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
59 hgext/largefiles/overrides.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
60 hgext/largefiles/proto.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
60 hgext/largefiles/proto.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
61 hgext/largefiles/remotestore.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
61 hgext/largefiles/remotestore.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
62 hgext/largefiles/reposetup.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
62 hgext/largefiles/reposetup.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
63 hgext/largefiles/storefactory.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
63 hgext/largefiles/storefactory.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
64 hgext/largefiles/uisetup.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
64 hgext/largefiles/uisetup.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
65 hgext/largefiles/wirestore.py: error importing module: <SystemError> Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) (glob)
65 hgext/largefiles/wirestore.py: error importing module: <SystemError> Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) (glob)
66 hgext/mq.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
66 hgext/mq.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
67 hgext/notify.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
67 hgext/notify.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
68 hgext/pager.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
68 hgext/pager.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
69 hgext/patchbomb.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
69 hgext/patchbomb.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
70 hgext/purge.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
70 hgext/purge.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
71 hgext/rebase.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
71 hgext/rebase.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
72 hgext/record.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
72 hgext/record.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
73 hgext/relink.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
73 hgext/relink.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
74 hgext/schemes.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
74 hgext/schemes.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
75 hgext/share.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
75 hgext/share.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
76 hgext/shelve.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
76 hgext/shelve.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
77 hgext/strip.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
77 hgext/strip.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
78 hgext/transplant.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
78 hgext/transplant.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
79 hgext/win32mbcs.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
79 hgext/win32mbcs.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
80 hgext/win32text.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
80 hgext/win32text.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
81 mercurial/archival.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
81 mercurial/archival.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
82 mercurial/bookmarks.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
82 mercurial/bookmarks.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
83 mercurial/branchmap.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
83 mercurial/branchmap.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
84 mercurial/bundle2.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
84 mercurial/bundle2.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
85 mercurial/bundlerepo.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
85 mercurial/bundlerepo.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
86 mercurial/byterange.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
86 mercurial/byterange.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
87 mercurial/changegroup.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
87 mercurial/changegroup.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
88 mercurial/changelog.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
88 mercurial/changelog.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
89 mercurial/cmdutil.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
89 mercurial/cmdutil.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
90 mercurial/commands.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
90 mercurial/commands.py: invalid syntax: invalid syntax (<unknown>, line *) (glob)
91 mercurial/commandserver.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
91 mercurial/commandserver.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
92 mercurial/config.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
92 mercurial/config.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
93 mercurial/context.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
93 mercurial/context.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
94 mercurial/copies.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
94 mercurial/copies.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
95 mercurial/crecord.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
95 mercurial/crecord.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
96 mercurial/dagparser.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
96 mercurial/dagparser.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
97 mercurial/dagutil.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
97 mercurial/dagutil.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
98 mercurial/destutil.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
98 mercurial/destutil.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
99 mercurial/dirstate.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
99 mercurial/dirstate.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
100 mercurial/discovery.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
100 mercurial/discovery.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
101 mercurial/dispatch.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
101 mercurial/dispatch.py: error importing: <TypeError> str expected, not bytes (error at encoding.py:*) (glob)
102 mercurial/exchange.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
102 mercurial/exchange.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
103 mercurial/extensions.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
103 mercurial/extensions.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
104 mercurial/fancyopts.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
104 mercurial/fancyopts.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
105 mercurial/filelog.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
105 mercurial/filelog.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
106 mercurial/filemerge.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
106 mercurial/filemerge.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
107 mercurial/fileset.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
107 mercurial/fileset.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
108 mercurial/formatter.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
108 mercurial/formatter.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
109 mercurial/graphmod.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
109 mercurial/graphmod.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
110 mercurial/hbisect.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
110 mercurial/hbisect.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
111 mercurial/help.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
111 mercurial/help.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
112 mercurial/hg.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
112 mercurial/hg.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
113 mercurial/hgweb/common.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
113 mercurial/hgweb/common.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
114 mercurial/hgweb/hgweb_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
114 mercurial/hgweb/hgweb_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
115 mercurial/hgweb/hgwebdir_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
115 mercurial/hgweb/hgwebdir_mod.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
116 mercurial/hgweb/protocol.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
116 mercurial/hgweb/protocol.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
117 mercurial/hgweb/request.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
117 mercurial/hgweb/request.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
118 mercurial/hgweb/server.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
118 mercurial/hgweb/server.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
119 mercurial/hgweb/webcommands.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
119 mercurial/hgweb/webcommands.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
120 mercurial/hgweb/webutil.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
120 mercurial/hgweb/webutil.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
121 mercurial/hgweb/wsgicgi.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
121 mercurial/hgweb/wsgicgi.py: error importing module: <SystemError> Parent module 'mercurial.hgweb' not loaded, cannot perform relative import (line *) (glob)
122 mercurial/hook.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
122 mercurial/hook.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
123 mercurial/httpconnection.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
123 mercurial/httpconnection.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
124 mercurial/httppeer.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
124 mercurial/httppeer.py: error importing: <TypeError> str expected, not bytes (error at i18n.py:*) (glob)
125 mercurial/keepalive.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
125 mercurial/keepalive.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob)
126 mercurial/localrepo.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
126 mercurial/localrepo.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob)
127 mercurial/lock.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
127 mercurial/lock.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob)
128 mercurial/mail.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
128 mercurial/mail.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob)
129 mercurial/manifest.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob)
129 mercurial/manifest.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob)
130 mercurial/match.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
130 mercurial/match.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob)
131 mercurial/mdiff.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob)
131 mercurial/mdiff.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob)
132 mercurial/merge.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
132 mercurial/merge.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob)
133 mercurial/minirst.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
133 mercurial/minirst.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob)
134 mercurial/namespaces.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
134 mercurial/namespaces.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob)
135 mercurial/obsolete.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob)
135 mercurial/obsolete.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob)
136 mercurial/patch.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
136 mercurial/patch.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob)
137 mercurial/pathutil.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
137 mercurial/pathutil.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob)
138 mercurial/peer.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
138 mercurial/peer.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob)
139 mercurial/pure/mpatch.py: error importing module: <ImportError> cannot import name 'pycompat' (line *) (glob)
139 mercurial/pure/mpatch.py: error importing module: <ImportError> cannot import name 'pycompat' (line *) (glob)
140 mercurial/pure/osutil.py: error importing module: <ImportError> cannot import name 'policy' (line *) (glob)
140 mercurial/pure/osutil.py: error importing module: <ImportError> cannot import name 'policy' (line *) (glob)
141 mercurial/pure/parsers.py: error importing module: <ImportError> No module named 'mercurial.pure.node' (line *) (glob)
141 mercurial/pure/parsers.py: error importing module: <ImportError> No module named 'mercurial.pure.node' (line *) (glob)
142 mercurial/pushkey.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
142 mercurial/pushkey.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob)
143 mercurial/pvec.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
143 mercurial/pvec.py: error importing: <TypeError> getattr(): attribute name must be string (error at pycompat.py:*) (glob)
144 mercurial/registrar.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
144 mercurial/registrar.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
145 mercurial/repair.py: error importing module: <SyntaxError> invalid syntax (bundle2.py, line *) (line *) (glob)
145 mercurial/repair.py: error importing module: <SyntaxError> invalid syntax (bundle2.py, line *) (line *) (glob)
146 mercurial/repoview.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
146 mercurial/repoview.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
147 mercurial/revlog.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
147 mercurial/revlog.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
148 mercurial/revset.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
148 mercurial/revset.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
149 mercurial/scmposix.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
149 mercurial/scmutil.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
150 mercurial/scmutil.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
151 mercurial/scmwindows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob)
150 mercurial/scmwindows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob)
152 mercurial/similar.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
151 mercurial/similar.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
153 mercurial/simplemerge.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
152 mercurial/simplemerge.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
154 mercurial/sshpeer.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
153 mercurial/sshpeer.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
155 mercurial/sshserver.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
154 mercurial/sshserver.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
156 mercurial/sslutil.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
155 mercurial/sslutil.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
157 mercurial/statichttprepo.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
156 mercurial/statichttprepo.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
158 mercurial/store.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
157 mercurial/store.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
159 mercurial/streamclone.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
158 mercurial/streamclone.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
160 mercurial/subrepo.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
159 mercurial/subrepo.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
161 mercurial/tagmerge.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
160 mercurial/tagmerge.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
162 mercurial/tags.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
161 mercurial/tags.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
163 mercurial/templatefilters.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
162 mercurial/templatefilters.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
164 mercurial/templatekw.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
163 mercurial/templatekw.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
165 mercurial/templater.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
164 mercurial/templater.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
166 mercurial/transaction.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
165 mercurial/transaction.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
167 mercurial/ui.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
166 mercurial/ui.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
168 mercurial/unionrepo.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
167 mercurial/unionrepo.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
169 mercurial/url.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
168 mercurial/url.py: error importing: <TypeError> getattr(): attribute name must be string (error at util.py:*) (glob)
170 mercurial/util.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
169 mercurial/verify.py: error importing: <TypeError> attribute name must be string, not 'bytes' (error at mdiff.py:*) (glob)
171 mercurial/verify.py: error importing: <TypeError> '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob)
172 mercurial/win32.py: error importing module: <ImportError> No module named 'msvcrt' (line *) (glob)
170 mercurial/win32.py: error importing module: <ImportError> No module named 'msvcrt' (line *) (glob)
173 mercurial/windows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob)
171 mercurial/windows.py: error importing module: <ImportError> No module named '_winreg' (line *) (glob)
174 mercurial/wireproto.py: error importing module: <SyntaxError> invalid syntax (bundle2.py, line *) (line *) (glob)
172 mercurial/wireproto.py: error importing module: <SyntaxError> invalid syntax (bundle2.py, line *) (line *) (glob)
175
173
176 #endif
174 #endif
General Comments 0
You need to be logged in to leave comments. Login now