Mercurial > public > mercurial-scm > hg-stable
diff mercurial/util.py @ 18326:614f769e6aa7
util: copyfile: remove dest before copying
This prevents spurious problems writing to locked files on Windows.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Thu, 10 Jan 2013 00:44:23 +0100 |
parents | ddc0323db78b |
children | ae60735e37d2 |
line wrap: on
line diff
--- a/mercurial/util.py Tue Jan 15 01:05:11 2013 +0100 +++ b/mercurial/util.py Thu Jan 10 00:44:23 2013 +0100 @@ -482,11 +482,9 @@ def copyfile(src, dest): "copy a file, preserving mode and atime/mtime" + if os.path.lexists(dest): + unlink(dest) if os.path.islink(src): - try: - os.unlink(dest) - except OSError: - pass os.symlink(os.readlink(src), dest) else: try: