Confusing error for 'FileExists' during rename
John Arbash Meinel
john at arbash-meinel.com
Tue Dec 23 22:29:21 GMT 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I just ran into this, though I'm not sure what the right answer is.
If you try to do "Transport.rename(source, target)" and target already
exists, it ends up raising:
FileExists(source)
It does this, because "_translate_error()" only allows one path to be
passed, and you could also get:
NoSuchFile(source)
And we don't have a way to distinguish it.
I don't know that it really matters, but it was a bit confusing at
first. I would also imagine that it only really effects windows users,
because on Linux os.rename() for files would just auto-overwrite the
target. I would also propose that "pack.finish()" should actually be
using "transport.move()" which uses the fancy_rename dance to implement
near-POSIX (almost) atomic renames.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAklRZkEACgkQJdeBCYSNAAPa3wCggPOIKoJZ7L16o39E6HK+e+qP
TE4AoLttPmy1bpWBSg1ME/nHsRcApWTJ
=XKi3
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list