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

Alexander Belchenko bialix at ukr.net
Tue Nov 13 17:42:03 GMT 2007


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

Aaron Bentley пишет:
> Alexander Belchenko wrote:
>> Still don't know. Maybe anybody else could shed light on this?
> 
> Well, it typically happens when you treat a file as a directory.  e.g.
> 
> I don't think it's relevant to the case where a file may have been moved
> out of the way.  So I think we should only catch ENOENT unless we hear
> otherwise.
OK.

> 
> # source and target may be aliases of each other (e.g. on a
> # case-insensitive filesystem), so we may have accidentally renamed
> # source by when we tried to rename target
> 
> Note that case-insensitivity isn't the only way you can get aliasing.  I
> think the Mac's implicit unicode normalization would have the same impact.

OK, thanks for the text.

> === modified file 'bzrlib/workingtree.py'
> --- bzrlib/workingtree.py	2007-11-03 09:39:11 +0000
> +++ bzrlib/workingtree.py	2007-11-10 13:16:12 +0000
> @@ -1318,6 +1318,10 @@
>                  only_change_inv = True
>              elif self.has_filename(from_rel) and not
> self.has_filename(to_rel):
>                  only_change_inv = False
> +            elif (sys.platform == 'win32'
> +                and from_rel.lower() == to_rel.lower()
> +                and self.has_filename(from_rel)):
> +                only_change_inv = False
> 
> ^^^ I don't think this is still needed.

No, it's actually needed, otherwise I get error from the else branch below:

                    raise errors.RenameFailedFilesExist(from_rel, to_rel,
                        extra="(Use --after to update the Bazaar id)")

C:\work\Bazaar\mydev\mv.change.case>bzr mv bzr BZR
bzr: ERROR: Could not rename bzr => BZR because both files exist. (Use --after to update the Bazaar id)

Fix for fancy_rename I did after fixing this part first.

Updated patch attached.

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

iD8DBQFHOeHrzYr338mxwCURAhR4AJ0dBRRnblR4GnJHbFeDN9HvyPYJzwCglTAr
kampb/GhyQSc58qLNoG9D1k=
=OFeo
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mv.change.case.patch
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20071113/e1cd26a1/attachment-0001.diff 


More information about the bazaar mailing list