mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +03:00
4f9e1750c2
Summary: Most of the fixes are pretty trivial as the code was using functions not present on Windows, either work around them, or switch to ones that are multi-platform. Of note, it looks like `hg doctor` doesn't properly detect when Mercurial and EdenFS are out of sync, disabling the tests until we figure out why. Reviewed By: genevievehelsel, fanzeyi Differential Revision: D23409708 fbshipit-source-id: 3314c197d43364dda13891a6874caab4c29e76ca
34 lines
788 B
Python
34 lines
788 B
Python
#!/usr/bin/env python3
|
|
# 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.
|
|
|
|
import abc
|
|
import os
|
|
import shutil
|
|
|
|
from . import util
|
|
|
|
|
|
class FsUtil(abc.ABC):
|
|
@abc.abstractmethod
|
|
def mkdir_p(self, path: str) -> str:
|
|
"""Performs `mkdir -p <path>` and returns the path."""
|
|
|
|
@abc.abstractmethod
|
|
def disk_usage(self, path: str) -> shutil._ntuple_diskusage:
|
|
"""Calls os.statvfs on the mount"""
|
|
|
|
|
|
class RealFsUtil(FsUtil):
|
|
def mkdir_p(self, path: str) -> str:
|
|
return util.mkdir_p(path)
|
|
|
|
def disk_usage(self, path: str) -> shutil._ntuple_diskusage:
|
|
return shutil.disk_usage(path)
|
|
|
|
|
|
def new() -> FsUtil:
|
|
return RealFsUtil()
|