# HG changeset patch # User Adrian Buehlmann # Date 2011-01-26 18:14:30 # Node ID 035684c6b69ad03813cbe5c026bee82eb428f753 # Parent d0e0d3d43e1439d63564ab4dddfe0daa69ae2d86 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) diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -913,6 +913,8 @@ class opener(object): # shares if the file is open. fd = open(f) nlink = nlinks(f) + if nlink < 1: + nlink = 2 # force mktempcopy (issue1922) fd.close() except (OSError, IOError): nlink = 0