[MERGE] Rename on Windows is able to change filename case. (#77740)

Alexander Belchenko bialix at ukr.net
Sat Nov 10 16:43:28 GMT 2007


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

Aaron Bentley пишет:
> Alexander Belchenko wrote:
>> Windows used case insensitive filesystem therefore rename (bzr mv) should care about special case
>> when only case is changed.
> 
> bb:comment
> 
> Could you please explain why we should avoid using fancy_rename in that
> special case.?

Because it simply did not work for this special case, but os.rename works just like a charm.

fancy_rename(old,new) try at first rename new (if exists) to some temp name, and therefore it move
away original file, because on case-insensitive filesystem 'test.txt' and 'Test.txt' is the same.
So fancy_rename actually mv *both* new and old to temp name. Then fancy_rename try to
`rename old new`, but at this point old is not exists, and here we get exception.
Then fancy_rename did rollback and restore new (that actually old) from temp file.

so on Windows:

os.rename('test.txt', 'Test.txt') => works
osutils.fancy_rename('test.txt', 'Test.txt') => fails with OSError (File not found).
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHNd+wzYr338mxwCURArw7AJ0ZX4lwlKqsF3YfIJ/uMcfYZg5wrQCfcBMF
LeXH295P7f1GNhOHgynXgRc=
=pP+n
-----END PGP SIGNATURE-----



More information about the bazaar mailing list