Mercurial > hg
changeset 35509:beede158ea8a
util: move getfstype() to the platform modules
This makes room for implementing on Windows using ctypes.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Sat, 30 Dec 2017 21:07:03 -0500 |
parents | 9b3f95d9783d |
children | 2062f7c2ac83 |
files | mercurial/posix.py mercurial/util.py mercurial/windows.py |
diffstat | 3 files changed, 18 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/posix.py Fri Dec 22 23:17:04 2017 +0800 +++ b/mercurial/posix.py Sat Dec 30 21:07:03 2017 -0500 @@ -24,9 +24,12 @@ from . import ( encoding, error, + policy, pycompat, ) +osutil = policy.importmod(r'osutil') + posixfile = open normpath = os.path.normpath samestat = os.path.samestat @@ -302,6 +305,13 @@ Returns None if the path is ok, or a UI string describing the problem.''' return None # on posix platforms, every path is ok +def getfstype(dirpath): + '''Get the filesystem type name from a directory (best-effort) + + Returns None if we are unsure. Raises OSError on ENOENT, EPERM, etc. + ''' + return getattr(osutil, 'getfstype', lambda x: None)(dirpath) + def setbinary(fd): pass
--- a/mercurial/util.py Fri Dec 22 23:17:04 2017 +0800 +++ b/mercurial/util.py Sat Dec 30 21:07:03 2017 -0500 @@ -109,6 +109,7 @@ expandglobs = platform.expandglobs explainexit = platform.explainexit findexe = platform.findexe +getfstype = platform.getfstype gethgcmd = platform.gethgcmd getuser = platform.getuser getpid = os.getpid @@ -1519,13 +1520,6 @@ return ''.join(result) -def getfstype(dirpath): - '''Get the filesystem type name from a directory (best-effort) - - Returns None if we are unsure. Raises OSError on ENOENT, EPERM, etc. - ''' - return getattr(osutil, 'getfstype', lambda x: None)(dirpath) - def checknlink(testfile): '''check whether hardlink count reporting works properly'''
--- a/mercurial/windows.py Fri Dec 22 23:17:04 2017 +0800 +++ b/mercurial/windows.py Sat Dec 30 21:07:03 2017 -0500 @@ -226,6 +226,13 @@ def checklink(path): return False +def getfstype(dirpath): + '''Get the filesystem type name from a directory (best-effort) + + Returns None if we are unsure. Raises OSError on ENOENT, EPERM, etc. + ''' + return None + def setbinary(fd): # When run without console, pipes may expose invalid # fileno(), usually set to -1.