diff --git a/mercurial/posix.py b/mercurial/posix.py --- a/mercurial/posix.py +++ b/mercurial/posix.py @@ -305,6 +305,13 @@ def checkosfilename(path): Returns None if the path is ok, or a UI string describing the problem.''' return None # on posix platforms, every path is ok +def getfsmountpoint(dirpath): + '''Get the filesystem mount point from a directory (best-effort) + + Returns None if we are unsure. Raises OSError on ENOENT, EPERM, etc. + ''' + return getattr(osutil, 'getfsmountpoint', lambda x: None)(dirpath) + def getfstype(dirpath): '''Get the filesystem type name from a directory (best-effort) diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -109,6 +109,7 @@ executablepath = platform.executablepath expandglobs = platform.expandglobs explainexit = platform.explainexit findexe = platform.findexe +getfsmountpoint = platform.getfsmountpoint getfstype = platform.getfstype gethgcmd = platform.gethgcmd getuser = platform.getuser diff --git a/mercurial/windows.py b/mercurial/windows.py --- a/mercurial/windows.py +++ b/mercurial/windows.py @@ -32,6 +32,7 @@ except ImportError: osutil = policy.importmod(r'osutil') executablepath = win32.executablepath +getfsmountpoint = win32.getvolumename getfstype = win32.getfstype getuser = win32.getuser hidewindow = win32.hidewindow