Source control with TortoiseCVS

Introduction

TortoiseCVS is a simpler alternative Windows-only front-end to the open-source source control manager CVS. Most people think of this client (along with WinCVS) as requiring a CVS server, but it can also be used as a stand-alone SCM if you're the only one working on the files that need to be put under source control.

Setup

  1. Download and install TortoiseCVS
  2. Create a folder on your hard disk where files under source control will be located. This directory is known as a sand-box, ie. that's where files will be checked out by Tortoise from its repository when you want to work a file
  3. Launch Windows Explorer, and right-click on this folder
  4. From the CVS menu, choose "Make New Module"
  5. Select the "Locally mounted directory" protocol
  6. "Repository folder" is where Tortoise will save the files will be saved by Tortoise when you perform check-ins, ie. it's not the sand-box folders (which is where files are saved when checked out from the repository). By default, a first module named "tortoise" will be created
  7. Since you're starting from scratch, a dialog is displayed to warn you that no CVS repository is available in this folder. Check the "Initialise a new repository here". Your sandbox folder is now under source-control. If Explorer is set up to show hidden files/folders, you can see a hidden CVS subdirectory under this sandbox. This is used by Tortoise to keep track of changes made in this sandbox
  8. To check in files in the sandbox, right-click on each file, and choose "CVS Add..."
  9. Edit any file that was added to the repository
  10. To check changes in, right-click the sandbox folder, and choose "CVS Commit...". You can see changes in the ad hoc sub-directory in the repository (each file under source-control has a ",v" extension added to it)

Operations

To ignore some files when putting them under source control

Right-click on any folder, and choose CVS, followed by "Preferences...". Click on the ".cvsignore" tab, and add files you wish to not add to source control, eg. "*.exe *.ocx *.vbw *.gif *.jpg *.lib *.dll *.cab *.exp *.pdf" (without the quotes)

To add a whole new sandbox to source control

Right-click on the directory, and choose "CVS Add Contents..."

To check out a file

  1. In in the pop-up menu, select "CVS Checkout..."
  2. Checkout Dialog
  3. If you know the module name you can enter it in the Module field. Conversely, you can checkout an entire repository by entering a period (.) into the Module field. If you do not know the module name you can click on Fetch list to populate the drop-down with available modules. Note: Some CVS servers do not support this feature; if you cannot populate this list you should contact the CVS server admin.
  4. Works on those checked-out files using your development tools
  5. Once you're through and wish to upload those changes into the CVS repository, right-click on the folder, and select "CVS Commit..."

To check in a file

To add a file to the repository

To remove a file from the repository

To backup data

To remove a module

To remove TortoiseCVS

Control Panel | Add/Remove Programs. Data folders are not removed

To move TortoiseCVS to another host

To use a diff program

Open the Preferences dialog, you can find it on the start menu.  You can also hold down Control while you click on the CVS Diff menu option.

Q&A

After installing Tortoise and creating my first module, a "tortoise" directory is created at the root of the partition

Me being a newbie? :-)

After creating a new module, do I need to use CVS Add Contents... followed by CVS Commit?

Looks like it.

How do I see the differences between two versions?

When clicking on the pop-menu, no CVS Diff menu

Resources