comparison mercurial/util.py @ 35513: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 8652ab4046e4
children d8f408d999f9
comparison
equal deleted inserted replaced
35512:9b3f95d9783d 35513:beede158ea8a
107 copymode = platform.copymode 107 copymode = platform.copymode
108 executablepath = platform.executablepath 108 executablepath = platform.executablepath
109 expandglobs = platform.expandglobs 109 expandglobs = platform.expandglobs
110 explainexit = platform.explainexit 110 explainexit = platform.explainexit
111 findexe = platform.findexe 111 findexe = platform.findexe
112 getfstype = platform.getfstype
112 gethgcmd = platform.gethgcmd 113 gethgcmd = platform.gethgcmd
113 getuser = platform.getuser 114 getuser = platform.getuser
114 getpid = os.getpid 115 getpid = os.getpid
115 groupmembers = platform.groupmembers 116 groupmembers = platform.groupmembers
116 groupname = platform.groupname 117 groupname = platform.groupname
1516 1517
1517 result.append(found or part) 1518 result.append(found or part)
1518 dir = os.path.join(dir, part) 1519 dir = os.path.join(dir, part)
1519 1520
1520 return ''.join(result) 1521 return ''.join(result)
1521
1522 def getfstype(dirpath):
1523 '''Get the filesystem type name from a directory (best-effort)
1524
1525 Returns None if we are unsure. Raises OSError on ENOENT, EPERM, etc.
1526 '''
1527 return getattr(osutil, 'getfstype', lambda x: None)(dirpath)
1528 1522
1529 def checknlink(testfile): 1523 def checknlink(testfile):
1530 '''check whether hardlink count reporting works properly''' 1524 '''check whether hardlink count reporting works properly'''
1531 1525
1532 # testfile may be open, so we need a separate file for checking to 1526 # testfile may be open, so we need a separate file for checking to