http://fuse.sourceforge.net/) Linux/BSD kernel extension to export a bzr (http://bazaar-vcs.org/) version repository as a file system. The primary use of bzrofs is to make versions visible to tools that are not version-aware.
The FUSE mountpoint exports the working directory as a read-write file system. In addition, two views of the repository are overlaid as a read-only directories.
The synchronic repository view consists of revision snapshots. With bzr, a revision applies to the whole repository instead of an individual file. In this view, a snapshot appears as a directory containing files.
The diachronic repository view consists of file histories. In this view each file appears as a directory containing a series of versions.
This project is as much an exploration of FUSE services as it is of version control. It has been tested on Linux and lightly tested on MacOS (10.5). There is extensive debugging output when run in foreground with the -f option.
These and other defaults can be changed with the following options.
The options listed above may be followed by the standard FUSE options. Among the most useful are
The final argument is the FUSE mount point.
bzrofs --dir=~/bzrofs ~/mnt
Working files are simply a reflection of the working directory. They can be added, deleted, edited, compiled, linked, and executed.
~/mnt/#-1/README.htmlwhich can be abbreviated to
~/mnt/#/README.htmlThe previous committed version is
~/mnt/#-2/README.htmlThe README.html file didn't exist in the first committed version, so there is no
Any bzr revisionspec without / can follow the "#", allowing names such as
~/mnt/#100/README.htmlfor the file as of revision 100, or
~/mnt/#tag:sourceforge-1.0/README.htmlfor the file as tagged for sourceforge release.
Because bzr revisions apply to all files in the repository,
~/mnt/#/presents a complete directory tree of all currently committed files. Snapshot files can be opened in read-only editors and are available to common file system tools such as diff. For example, uncommitted changes can be located with the command
diff -r ~/mnt/# ~/mnt
~/mnt/##/README.htmllists files including the first committed version,
~/mnt/##/README.html/#098through a recent version,
File versions in a history are the same as file versions in a snapshot -- they are available read-only to standard tools. For example, the growth of the file can be seen with the command
wc ~/mnt/##/README.html/*Similarly, the increase in source code is shown by
for v in ~/mnt/##/* do echo -n $v wc $v/*.[ch] | grep total done
diff -r ~/mnt/tests/# ~/mnt/testsor
cd ~/mnt/tests diff -r ./# .locate uncommitted changes in the current directory. Likewise
cd ~/mnt/tests ls ./##show which versions include changes to the tests.
Because bzrofs walks each component of a pathname without seeing what follows, special components such as "#" and "##" must appear as directories before the files they modify.
The log history is visible as
ls ~/mnt/##Log/*where the log entry for at revision 143 is
grep -iH tags: ~/mnt/##Log/*locates all tagged revisions.
The "##Annotate" directory presents annotated files at specific revisions.
The cost of bzr operations is dominated by the cost of starting python interpreters. Bzrofs runs bzr commands as subprocesses, rather than using a library to read the repository data structures. This insulates it from changes to data formats and interfaces, and cross-language issues.
Bzrofs implements fine-grain operations on the repository, requiring many bzr commands. A recursive diff issues
bzr lscommands to list each directory involved and
bzr catcommands to extract the contents of each file. This is significantly slower than a single command.
To improve performance, bzrofs caches the results of each bzr command. For example, it uses a cached repository directory listing to look up file attributes and a cached file version to get both size and contents.
For safety, bzr operations and the bzrofs cache are single-threaded. This does not usually affect performance for a single user.
Performance might improve by piping commands through a
bzr shellprocess, avoiding repeated startup costs.
bzr lscommand changed between bzr 1.13 (bundled in Ubuntu Hardy Heron) and 1.14, specifically in the way a trailing / indicates a directory. This code relies on the 1.14 and later versions. Earlier versions could be supported by separating the listing by kind,
bzr ls --non-recursive --kind=file bzr ls --non-recursive --kind=directoryhttps://launchpad.net/bzr-fs). http://sourceforge.net/projects/bzrofs/).