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

Matt Mackall mpm at selenic.com
Wed Oct 7 13:23:58 CDT 2009


On Wed, 2009-10-07 at 20:20 +0200, Adrian Buehlmann wrote:
> 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?

Yes, please.

-- 
http://selenic.com : development and support for Mercurial and Linux




More information about the Mercurial-devel mailing list