diff mercurial/util.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 4462a981e8df
children 2959c3e986e0
line wrap: on
line diff
--- a/mercurial/util.py	Wed Apr 26 22:05:59 2017 +0900
+++ b/mercurial/util.py	Wed Apr 26 22:26:28 2017 +0900
@@ -106,6 +106,7 @@
 hidewindow = platform.hidewindow
 isexec = platform.isexec
 isowner = platform.isowner
+listdir = osutil.listdir
 localpath = platform.localpath
 lookupreg = platform.lookupreg
 makedir = platform.makedir
@@ -143,6 +144,15 @@
 unlink = platform.unlink
 username = platform.username
 
+try:
+    recvfds = osutil.recvfds
+except AttributeError:
+    pass
+try:
+    setprocname = osutil.setprocname
+except AttributeError:
+    pass
+
 # Python compatibility
 
 _notset = object()
@@ -1165,7 +1175,7 @@
                         os.stat(os.path.dirname(dst)).st_dev)
         topic = gettopic()
         os.mkdir(dst)
-        for name, kind in osutil.listdir(src):
+        for name, kind in listdir(src):
             srcname = os.path.join(src, name)
             dstname = os.path.join(dst, name)
             def nprog(t, pos):