mercurial/util.py
changeset 18326 614f769e6aa7
parent 18026 ddc0323db78b
child 18537 ae60735e37d2
equal deleted inserted replaced
18325:297bf69966a0 18326:614f769e6aa7
   480 
   480 
   481     return check
   481     return check
   482 
   482 
   483 def copyfile(src, dest):
   483 def copyfile(src, dest):
   484     "copy a file, preserving mode and atime/mtime"
   484     "copy a file, preserving mode and atime/mtime"
       
   485     if os.path.lexists(dest):
       
   486         unlink(dest)
   485     if os.path.islink(src):
   487     if os.path.islink(src):
   486         try:
       
   487             os.unlink(dest)
       
   488         except OSError:
       
   489             pass
       
   490         os.symlink(os.readlink(src), dest)
   488         os.symlink(os.readlink(src), dest)
   491     else:
   489     else:
   492         try:
   490         try:
   493             shutil.copyfile(src, dest)
   491             shutil.copyfile(src, dest)
   494             shutil.copymode(src, dest)
   492             shutil.copymode(src, dest)