mercurial/win32.py
branchstable
changeset 10219 3b94120864fc
parent 10218 750b7a4f01f6
child 10240 3af4b39afe2a
child 10263 25e572394f5c
equal deleted inserted replaced
10218:750b7a4f01f6 10219:3b94120864fc
    41     """Return number of hardlinks for the given file."""
    41     """Return number of hardlinks for the given file."""
    42     try:
    42     try:
    43         fh = win32file.CreateFile(pathname,
    43         fh = win32file.CreateFile(pathname,
    44             win32file.GENERIC_READ, win32file.FILE_SHARE_READ,
    44             win32file.GENERIC_READ, win32file.FILE_SHARE_READ,
    45             None, win32file.OPEN_EXISTING, 0, None)
    45             None, win32file.OPEN_EXISTING, 0, None)
    46         res = win32file.GetFileInformationByHandle(fh)
    46         try:
    47         fh.Close()
    47             return win32file.GetFileInformationByHandle(fh)
    48         return res
    48         finally:
       
    49             fh.Close()
    49     except pywintypes.error:
    50     except pywintypes.error:
    50         return None
    51         return None
    51 
    52 
    52 def nlinks(pathname):
    53 def nlinks(pathname):
    53     """Return number of hardlinks for the given file."""
    54     """Return number of hardlinks for the given file."""