diff mercurial/scmutil.py @ 17747:aad3bce98f76

store: invoke "osutil.listdir()" via vfs This patch invokes "osutil.listdir()" via vfs object. The function added newly to "abstractvfs" is named not as "listdir()" but as "readdir()", because: - "os.listdir()" seems to be more familiar as "listdir()" than "osutil.listdir()" - "osutil.listdir()" returns also type of each files like "readdir()" POSIX API: even though "d_type" field of "dirent" structure is defined mainly only on BSD/Linux This patch invokes "osutil.listdir()" via "rawvfs" object to avoid filename encoding, because the path passed to "osutil.listdir()" shouldn't be encoded. This patch also omits importing "osutil" module, because it is no longer used.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Tue, 09 Oct 2012 16:17:55 +0900
parents 7cb7e17c23b2
children 76b73ce0ffac
line wrap: on
line diff
--- a/mercurial/scmutil.py	Thu Sep 13 23:50:45 2012 -0700
+++ b/mercurial/scmutil.py	Tue Oct 09 16:17:55 2012 +0900
@@ -219,6 +219,9 @@
     def mkdir(self, path=None):
         return os.mkdir(self.join(path))
 
+    def readdir(self, path=None, stat=None, skip=None):
+        return osutil.listdir(self.join(path), stat, skip)
+
     def stat(self, path=None):
         return os.stat(self.join(path))