pyworker: integrate with fsinfo

Summary:
On Unix, pretend that NTFS doesn't support symlinks. While this isn't
technically true, NTFS on Linux is only used to alleviate performance issues
with `hg update` on Windows. With the pyworker code, I'm expecting these
performance issues to disappear allowing this code to be removed.

Reviewed By: ikostia

Differential Revision: D20527976

fbshipit-source-id: 4194f4b5af065de2e293b41b9d03e9d4ab6ea006
This commit is contained in:
Xavier Deguillard 2020-03-25 12:26:10 -07:00 committed by Facebook GitHub Bot
parent fbff2aaf7c
commit 7a8653cb2e
2 changed files with 10 additions and 3 deletions

View File

@ -13,6 +13,7 @@ anyhow = "1.0.20"
bytes = "0.5"
pyrevisionstore = { path = "../pyrevisionstore" }
crossbeam = "0.7"
fsinfo = { path = "../../../../lib/fsinfo" }
revisionstore = { path = "../../../../lib/revisionstore" }
cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false }
cpython = { version = "0.4", default-features = false }

View File

@ -30,6 +30,7 @@ use cpython::*;
use crossbeam::channel::{bounded, Receiver, Sender};
use cpython_ext::{PyNone, PyPath, ResultPyErrExt};
use fsinfo::{fstype, FsType};
use pyrevisionstore::contentstore;
use revisionstore::ContentStore;
use types::{HgId, Key, RepoPath, RepoPathBuf};
@ -382,9 +383,14 @@ impl VFS {
}
}
fn supports_symlinks(_path: &Path) -> Result<bool> {
// XXX: placeholder
Ok(!cfg!(windows))
/// Since Windows doesn't support symlinks (without Windows' Developer Mode), and NTFS on unices is
/// only used for repos that are intended to be used on Windows, pretend that NTFS doesn't support
/// symlinks. This is of course a lie since unices have no issues supporting symlinks on NTFS.
///
/// Once the need to use NTFS on unices is gone (because this module solves the slowness), this
/// hack will be removed.
fn supports_symlinks(path: &Path) -> Result<bool> {
Ok(fstype(path)? != FsType::NTFS)
}
/// Fetch the content of the passed in `hgid` and write it to `path`.