A-A-P home page | A-A-P Recipe Executive |
Prev | Tutorial | 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 (Checkout)

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@a-a-p.cvs.sourceforge.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@a-a-p.cvs.sf.net:/cvsroot/a-a-p checkout 'Exec'
cvs server: Updating Exec
U Exec/Action.py
U Exec/Args.py
[....]
%

If there is a request for a password just hit enter (mostly there is no password).

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.

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.

Note that all this only works when you have the "cvs" command installed. When it cannot be found Aap will ask you want Aap to install it for you. Whether this works depends on your system.

## Getting Past A Firewall

Firewalls may block the use of a CVS connection. Some servers have setup another way to connect, so that firewalls will not cause problems. This uses port 80, normally used for http connections. Here is the above example using a different "pserver" address:

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

This doesn't always work through a proxy though. If you have problems connecting to the CVS server, try reading the information at this link.

## Uploading (Checkin)

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 `*.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.

## Further Reading

The User manual Chapter 18, Version Control has more information about version control and Chapter 19, Using CVS about using CVS.

Prev | Up | Next
Chapter 6. Using Python | Contents | Chapter 8. Filetypes and Actions