Next: , Previous: Customizing the inventory Naming Conventions, Up: Customizing Arch

6.2 Revision Library Basics

For many purposes, it is useful to have a library containing pristine trees of a large number of revisions – for example, all of the revisions in a particular version. To be practical, though, such a library must be represented in a space-efficient way.

Unix hard-links provide a natural way to store such a library. Each successive revision in a series is a copy of the previous, but with unmodified files shared via hard-links.

arch provides commands to help you build, maintain, and browse such a library.

As a pleasant side effect, many arch commands are speeded up if the revisions they need to operate are present in your revision library. You can read more about this in the next chapter.

6.2.1 Your Revision Library Locations

To begin a new revision library, first create a new directory (DIR) and then register its location:

             % tla my-revision-library DIR

You can check the location of your library with:

             % tla my-revision-library

or unregister it with:

             % tla my-revision-library -d DIR

Note that you can have more than one revision library: in effect you have a "path" listing all of your library locations.

6.2.2 Revision Library Format

A revision library has subdirectories of the form:


Each REVISION directory contains the complete source of a particular revision, along with some supplemantary subdirectories and files:


                     The patch set that creates this revision from
                     its ancestor (unless the revision is a full-source
                     base revision).

Although the permissions on files in the revision library are determined as determined by patch sets, you must never modify files int the revision library. Doing so will cause odd errors and failures in various arch commands.

6.2.3 Adding a Revision to the Library By Hand

You can add a selected revision to your revision library with:

             % tla library-add REVISION

library-add will normally add not only REVISION to the library, but all directly preceeding revisions (recursively) which are from the version as REVISION.

If you want to add only REVISION and no others, use the --sparse option:

             % tla library-add --sparse REVISION

6.2.4 Finding a Revision in the Library

You can find a particular revision in the library with library-find:

             % tla library-find REVISION

The output is an absolute path name to the library directory containing the revision. (Once again, you must not modify files in that directory.)

6.2.5 Removing a Revision from the Library

To remove a particular revision from the library, use:

             % tla library-remove REVISION

Be aware of the following limitation in the current release: suppose that you add three successive revisions, A, B, and C. Then you remove B, then re-add B. Now there is a chance that the file sharing between B and C will be less than optimal, causing your library to be larger than it needs to be. (You can fix this by then removing and re-adding C.)

6.2.6 Listing Library Contents

The command library-archives lists all archives with records in the library:

             % tla library-archives

Similarly, you can list categories, branches, versions, or revisions:

             % tla library-categories [ARCHIVE]
             % tla library-branches [ARCHIVE/CATEGORY]
             % tla library-versions [ARCHIVE/BRANCH]
             % tla library-revisions [ARCHIVE/VERSION]

6.2.7 Individual Files in the Revision Library

You can locate an individual file in a revision library with:

             % tla library-file FILE [REVISION]

or obtain its contents with:

             % tla cat-library-file FILE [REVISION]
             ...file contents...

Both commands accept the options --id and --this. With --id, the argument FILE is interpreted as an inventory id, and the file with that id is found.

With --this, FILE is interpreted as a file relative to the current directory, which should be part of a project tree. The file's inventory id is computed and the corresponding file found in REVISION.

6.2.8 Determining Patch Set Prerequisits

               % tla touched-files-prereqs REVISION

That command looks at the patch set for REVISION and at all preceding patch sets in the same version (it searches your library rather than your repository for this purpose). It reports the list of patches that touch overlapping sets of files and directories – in other words, it tells you what patches can be applied independently of others. The command has an option to exclude from consideration file names matching a certain pattern (e.g. =README or ChangeLog). It has an option to exclude from the output list patches which have already been applied to a given project tree. It has an option to report the specific files which are overlapped.