HOWTOlabs  
 Services     Software     Commentary     Design     Astral Musings   
CVS
  printable 
CVS Client Installation
Related
Elsewhere
In the Works
  • Don't use CVS for massive volumes of data (like maps), consider a database instead
  • I spent a really long time making changes with an old CVS checkout. I am afraid if I use CVS my edits may be merged prematurely with other people's changes, can I still use CVS? Of course, just make a branch!


WinCVS and other Tips

Cvs Admin Menu - Performing a Clean Checkout
Make sure ALL TARGET FOLDERS ARE DELETED before initiating a clean checkout. Otherwise some of the state files in the special CVS directories that are placed in every checked out folder may not acurately reflect the files being checked out. Classic symtom of an invalid clean check out is CVS thinks files are not checked out and even though a checkout of them was just completed.

CVS hangs on large binary files
Preference globals tab, enable Use TCP/IP compression. This only compresses data transfered between the client and server. However, it seems to be a workaround for transfer hangs of certain binary file types that occur when compression is not enabled. This may be a bug in WinCVS that may be fixed in a later version. I have not seen Linux, or MacCVS have this problem.

Re-adding a file
Performing a CVS remove file command does not elimiate all traces of it from the repository. If at some later time the file is re-added, the Attic/filename,v with dead state is moved to filename,v and given an exists state in the CVS repository. Now because MS Windows is somewhat case insensitive, a problem can arise if the re-added file is the same name with slightly different case letters. The symptom of this is that a re-added file can't be commited because the exact case sensitive Attic/filename,v can't be found. To resolve this, either attempt to guess what the file case originally was, or gain access to the CVS repository and look in the Attic for the exact case spelling of the file, then re-add and commit should work.

WinCVS - files are present but don't show in window!
This is a fun one. Sometimes, without warning WinCVS will startup with a View Filter settings set strangely. The Show Changed setting if disabled will hide all files WinCVS view window! Check this setting and other similar ones to make sure you are seeing everything you expect to see. Be carefull, the settings are very subtle and can be very misleading!

Elsewhere: Source Forge: CVS Filters


CVS Tagging Tutorial

The following assumes the use of WinCVS
  1. Decide on the text string you would like to use for the tag you are about to create. See below for some tips on what kind of text strings make the most sense.
  2. tags.txt - this file should reside in the root module directory. Add a comment detailing the tag text string and what significance it has for the module's state. Check in tags.txt changes. Sure, you could skip having such a file or just neglect keeping it up to date. However, TAGS WILL BE MEANINGLESS UNLESS THEY ARE DOCUMENTED SOMEWHERE!
  3. In the left browse pane, select the module directory you would like to tag. For instance, if C:\PUBLIC\DEV\EDITOR\C2\assembler.cpp is in the root directory of the module you would like to tag, then select C:\PUBLIC\DEV\EDITOR\C2 in the left browse pane.
  4. In the left browse pane, left click on the selected folder, Create Tag.
  5. Fill in New tag name with the text for the tag you would like to create.
  6. Click OK. Wala, your done!
Tag Nomenclature: [module][major][minor][patch]
e.g. Tag FOO030407 equates to ...
module = FOO
major = 03
minor = 04
patch = 07
Here's a sample tags.txt file documenting a modules tag history
CVS Tag History
---------------
C2010101
ntree control functional

C2000102
rename ntree.cpp -> ntree.c

C2000101
some INI capability

C2000000
First check in of Gus's 'classic' code


Branch/Update/Merge Tutorial

Make a clean checkout of a known working module. Often you may look at a past tag of a project and checkout a specific tagged state of it clean to insure that you have a good base to work from.

If you decide not to create a branch, you can do an update with the clear sticky bit to freshen your working directory with the main trunk files.

Now, create a branch. On WinCVS, in the left pane right click on the module root you want to branch, Tag Selection, Create branch. Make sure you use no spacees or other nonalphanumerics (e.g. BRANCH1).

