Top

Version Control Systems


J provides commands to perform a few common version control operations that it makes sense to do from within an editor. J supports CVS, Subversion, Perforce, and Darcs.

For these commands to work, the version control command line tool must be set up correctly outside of j first. A VCS operation won't work within j unless it can be performed successfully from a shell command prompt in the parent directory of the current buffer.

Most VCS-related commands are not mapped to any keystrokes by default, but you can use executeCommand, mapped by default to Alt X, and then type in the name of the command (or just type "cvs" and then keep hitting Tab until you see the command you want; completion is your friend).

VCS revision information for checked-out files is displayed in the status bar for CVS or Subversion managed files, to the right of the mode name, like this:

    CVS 1.34
or
    CVS 1.34 M
or
    CVS A

In this example, "1.34" is the revision; it's followed by an 'M' if the file modification time of the local file is different from the checkout time, which is often an indication that the local file has been modified since it was checked out. "CVS A", with no revision number, means the file has been added to CVS but not yet committed. For Subversion, the file's changelist and most recent author will also be displayed:

    svn M r1234 (changelist) piso

If you're working on a file that's registered with CVS, you can use the command cvsDiff to get a diff output buffer showing the changes between the checked-in version and your local copy. cvsDiffDir is similar, but it generates a diff output buffer containing information about all the files in the current directory and its subdirectories, not just the current buffer. Once you're in the diff output buffer, you can scroll around and use diffGotoFile, mapped by default to Enter, to jump to the location in the source file that corresponds to the line you're on in the diff output buffer. You can use escape, mapped by default to Escape, to get rid of the diff output buffer when you're done.

When you're ready to check in your changes, use the command cvsCommit. This command opens a checkin buffer in which you can compose your checkin comment. When your comment is ready, use the command finish, mapped by default to Ctrl Enter in the checkin buffer, to complete the checkin operation.

If you change several source files for the same reason, it is often convenient to specify the same checkin comment for several files. To help you do this, j maintains a history of the checkin comments you've used recently. You can use the commands previousComment and nextComment, mapped by default to Ctrl P and Ctrl N (respectively) in the checkin buffer, to cycle through this history list.

To register the current buffer's file with CVS for the first time, use the command cvsAdd.

The generic command cvs, which requires an argument, can be used to execute arbitrary CVS commands for which j has no specific support. The required argument is the CVS command to be executed, together with any necessary flags. For example:

        cvs status -v

The name of the file associated with the current buffer is automatically appended to the command line, so if you're editing a file called Jdb.java, the command line that CVS sees is actually:

        cvs status -v Jdb.java

There is one exception: if the argument you supply begins with "-H" (CVS command-specific help), the filename is not appended. For example:

        cvs -H admin

The output of the command is displayed in a transient output buffer.

The following commands are specifically relevant for version control: