comparison mercurial/util.py @ 32208: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 4462a981e8df
children 2959c3e986e0
comparison
equal deleted inserted replaced
32203:0c73634d0570 32208:d74b0cff94a9
104 groupmembers = platform.groupmembers 104 groupmembers = platform.groupmembers
105 groupname = platform.groupname 105 groupname = platform.groupname
106 hidewindow = platform.hidewindow 106 hidewindow = platform.hidewindow
107 isexec = platform.isexec 107 isexec = platform.isexec
108 isowner = platform.isowner 108 isowner = platform.isowner
109 listdir = osutil.listdir
109 localpath = platform.localpath 110 localpath = platform.localpath
110 lookupreg = platform.lookupreg 111 lookupreg = platform.lookupreg
111 makedir = platform.makedir 112 makedir = platform.makedir
112 nlinks = platform.nlinks 113 nlinks = platform.nlinks
113 normpath = platform.normpath 114 normpath = platform.normpath
140 statislink = platform.statislink 141 statislink = platform.statislink
141 testpid = platform.testpid 142 testpid = platform.testpid
142 umask = platform.umask 143 umask = platform.umask
143 unlink = platform.unlink 144 unlink = platform.unlink
144 username = platform.username 145 username = platform.username
146
147 try:
148 recvfds = osutil.recvfds
149 except AttributeError:
150 pass
151 try:
152 setprocname = osutil.setprocname
153 except AttributeError:
154 pass
145 155
146 # Python compatibility 156 # Python compatibility
147 157
148 _notset = object() 158 _notset = object()
149 159
1163 if hardlink is None: 1173 if hardlink is None:
1164 hardlink = (os.stat(src).st_dev == 1174 hardlink = (os.stat(src).st_dev ==
1165 os.stat(os.path.dirname(dst)).st_dev) 1175 os.stat(os.path.dirname(dst)).st_dev)
1166 topic = gettopic() 1176 topic = gettopic()
1167 os.mkdir(dst) 1177 os.mkdir(dst)
1168 for name, kind in osutil.listdir(src): 1178 for name, kind in listdir(src):
1169 srcname = os.path.join(src, name) 1179 srcname = os.path.join(src, name)
1170 dstname = os.path.join(dst, name) 1180 dstname = os.path.join(dst, name)
1171 def nprog(t, pos): 1181 def nprog(t, pos):
1172 if pos is not None: 1182 if pos is not None:
1173 return progress(t, pos + num) 1183 return progress(t, pos + num)