OK, now the CVS repository has a notion that BRANCH1 is a sperate code state from the main trunk, even though at the moment they represent the same file state. Even though BRANCH1 may seem like a normal tag, it actually refers to the tip of the branch just created. As commits of changes to the branch's files occur, the BRANCH1 tag will move forward to always represent the tip of the branch's file state. If you need to mark a certain file state, use the standard tagging proceedure.

From this point on, a seperate file state will be maintained for the files checked out to the branch work directory. Any changes checked in will not affect the main trunk.

Ultimately you will finish tweaking the branch files, check them into the branch, and decide that the branch needs no more work. At this point its time to merge/join the branch changes into the main trunk.

At some point you may decide that you still need the branch to work in, but some changes in the main trunk have occured that you would like to pull into you branch. This is tricky.
  
# cvs update -A
  ...

# cvs tag BEFORE000
  ...

# cvs tag -b BRANCH000
  ...

# cvs update -r BRANCH000
  ...

# vi ...
  [ change some files in the branch ]

# cvs commit
  ...

# cvs update -A
  ...

# cvs update -j BRANCH000
  [ merge, hope it works! ]

# cvs -n update
  [ this will show which files have been merged ]

# cvs commit
  [ beware - merging changes from a
    branch doesn't also add/remove files ]
  ...

# cvs tag AFTER000
  ...


Advanced Branch/Merging

So you used a branch, did your development, then merged it back into the main trunk. You need to do some more development isolated from the main trunk. Classic proceedure would be to checkout a fresh version of the trunk (remove sticky tags), then create a new branch, then update to the branch. However, you want to be clever. You already have a branch, just it has just been merged to the trunk once already. There is a way to keep developing in the old branch and merging only recent change to the trunk - but you need to be CAREFUL! Make sure you have a tag in the branch at the point which was previously merged to the trunk. Next time you merge the branch to the trunk, specify TWO -j options. This will restrict the merge to only changes made since the last merge of the branch was performed. If you skip the second merge option, the merge will be confused as it will try and undo/redo changes that have already been merged into the trunk.   
# cvs update -r BRANCH000 -AdR

# cvs tag BRANCH000MP1
  [ tag the current state which has already been merged to trunk ]

# vi ...
  [ change some files in the branch ]

# cvs commit
  ...

# cvs update -A
  ...

# cvs update -d -j BRANCH000MP1 -j BRANCH000
  [ merge ONLY the latest changes, hope it works! ]

# cvs -n update
  [ this will show which files have been merged ]

# cvs commit
  [ beware - merging changes from a
    branch doesn't also add/remove files ]
  ...


Common CVS Commands

  WinCVS (circa v1.2) Classic Command Line (Linux)
environment prep
Menu: Admin: Preferences
Root: CVSROOT=:pserver:loginname@server.net:/cvsroot
Authentication: "passwd" ...
Remote
$ export CVSROOT=:pserver:loginname@server.net:/cvsroot
Local
$ export CVSROOT=/cvsroot
login Menu: Admin: login
Remote
$ login
Local
N/A
tag hilite file or folder
Menu: Modify: Create a tag on selection ...
New tag name: BOGUSMOD20010909_FIXED_FOOBAR
$ cvs -q tag BOGUSMOD20010909_FIXED_FOOBAR
checkout ... $ cvs co module
(this will create a 'module' directory)
update ... (cd to 'module' directory, e.g. $ cd module)
$ cvs update -R -d
update
sticky
...
Sticky options
- Retrieve rev /tag/branch: TAG123
(cd to 'module' directory, e.g. $ cd module)
$ cvs update -rTAG123
$ cvs update -D "14 Jan 2008 19:50:00"
update
remove sticky
...
Update options
- Reset any sticky ...
(cd to 'module' directory, e.g. $ cd module)
$ cvs update -A
update
non-destructive
N/A ? (cd to 'module' directory, e.g. $ cd module)
$ cvs -n update
commit ... $ cvs commit somefile.txt
To commit all change in a directory and below omit the file name. New files require cvs add ... before commits will acknowlegde them. Remember, to use -ko -kb when adding binary files!
     


Dangerous But Useful Commands

Outdating files - VERY dangerous but usefull when disk space is low and repository has been very active ...
cvs admin -o ...
zap technologies