comparison mercurial/windows.py @ 35510:2062f7c2ac83

win32: implement util.getfstype() This will allow NTFS to be added to the hardlink whitelist, and resume creating hardlinks in transactions (which was disabled globally in 07a92bbd02e5; see also e5ce49a30146). I opted to report "cifs" for remote volumes because this shows in `hg debugfs`, which also reports that hardlinks are supported for these volumes. So being able to distinguish it from "unknown" seems useful. The documentation [1] seems to indicate that SMB isn't supported by these functions, but experimenting shows that mapped drives are reported as "NTFS" on Windows 7. I don't have a second Windows machine, but instead shared a temp directory on C:\. In this setup, both of the following were detected as 'cifs' with the explicit GetDriveType() check: Z:\repo>hg ci -A C:\>hg -R \\hostname\temp\repo ci -A # (without Z:\ being mapped) It looks like this is called 6 times to add and commit a single new file, so I'm a little surprised this isn't cached. [1] https://msdn.microsoft.com/en-us/library/windows/desktop/aa364993(v=vs.85).aspx
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 29 Dec 2017 21:28:19 -0500
parents beede158ea8a
children c4caf530b1c7
comparison
equal deleted inserted replaced
35509:beede158ea8a 35510:2062f7c2ac83
30 import winreg 30 import winreg
31 31
32 osutil = policy.importmod(r'osutil') 32 osutil = policy.importmod(r'osutil')
33 33
34 executablepath = win32.executablepath 34 executablepath = win32.executablepath
35 getfstype = win32.getfstype
35 getuser = win32.getuser 36 getuser = win32.getuser
36 hidewindow = win32.hidewindow 37 hidewindow = win32.hidewindow
37 makedir = win32.makedir 38 makedir = win32.makedir
38 nlinks = win32.nlinks 39 nlinks = win32.nlinks
39 oslink = win32.oslink 40 oslink = win32.oslink
223 def checkexec(path): 224 def checkexec(path):
224 return False 225 return False
225 226
226 def checklink(path): 227 def checklink(path):
227 return False 228 return False
228
229 def getfstype(dirpath):
230 '''Get the filesystem type name from a directory (best-effort)
231
232 Returns None if we are unsure. Raises OSError on ENOENT, EPERM, etc.
233 '''
234 return None
235 229
236 def setbinary(fd): 230 def setbinary(fd):
237 # When run without console, pipes may expose invalid 231 # When run without console, pipes may expose invalid
238 # fileno(), usually set to -1. 232 # fileno(), usually set to -1.
239 fno = getattr(fd, 'fileno', None) 233 fno = getattr(fd, 'fileno', None)