freebmdCVS Independent Mode

Note that these instructions refer to using the command line version of CVS on Windows as available from the FreeBMD web site. It does not cover WinCVS, a Windows interface version.

You can learn more about CVS and the development process from the following links: 
What is CVS? 
Development Process Overview

Using DOS Commands

All of the CVS commands mentioned in this tutorial are executed at the command prompt in a DOS window. If you are unfamiliar with DOS you should find this section helpful:

The file system on any disk begins with the root (top-level) directory, represented as a backslash. Thus C:\ represents the root directory on the C: drive. Each additional nested directory can be represented as another element in the path, with a backslash used to separate each one. C:\Windows\System\Colour means that the Colour folder is in the System folder in the Windows folder on the C: drive.

To open a DOS window in Windows 98, click on Start - Programs - Ms-DOS Prompt. In Windows XP, Start - All Programs - Accessories - Command Prompt.

When you open a DOS window you should see a command prompt such as C:\>. The first letter indicates which drive is currently in use - the 'active' drive.

If you want to change to a different directory, say to the colour directory, you would type cd c:\system\colour and press 'Enter'. The command prompt will then change to c:\system\colour>, showing that you are now in the colour directory.

Note: File names for the CVS repository, on UNIX, are case sensitive. Therefore, to make things simple for yourself always treat the file names in CVS as case sensitive.

Environment Variables

Each time DOS starts, it reserves a section of your computer's memory it calls the environment to store information accessible to DOS commands and your applications. Whenever you use CVS, you have to type in three variables each time:
Note: The environment variables above assume that you will name the folders as in the 'sample session' section below. If you name the folders differently, then you need to change Freebmd and cvs in the environment variables accordingly.

Presetting environment variables

Setting the environment variables each time you want to use CVS can be tedious, but there are ways you can avoid this. In some versions of Windows (XP for example), you can set environmental variables in the following way: Windows 98 has a System Configuration Utility (\Windows\System\msconfig.exe), which allows you to set environment variables.

Click on the Autoexec.bat tab and look for a 'PATH' command. If there is one, click on edit and add your PATH command to the end of the existing one. If you don't see a PATH command, click on new and add the command. Add the HOME and CVS_RSH variables here as well.

A Sample Session

As a way of introducing CVS, we'll go through the process of setting up a working directory, downloading the source files from the repository, and making changes to a FreeBMD project file, before committing the changes back into the repository.
  1. The first thing you need to do is create a new folder on your hard drive. The naming of this folder is arbitrary, but for this example we will call it 'freebmd'. This folder will contain the FreeBMD files that you will download from the repository. The path to this folder will be c:\freebmd
  2. Next, create a folder in the Program Files folder on your hard drive and name it 'cvs', so the path to this folder will be c:\program files\cvs.
  3. Now you are ready to download the cvs_ssh.zip file containing the CVS software and associated routines including SSh (secure shell).
  4. When you have downloaded cvs_ssh.zip, extract the files to the 'cvs' folder you created in step 2.

Creating Keys

You are now ready to log on to the server, tell it who you are and what password you will use to access and download the FreeBMD project files.
  1. Connect to the internet in your usual way.
  2. Open a DOS window and navigate to the 'Home' directory, c:\freebmd (if freebmd is the name you are using). You always have to be in the home directory before downloading project files.
  3. If you haven't preset the environmental variables as described above, you will have to type them in now, exactly as shown under Environment Variables, but substituting the folder names for the ones you have chosen.
  4. At the command prompt, type ssh-keygen. The key generation program will now be executed. When prompted for the file in which to save the key accept the default offered and press enter. It is most important that the file is literally called Identity.pub and is in c:\freebmd\.ssh (if freebmd is the name of your home directory).
  5. You will be asked to supply a passphrase (password) that you will need to authenticate your use of SSh. Choose an obscure password that only you will know,and write it down, as you will need it again.
  6. Note: If you haven't entered a password in a DOS window before, it can seem a bit strange. As you type, the cursor doesn't move, giving the impression that nothing has been entered. You will need to enter the password twice.

    If all has gone well, the file Identity.pub will have been placed in c:\freebmd\.ssh.

  7. Send the file called Identity.pub to Dave Mayall. This file contains your public key.
  8. Note: In the same location as identity.pub, ssh-keygen will have stored another file called Identity. This is your private key which enables you, and only you, to authenticate messages signed with your public key.

    Once you have run ssh-keygen and have sent identity.pub to Dave, do not run it again, as your key will be overwritten, and you will have to re-send the file to Dave.

  9. Dave will set up a login (referred to as yourname below) for you on the FreeBMD development machine. You will receive an e-mail message from Dave notifying you of your login name, and password for trac.
  10. It would be wise to ask Dave to set you up to be mailed with all CVS commits

