[PATCH 2 of 2] util: move rename into posix.py and windows.py

Adrian Buehlmann adrian at cadifra.com
Wed Oct 7 18:20:58 UTC 2009


On 07.10.2009 19:59, Adrian Buehlmann wrote:
> diff --git a/mercurial/posix.py b/mercurial/posix.py
> --- a/mercurial/posix.py
> +++ b/mercurial/posix.py
> @@ -244,3 +244,7 @@ def groupname(gid=None):
>          return grp.getgrgid(gid)[0]
>      except KeyError:
>          return str(gid)
> +
> +def rename(src, dst):
> +    '''atomically rename file src to dst, replacing dst if it exists'''
> +    os.rename(src, dst)

or would

diff --git a/mercurial/posix.py b/mercurial/posix.py
--- a/mercurial/posix.py
+++ b/mercurial/posix.py
@@ -14,6 +14,7 @@ nulldev = '/dev/null'
 normpath = os.path.normpath
 samestat = os.path.samestat
 expandglobs = False
+rename = os.rename

 umask = os.umask(0)
 os.umask(umask)


be preferred?



More information about the Mercurial-devel mailing list