[PATCH 1 of 3] util: add a getfstype method
Jun Wu
quark at fb.com
Thu Mar 23 19:07:44 UTC 2017
# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1490295525 25200
# Thu Mar 23 11:58:45 2017 -0700
# Node ID 235f1212559d03f115e21992b5725a7dc7787632
# Parent 2c02bb7fd7fc1212029dc903527e35a9efb7dbe1
# Available At https://bitbucket.org/quark-zju/hg-draft
# hg pull https://bitbucket.org/quark-zju/hg-draft -r 235f1212559d
util: add a getfstype method
The util version is a thin wrapper of the osutil version, which is not
always available.
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1368,4 +1368,11 @@ def fspath(name, root):
return ''.join(result)
+def getfstype(dirpath):
+ '''Get the filesystem type name from a directory (best-effort)
+
+ Returns None if we are unsure, or errors like ENOENT, EPERM happen.
+ '''
+ return getattr(osutil, 'getfstype', lambda x: None)(dirpath)
+
def checknlink(testfile):
'''check whether hardlink count reporting works properly'''
More information about the Mercurial-devel
mailing list