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

Alexander Belchenko bialix at ukr.net
Wed Nov 14 15:15:52 GMT 2007


Aaron Bentley пишет:
> Alexander Belchenko wrote:
>> 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)")
> 
> Fair enough, keep it.
> 
> I guess this is another pitfall of look-before-you-leap; your conditions
> may grow more and more convoluted, to try and match the exact error
> condition you want to avoid.  I don't think there's much we can do in
> this case, though.

I'm thinking more about different cases, and eventually implement base 
logic to detect case-insensitive filesystem in WorkingTree4 constructor.
Right now it's only used for mv, but step-by-step we (me) could improve 
all another parts of bzr to implement spec about CIFS support.

Look at my new version, please.

> +        except (IOError, OSError), e:
> +            # 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
> +            if (not file_existed
> +                or e.errno not in (None, errno.ENOENT)
> +                or old.lower() != new.lower()):
> 
> 
> ^^^ sorry I didn't notice this on the last review, but I'd like to
> remove that lower() test.  That makes it a more general solution for
> aliasing detection, and means that we don't have to worry about
> discrepancies in the way different platforms apply lowercasing.

Fixed.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mv.change.case.and.cifs.patch
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20071114/586b3597/attachment-0001.diff 


More information about the bazaar mailing list