Bazaar must be portable across operating-systems and file-systems. While the primary file-system for an operating-system might have some particular characteristics, it’s not necessary that all file-systems for that operating-system will have the same characteristics.
For example, the FAT32 file-system is most commonly found on Windows operating systems, and has the characteristics usually associated with a Windows file-system. However, USB devices means FAT32 file-systems are often used with GNU/Linux systems, so the current operating system doesn’t necessarily reflect the capabilities of the file-system.
Bazaar supports 3 kinds of file-systems, each to different degrees.
As can be implied by the above descriptions, only the first two are considered relevant to a modern Bazaar.
For more details, including use cases, please see http://wiki.bazaar.canonical.com/CasePreservingWorkingTreeUseCases
The fundamental problem handling these file-systems is that the user may specify a file name or inventory item with an “incorrect” case - where “incorrect” simply means different than what is stored - from the user’s point-of-view, the filename is still correct, as it can be used to open, edit delete etc the item.
The approach Bazaar takes is to “fixup” each of the command-line arguments which refer to a filename or an inventory item - where “fixup” means to adjust the case specified by the user so it exactly matches an existing item.
There are two places this match can be performed against - the file-system and the Bazaar inventory. When looking at a case-insensitive file-system, it is impossible to have 2 names that differ only by case, so there is no ambiguity. The inventory doesn’t have the same rules, but it is expected that projects which wish to work with Windows would, by convention, avoid filenames that differ only by case.
The rules for such fixups turn out to be quite simple:
From the description above, it can be seen the implementation is fairly simple and need not intrude on the internals of Bazaar too much; most of the time it is simply converting a string specified by the user to the “canonical” form as stored in either the inventory or filesystem. These boil down to the following new API functions:
The only complication is the requirement that Bazaar not allow the creation of items that differ only by case on such file-systems. For this requirement, case-insensitive and cicp file-systems can be treated the same. The ‘case_sensitive’ attribute on a MutableTree is used to control this behaviour.