sapling/edenscm/mercurial/fscap.py
Jun Wu dbc9a9f3e6 fscap: mark "fuse.ntfs" (ntfs-3g) as not supporting symlinks
Summary: See D13964546 for context.

Reviewed By: DurhamG, ikostia

Differential Revision: D13982878

fbshipit-source-id: abce6f3c005b916cfb2e7a34276b99f9fcaa44b5
2019-02-06 18:34:30 -08:00

43 lines
1.2 KiB
Python

# Copyright Facebook, Inc. 2018
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
"""capabilities of well-known filesystems"""
SYMLINK = "symlink"
HARDLINK = "hardlink"
EXECBIT = "execbit"
ALWAYSCASESENSITIVE = "alwayscasesensitive"
_ALL_CAPS = {SYMLINK: True, HARDLINK: True, EXECBIT: True, ALWAYSCASESENSITIVE: True}
_FS_CAP_TABLE = {
"apfs": {SYMLINK: True, HARDLINK: True, EXECBIT: True, ALWAYSCASESENSITIVE: False},
"btrfs": _ALL_CAPS,
"eden": {SYMLINK: True, HARDLINK: False, EXECBIT: True, ALWAYSCASESENSITIVE: True},
"ext2": _ALL_CAPS,
"ext3": _ALL_CAPS,
"ext4": _ALL_CAPS,
"fuse.ntfs": {
SYMLINK: False,
HARDLINK: True,
EXECBIT: False,
ALWAYSCASESENSITIVE: False,
},
"hfs": {SYMLINK: True, HARDLINK: True, EXECBIT: True, ALWAYSCASESENSITIVE: False},
"jfs": _ALL_CAPS,
"reiserfs": _ALL_CAPS,
"tmpfs": _ALL_CAPS,
"ufs": _ALL_CAPS,
"xfs": _ALL_CAPS,
"zfs": _ALL_CAPS,
}
def getfscap(fstype, cap):
"""Test if a filesystem has specified capability.
Return True if it has, False if it doesn't, or None if unsure.
"""
return _FS_CAP_TABLE.get(fstype, {}).get(cap)