##// END OF EJS Templates
fix util.copyfile to deal with symlinks
Eric St-Jean -
r4271:1eaa8d90 default
parent child Browse files
Show More
@@ -614,11 +614,18 b' def unlink(f):'
614
614
615 def copyfile(src, dest):
615 def copyfile(src, dest):
616 "copy a file, preserving mode"
616 "copy a file, preserving mode"
617 try:
617 if os.path.islink(src):
618 shutil.copyfile(src, dest)
618 try:
619 shutil.copymode(src, dest)
619 os.unlink(dest)
620 except shutil.Error, inst:
620 except:
621 raise Abort(str(inst))
621 pass
622 os.symlink(os.readlink(src), dest)
623 else:
624 try:
625 shutil.copyfile(src, dest)
626 shutil.copymode(src, dest)
627 except shutil.Error, inst:
628 raise Abort(str(inst))
622
629
623 def copyfiles(src, dst, hardlink=None):
630 def copyfiles(src, dst, hardlink=None):
624 """Copy a directory tree using hardlinks if possible"""
631 """Copy a directory tree using hardlinks if possible"""
General Comments 0
You need to be logged in to leave comments. Login now