Getting the Project Files from the Repository

These instructions refer to the use of SSh - for plink see the section Using plink.
  1. Make sure the environment variables are set.
  2. Make sure you're in the home directory by typing at the command prompt:
    cd c:\freebmd
  3. Download the source from the repository by typing the command:
    cvs -d yourname@test.freebmd.org.uk:/home/cvs checkout UKGEN-FreeBMD
  4. Note: Remember case sensitivity. Make sure you type UKGEN-FreeBMD exactly as shown. You will be prompted for the passphrase you created earlier with ssh-keygen.
  5. Enter your passphrase. The next stage takes some time, and you may think nothing is happening. Be patient! There are a lot of files to download. Eventually the files in the repository will start to download into your home directory. The download will be complete when you are returned to the DOS command prompt.
  6. During the download process a folder called rootsweb-FreeBMD2 will be created inside the home directory, and will hold all the downloaded project files and folders.

Making Changes [Developer]

Note: Before making any changes to a file, make sure you have allocated the task to yourself in trac.
  1. Ensure that your local copy of the repository is up to date by typing cvs update
  2. Look in rootsweb-FreeBMD2 for the file you want to work on and make the necessary changes.
  3. Note: Use a plain text editor for editing HTML files, as a WYSIWYG (What You See Is What You Get) editor can mess up the code. View HTML files in both Internet Explorer and Netscape Navigator if possible before upload.
  4. Before committing your changes you should get the latest update of the file in case it has been changed in the meantime. (In independent mode the file should not have changed, but it is best to be sure). cvs update filename

Committing the Changes

  1. Type cvs commit filename to make your changes into the repository. CVS creates the next revision number of the file. Enter your passphrase when requested and press Enter.
  2. CVS goes quiet for a moment while it compares the list of files on your computer with those on the server, and then it automatically opens up Notepad showing a list of changed files.
  3. At the top of Notepad you will see the cursor. Type in a short comment here to describe the changes to the file(s). Click on File - Save and close Notepad
  4. When Notepad closes, CVS automatically sends your edited files to the server. At the same time, an e-mail is generated and sent to everyone on the mailing list telling them what has been changed.
Note: There is an alternative to using Notepad when committing in step one. Replace the command shown with cvs commit -m "message" filename where message is the description you would have typed into Notepad.

Testing the Changes

Having made changes, you will need to get the file(s) installed on the test site.
  1. Log on to the Development server. You will see a list of files, including the file you have changed, preceded by a letter 'u' to indicate the file has been uploaded.
  2. Test HTML and CGI changes on the Test site. The test site looks and acts like the FreeBMD site. You can navigate through the site and test how your changes look and behave.
  3. Once you are happy with your testing, go to trac and change the task status in trac to "Ready for Test" and assign it to the person who originally requested it.
  4. Tip Put the development server, the test site and trac login into your 'Favourites' folder. You can then move from one to the other easily.

Requesting Transfer to Production [Developer]

  1. When the requester is satisfied with the changes, you will receive an e-mail notification that the task has been assigned back to you as "Tested OK"
  2. You now have to 'tag' the changed file. Make sure you're in the folder/directory which holds the file. Tag each changed file by typing cvs tag T1234 filename
  3. Add a followup to the task in trac, listing which modules have been changed, list any restrictions about when the module must go live (e.g. "To go live after next DB update") and assign it to Dave Mayall in status "Ready to Deploy".
  4. The process is complete when Dave puts the changes live.

Additional Information

The most common commands

Note: Using the above commands without stipulating a filename will act on all files. If you want to commit or compare one file, give the filename thus: cvs update filename You will be prompted for your passphrase (as defined in ssh-keygen) when you execute each command.

General update

Every so often it is worthwhile doing a general update to get the latest copies from the repository, especially new files. Only changed or new files will be downloaded. To do such an update use the following when in directory cvs-home
cvs update -AdP rootsweb-FreeBMD2

Creating a new executable file

