##// END OF EJS Templates
copyfile: allow optional hardlinking...
Pierre-Yves David -
r23899:4e451d13 default
parent child Browse files
Show More
@@ -716,10 +716,16 b' def checksignature(func):'
716
716
717 return check
717 return check
718
718
719 def copyfile(src, dest):
719 def copyfile(src, dest, hardlink=False):
720 "copy a file, preserving mode and atime/mtime"
720 "copy a file, preserving mode and atime/mtime"
721 if os.path.lexists(dest):
721 if os.path.lexists(dest):
722 unlink(dest)
722 unlink(dest)
723 if hardlink:
724 try:
725 oslink(src, dest)
726 return
727 except (IOError, OSError):
728 pass # fall back to normal copy
723 if os.path.islink(src):
729 if os.path.islink(src):
724 os.symlink(os.readlink(src), dest)
730 os.symlink(os.readlink(src), dest)
725 else:
731 else:
General Comments 0
You need to be logged in to leave comments. Login now