comparison mercurial/util.py @ 31593:ae02cc1f5369

util: add a getfstype method The util version is a thin wrapper of the osutil version, which is not always available.
author Jun Wu <quark@fb.com>
date Thu, 23 Mar 2017 11:58:45 -0700
parents e7a02e9ad162
children 4a1bf30f5438
comparison
equal deleted inserted replaced
31592:c5d924e5dfdb 31593:ae02cc1f5369
1364 1364
1365 result.append(found or part) 1365 result.append(found or part)
1366 dir = os.path.join(dir, part) 1366 dir = os.path.join(dir, part)
1367 1367
1368 return ''.join(result) 1368 return ''.join(result)
1369
1370 def getfstype(dirpath):
1371 '''Get the filesystem type name from a directory (best-effort)
1372
1373 Returns None if we are unsure, or errors like ENOENT, EPERM happen.
1374 '''
1375 return getattr(osutil, 'getfstype', lambda x: None)(dirpath)
1369 1376
1370 def checknlink(testfile): 1377 def checknlink(testfile):
1371 '''check whether hardlink count reporting works properly''' 1378 '''check whether hardlink count reporting works properly'''
1372 1379
1373 # testfile may be open, so we need a separate file for checking to 1380 # testfile may be open, so we need a separate file for checking to