Creating an executable file does not cause CVS to mark the file as executable (since Windows does not have the concept of execute permission on a file). However, an automatic process has been installed in the CVS repository to take care of this in most cases. If the file has a shebang first line (#!) and does not have at least one execute bit set then it will be marked as executable for all. In other circumstances the execute bits will need to be set manually on the file in the repository; send an email to the tech mailing list if you do not know how to do this.

Binary files

Binary files (e.g. image files such as .gif) are handled specially by CVS. It doesn't try to report differences when you commit a new version, for example.

If you create a binary file, use the -kb option on the add command, thus
  cvs add -kb file

However there is a problem! When you do the first commit on the file CVS puts the whole of the binary in the commit mail message. Therefore, the socially responsible thing to do is to make the first commit a dummy file and then commit the real file as a second commit.

Creating a new directory

It's unlikely you will have to create a new directory in the repository but if you do, get help! Although cvs add can be used to create a directory it will not automatically be added to the test system.

Getting a previous revision

To get a previous revision of a file use
  cvs update -r revision -p file
which will cause revision of file to be piped to standard output. The command above will display the revision of the file - but you probably want to store it somewhere! So do this:
  cvs update -r revision -p file > DestFile
where DestFile is the file name you want the revision stored in.

Reverting source

Under certain circumstances you may want to abandon edits you have done and revert to the current version in the repository. If you are using cooperative mode you can do cvs unedit but in independent mode the easiest way to do this is to delete the file (or copy it somewhere else) and then do cvs update file.

Note that the -C option on update, which overwrites your version of a file with the one in the repository, is not available in version CVS 1.9.10.

Deleting a file

To remove a file from a project, you must first delete the file in your working repository, and then use the cvs remove command to mark it for deletion. After that call cvs commit to delete the file from the repository (and include the usual commit comment explaining why the file has been deleted). Now use cvs tag -d BMD_LIVE file to remove the "live" tag from all versions of the file (otherwise the file will still be deployed during a handoff).

Committing a file marked with cvs remove does not destroy the file's history. It simply adds a new revision, which is marked as "non-existent". The repository still has records of the file's prior contents, and can recall them as needed - for example, by cvs diff or cvs log.

Documentation

The documentation for CVS 1.11 is available from www.cvshome.org. Although this is a later version of CVS than the one you will be using, this documentation represents a valuable source of information, although it is not the easiest manual in the world to use!

Abbreviations

Although there are abbreviations for the commands it is probably best to avoid them, at least initially. For historical reasons the abbreviation for commit is ci whereas the abbreviation co is used for checkout, so one can get confused!

Using plink

As mentioned previously, with ssh you will be prompted for your passphrase at each command execution. This can get a bit boring and by using plink (with pageant) you can supply your passphrase only once per session.

Create a PuTTY saved session

Run putty and set up the following parameters:
 hostnametest.freebmd.org.uk
 port22
 protocolSSH
CliCK on the + next to Connection and then click on SSH
 Preferred SSH protocol version1
 Private key for authenticationcvs-home\.ssh\Identity (or wherever you stored your private key - see here)

Click on Session and type a name (e.g. cvs) in the Saved Sessions box and click on Save. We will refer to this name as cvs-session below.

Note for Windows XP users: The first time you use PuTTY you should change the default encryption cipher selection policy to 3DES.
Exit by clicking on Cancel

Create a session

Run pageant. In the task bar at the bottom of the screen a computer with a hat on will appear. Right click on this and select Add key. Navigate to your Identity file (this will be cvs-home\.ssh\Identity) and click on Open. Type your passphrase when prompted.

Note that the security of FreeBMD is now dependent on the security of your machine. Ensure you have a secure logon and timeout. Close your machine when not using it.

Change CVS protocol

Change the environment variable CVS_RSH to point to plink, for example:
  set CVS_RSH="c:\Program Files\PuTTY\plink.exe"

Change CVS directory

You only need to worry about what's in this section if you did a cvs update using ssh and now want to change to plink.

In order to run any of the CVS commands using plink instead of ssh include -d cvs-session:/home/cvs where cvs-session is the name you saved your PuTTY session under.

For example:
  cvs -d cvs-session:/home/cvs status file
If you want to change from SSh to plink permanently you will probably want to make the above directory the default. This is a bit awkward because you have to either change or remove the CVS\root files (i.e. the files named root in the directories named CVS) in each of the directories on your machine below the directory you specified in HOME (as described here). The easiest is probably to delete them all and
  set CVS_ROOT=cvs-session:/home/cvs

FreeBMD Main Page


© 1998-2008 The Trustees of FreeBMD (Ben Laurie, Graham Hart, Camilla von Massenbach and David Mayall), a charity registered in England and Wales, Number 1096940.   We make no warranty whatsoever as to the accuracy and completeness of the FreeBMD data.  Use of the FreeBMD website is conditional upon acceptance of the Terms and Conditions

Hosted by The Bunker  RootsWeb, the oldest and largest FREE genealogy site  ancestry.co.uk logo 120x60