mercurial/util.py
changeset 3632 4cfb72bcb978
parent 3568 23f7d9621783
child 3651 48768b1ab23c
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -460,6 +460,14 @@ def unlink(f):
     except OSError:
         pass
 
+def copyfile(src, dest):
+    "copy a file, preserving mode"
+    try:
+        shutil.copyfile(src, dest)
+        shutil.copymode(src, dest)
+    except shutil.Error, inst:
+        raise util.Abort(str(inst))
+
 def copyfiles(src, dst, hardlink=None):
     """Copy a directory tree using hardlinks if possible"""