Version Control with CVS

A-A-P home page | A-A-P Recipe Executive
--- | ---
Prev |  | Next

# Chapter 7. Version Control with CVS

CVS is often used for development of Open Source Software. A-A-P provides facilities to obtain the latest version of an application and for checking in changes you made.

## Downloading

For downloading a whole module you only need to specify the location of the CVS server and the name of the module. Here is an example that obtains the A-A-P Recipe Executive:

       CVSROOT = :pserver:anonymous@cvs.a-a-p.sf.net:/cvsroot/a-a-p
       all:
    	:fetch {fetch = cvs://$CVSROOT} Exec

Write this recipe as "main.aap" and run `aap`. The directory "Exec" will be created and all files in the module obtained from the CVS server:

% `aap`
Aap: CVS checkout for node "Exec"
Aap: cvs -d:pserver:anonymous@cvs.a-a-p.sf.net:/cvsroot/a-a-p checkout 'Exec'
cvs server: Updating Exec
U Exec/Action.py
U Exec/Args.py
[....]
%

The `:fetch` command takes care of obtaining the latest version of the items mentioned as arguments. Usually the argument is one module, in this example it is "Exec". That CVS needs to be used is specified with the `fetch` attribute. This is a kind of URL, starting with "cvs://" and then the CVS root specification. In the example the `CVSROOT` variable was used. This is not required, it just makes the recipe easier to understand.

Note that this only works when you have the "cvs" command installed, otherwise you will get an error message.

If the software has been updated, you can get the latest version by running "aap" again. CVS will take care of obtaining the changed files.

## Uploading

You are the maintainer of a project and want to distribute your latest changes, so that others can obtain the software with a recipe as used above. This means you need to checkin your files to the CVS server. This is done by listing the files that need to be distributed and giving them a `commit` attribute. Example:

       CVSUSER_FOO = johndoe
       CVSROOT = :ext:$CVSUSER_FOO@cvs.foo.sf.net:/cvsroot/foo
       FILES =  main.c
                common.h
                version.c
       :attr {commit = cvs://$CVSROOT} $FILES

Write this as "cvs.aap" and run `aap -f cvs.aap revise` . What will happen is:

1. Files that you changed since the last checkin will be checked in to the CVS server.

2. Files that you added to the list of files with a `commit` attribute will be added to the CVS module.

3. Files that you removed from the list of files with a `commit` attribute will be removed from the CVS module.

This means that you must take care the `FILES` variable lists exactly those files you want to appear in the CVS module, nothing more and nothing less. Be careful with using something like `glob("*.c")`, it might find more files that you intended.

Note: This only works when the CVS module was already setup. Read the CVS documentation on how to do this. The A-A-P user manual has useful hints as well.

In the example the `CVSUSER_FOO` variable is explicitly set, thus this recipe only works for one user. Better is to move this line to your own default recipe, e.g., "~/.aap/startup/default.aap". Then the above recipe does not explicitly contain your user name and can also be used by others.

Once you tested this recipe and it works, you can easily distribute your software with `aap -f cvs.aap revise`. You don't have to worry about the exact CVS commands to be used. However, don't use this when you want to checkin only some of the changes you made. And the example does not work well when others are also changing the same module.

Prev | Contents | Next
Using Python | Up | Filetypes and Actions