[RFC] race-free-rename ?

John Arbash Meinel john at arbash-meinel.com
Tue Oct 16 16:02:55 BST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert Collins wrote:
> So, for packs, I'd like a rename() which is guaranteed race-free. That
> is, it should fail if it cannot atomically rename the source to the
> destination (e.g. if the destination already exists and the fs does not
> support rename-over-the-top).
> 
> thoughts? comments on how to expose it?
> 
> -Rob

I thought that is what we have for Transport.rename (versus Transport.move).

Specifically, "Transport.rename" was intended to support renaming a directory
over a directory must fail, versus Transport.move() which should allow renaming
a file over top of another file.

At least for local and sftp, Transport.rename is implemented in terms of direct
os.rename(), while Transport.move() uses 'fancy_rename' when applicable.

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHFNKfJdeBCYSNAAMRAn/lAJoCebVzgrzQ88HsvlqYCfaa5uAJGwCgrdW6
AnTxFgNq759FZnoFDaO5Ai8=
=lu4l
-----END PGP SIGNATURE-----



More information about the bazaar mailing list