Mercurial > public > mercurial-scm > hg-stable
diff mercurial/util.py @ 3629:4cfb72bcb978
util: add copyfile function
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 13 Nov 2006 13:26:57 -0600 |
parents | 23f7d9621783 |
children | 48768b1ab23c |
line wrap: on
line diff
--- a/mercurial/util.py Mon Nov 13 13:26:57 2006 -0600 +++ b/mercurial/util.py Mon Nov 13 13:26:57 2006 -0600 @@ -460,6 +460,14 @@ 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"""