--- a/mercurial/util.py Fri Mar 23 14:11:31 2007 -0700
+++ b/mercurial/util.py Wed Mar 21 23:20:56 2007 -0400
@@ -614,11 +614,18 @@
def copyfile(src, dest):
"copy a file, preserving mode"
- try:
- shutil.copyfile(src, dest)
- shutil.copymode(src, dest)
- except shutil.Error, inst:
- raise Abort(str(inst))
+ if os.path.islink(src):
+ try:
+ os.unlink(dest)
+ except:
+ pass
+ os.symlink(os.readlink(src), dest)
+ else:
+ try:
+ shutil.copyfile(src, dest)
+ shutil.copymode(src, dest)
+ except shutil.Error, inst:
+ raise Abort(str(inst))
def copyfiles(src, dst, hardlink=None):
"""Copy a directory tree using hardlinks if possible"""