The SampleVCS Version Control System


Starting from version 4.0 JBuilder provides an OpenTools API to integrate a Version Control System in the IDE. This means that any VCS can easily be integrated into JBuilder and used to do project management without having to leave JBuilder or to call external programs.
The API allows implementers to add UI elements for the selection and the configuration of the VCS, and exports a powerful Visual Diff Engine that gives the user the ability to easily and intuitively see the differences between revisions. The Visual Diff Engine is totally VCS-independent; the only required implementation is the VCS.getSource( Url ) method.
While the API is fully documented this sample provides a complete implementation of it using a bare-bones, trivial VCS called SampleVCS. SampleVCS simply stores files in another directory (called the repository), mirroring the structure of the original directory tree. Each file is stored in its entirety, with the version number appended to the name and separated from it by a comma (",").
For example Frame1.java will become Frame1.java,1.1.

Each file in the repository has also a .comment file that contains the description of the changes when the file was checked in, the user ID, the timestamp, and a version label. This last value is actually never used by SampleVCS and it's always set to "None". The version label is one of the fields required by the RevisionInfo class when using the History Pane.

A fundamental feature of any VCS is to identify which revision is currently under control of the user. In the case of SampleVCS this means the revision that has been checked out. SampleVCS records the version number of a checked out file using a trivial method: a directory called "SampleVCS" is created in the same directory of the file. In this subdirectory we write the version number in a "control file" that has the same name of the workfile. This system is sub-optimal but it's simple and forces us to do some interesting gymmic to avoid listing control files in the VCSCommitBrowser