Bazaar

Bazaar

 




Wiki Tools

  • Find Page
  • Recent Changes
  • Page History
  • Attachments

This document attempts to describe the desired semantics for Bzr on a Windows file system. Most Windows file systems are "case preserving", in that the original case given for a filename is retained, even though any case can be used to access the file. This is in contrast to some file-systems, used on Windows and elsewhere, that are truly case-insensitve.

This document concerns itself mainly with the behaviour on a case-preserving file system - but also CaseInsensitiveWorkingTreeSupport.

This document is intended to be in a "psuedo-doctest" format. Lines beginning with '%' are entered at a command-prompt, while lines beginning with ">" are intended to show that command's output. Where the desired behaviour differs from the current behaviour is marked with lines starting with '***'.

So, let's get started:

% [make and change into a temp working directory]
% bzr init

Windows is a case-preserving file-system. Note that it doesn't matter what case we use when asking for the file - we always get back the exact case the file was created with.

% touch Foo
% dir foo
> ...
> 09/10/2008  01:40 PM                 0 Foo
% dir Foo
> ...
> 09/10/2008  01:40 PM                 0 Foo
% if exist Foo echo Yes
> Yes
% if exist foo echo Yes
> Yes

Bzr should attempt to use the name on the file-system rather than the name supplied by the user.

% bzr add foo
*** current behaviour ***
> added foo
*** expected behaviour ***
> added Foo

% bzr status
*** current behaviour ***
> unknown:
>   Foo
*** expected behaviour ***
> added:
>  Foo

Supplying the incorrect case to a file already in the inventory should work correctly. Let's add a new file to bzr with the correct case:

% touch lower
% bzr add lower
> added lower

If Windows lets them see it with a given name:

% dir Lower
> ...
> 09/10/2008  01:48 PM                 0 lower

Bzr should too:

% bzr status Lower
*** current behaviour ***
> unknown:
>   Lower
*** expected behaviour ***
> added:
>   lower

All comments which accept a filename need to handle this situation. Eg, rm:

% [make and change into a temp working directory]
% bzr init
> ...
% touch Foo lower
% bzr add
> added Foo
> added lower
% bzr ci -m "some changes"
> ...

% bzr rm foo Lower
*** current behaviour ***
> bzr: ERROR: Can't safely remove modified or unknown files:
> unknown:
>   foo
>   Lower
> Use --keep to not delete them, or --force to delete them regardless.
*** expected behaviour ***
> deleted lower
> deleted Foo

If an external program changes the case of the file underneath us, it must not phase us.

% bzr revert
> +N  Foo
> +N  lower

% rm Foo
% echo hello > foo
% bzr status
*** current behaviour ***
> removed:
>   Foo
> unknown:
>   foo
*** expected behaviour ***
> modified:
>   Foo

And reverting a tree in that state should restore the case of the file:

% bzr revert
*** current behaviour ***
>  M  Foo
> Conflict adding file Foo.  Moved existing file to foo.moved.
*** expected behaviour ***
> M Foo

But if the user really wants bzr to see the new name, she just does 'bzr mv' as normal.