mercurial/win32.py
changeset 35512 5cc1becd0493
parent 35510 2062f7c2ac83
child 35549 94a127152e25
--- a/mercurial/win32.py	Sat Dec 30 21:15:12 2017 -0500
+++ b/mercurial/win32.py	Fri Dec 29 22:15:37 2017 -0500
@@ -428,8 +428,9 @@
         raise ctypes.WinError(_ERROR_INSUFFICIENT_BUFFER)
     return buf.value
 
-def getfstype(path):
-    """Get the filesystem type name from a directory or file (best-effort)
+def getvolumename(path):
+    """Get the mount point of the filesystem from a directory or file
+    (best-effort)
 
     Returns None if we are unsure. Raises OSError on ENOENT, EPERM, etc.
     """
@@ -442,7 +443,16 @@
     if not _kernel32.GetVolumePathNameA(realpath, ctypes.byref(buf), size):
         raise ctypes.WinError() # Note: WinError is a function
 
-    t = _kernel32.GetDriveTypeA(buf.value)
+    return buf.value
+
+def getfstype(path):
+    """Get the filesystem type name from a directory or file (best-effort)
+
+    Returns None if we are unsure. Raises OSError on ENOENT, EPERM, etc.
+    """
+    volume = getvolumename(path)
+
+    t = _kernel32.GetDriveTypeA(volume)
 
     if t == _DRIVE_REMOTE:
         return 'cifs'
@@ -453,7 +463,7 @@
     size = 256
     name = ctypes.create_string_buffer(size)
 
-    if not _kernel32.GetVolumeInformationA(buf.value, None, 0, None, None, None,
+    if not _kernel32.GetVolumeInformationA(volume, None, 0, None, None, None,
                                            ctypes.byref(name), size):
         raise ctypes.WinError() # Note: WinError is a function