Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/util.py @ 13305:035684c6b69a stable
opener: force copy on 'a'ppend if nlinks() returns 0 (issue1922)
If pywin32 is not installed, 'os.lstat(pathname).st_nlink' is used for
nlinks(), which is always zero for all files on Windows.
To make sure we break up hardlinks if pywin32 is missing, we force
nlink = 2 if nlinks() returns < 1.
(this completely fixes issue1922)
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Wed, 26 Jan 2011 19:14:30 +0100 |
parents | e3bf16703e26 |
children | 0c493e5ce8e9 |
comparison
equal
deleted
inserted
replaced
13287:d0e0d3d43e14 | 13305:035684c6b69a |
---|---|
911 else: | 911 else: |
912 # nlinks() may behave differently for files on Windows | 912 # nlinks() may behave differently for files on Windows |
913 # shares if the file is open. | 913 # shares if the file is open. |
914 fd = open(f) | 914 fd = open(f) |
915 nlink = nlinks(f) | 915 nlink = nlinks(f) |
916 if nlink < 1: | |
917 nlink = 2 # force mktempcopy (issue1922) | |
916 fd.close() | 918 fd.close() |
917 except (OSError, IOError): | 919 except (OSError, IOError): |
918 nlink = 0 | 920 nlink = 0 |
919 if not os.path.isdir(dirname): | 921 if not os.path.isdir(dirname): |
920 makedirs(dirname, self.createmode) | 922 makedirs(dirname, self.createmode) |