mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 09:17:30 +03:00
2d3370dca4
Summary: EdenFS on Windows is a bit weird as ProjectedFS is implemented as a filter driver that adds reparse point to all the files/directories to get notified of filesystem operations on them. It then hides these reparse points from the outside which means that the dwAttributes of a file in EdenFS will not claim that a reparse point is attached to it. On top of this, newly created files/directories won't have any reparse points attached to them, until they start being tracked by EdenFS. While the first issue can be solved by always querying the reparse tags, I'm not entirely sure how to solve the second one. That second issue causes Mercurial to always try to create hardlink in the .hg directory, while it shouldn't. Reviewed By: DurhamG Differential Revision: D22937788 fbshipit-source-id: 5d90cd37d40858ed60103ff2d17c2cef16472b38
64 lines
1.6 KiB
Python
64 lines
1.6 KiB
Python
# Portions Copyright (c) Facebook, Inc. and its affiliates.
|
|
#
|
|
# This software may be used and distributed according to the terms of the
|
|
# GNU General Public License version 2.
|
|
|
|
# Copyright Matt Mackall <mpm@selenic.com> and others
|
|
#
|
|
# 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"""
|
|
|
|
from . import pycompat
|
|
|
|
|
|
SYMLINK = "symlink"
|
|
HARDLINK = "hardlink"
|
|
EXECBIT = "execbit"
|
|
ALWAYSCASESENSITIVE = "alwayscasesensitive"
|
|
|
|
_ALL_CAPS = {SYMLINK: True, HARDLINK: True, EXECBIT: True, ALWAYSCASESENSITIVE: True}
|
|
|
|
_EDENFS_POSIX_CAPS = {
|
|
SYMLINK: True,
|
|
HARDLINK: False,
|
|
EXECBIT: True,
|
|
ALWAYSCASESENSITIVE: True,
|
|
}
|
|
|
|
_EDENFS_WINDOWS_CAPS = {
|
|
SYMLINK: False,
|
|
HARDLINK: False,
|
|
EXECBIT: False,
|
|
ALWAYSCASESENSITIVE: False,
|
|
}
|
|
|
|
if pycompat.iswindows:
|
|
_EDENFS_CAPS = _EDENFS_WINDOWS_CAPS
|
|
else:
|
|
_EDENFS_CAPS = _EDENFS_POSIX_CAPS
|
|
|
|
_FS_CAP_TABLE = {
|
|
"APFS": {SYMLINK: True, HARDLINK: True, EXECBIT: True, ALWAYSCASESENSITIVE: False},
|
|
"Btrfs": _ALL_CAPS,
|
|
"EdenFS": _EDENFS_CAPS,
|
|
"ext4": _ALL_CAPS,
|
|
"NTFS": {
|
|
SYMLINK: False,
|
|
HARDLINK: True,
|
|
EXECBIT: False,
|
|
ALWAYSCASESENSITIVE: False,
|
|
},
|
|
"HFS": {SYMLINK: True, HARDLINK: True, EXECBIT: True, ALWAYSCASESENSITIVE: False},
|
|
"XFS": _ALL_CAPS,
|
|
"tmpfs": _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)
|