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

Aaron Bentley aaron.bentley at utoronto.ca
Wed Nov 14 15:48:15 GMT 2007


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

Alexander Belchenko wrote:
> 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.

bb:comment

I like the idea.  I think CIFS is a confusing abbreviation, because it
can also refer to Common Internet File System:
http://www.webopedia.com/TERM/C/CIFS.htm

Especially if you consider that Linux clients may access
case-insensitive filesystems over Common Internet File System.

> +        # we can't use failUnlessExists on case-insensitive filesystem
> +        # so try to check shape of the tree

What happens if we do failUnlessExists?

> +    def test_filesystem_case_detection(self):
> +        # check actual state of filesystem
> +        self.build_tree(['a', 'b/'])
> +        is_A = osutils.isfile('A')
> +        is_B = osutils.isdir('B')
> +        self.assertEquals(is_A, is_B)
> +        real_cifs = is_A

^^ perhaps change this variable name to "really_case_sensitive" (and
invert the meaning).

Also, instead of making this a workingtree4 test, I think it should be a
workingtree_implementations test, because we'll want future formats to
support this.

> === modified file 'bzrlib/workingtree.py'
> --- bzrlib/workingtree.py	2007-11-13 18:39:31 +0000
> +++ bzrlib/workingtree.py	2007-11-14 15:01:42 +0000
> @@ -270,6 +270,8 @@
>              # the Format factory and creation methods that are
>              # permitted to do this.
>              self._set_inventory(_inventory, dirty=False)
> +        # dummy case-insensitive fs flag
> +        self.cifs = False

^^^ perhaps change this variable name to "case_sensitive" and invert the
meaning?

> +            elif (self.cifs and has_from_rel
> +                and from_rel.lower() == to_rel.lower()):
>                  only_change_inv = False

Perhaps it would be cleaner to introduce WorkingTree.is_same_file() or
something?  I just think that every use of the .cifs var is likely to be
testing whether two files are the same.

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

iD8DBQFHOxi/0F+nu1YWqI0RAuPuAJ923/vOP905cFCMoxomA/IZy3FivQCfabcE
MafEEdZ3BGpRnIYIEtvJ030=
=9zma
-----END PGP SIGNATURE-----



More information about the bazaar mailing list