CVS Tutorial for The Force
This is
not a general CVS tutorial! It's written for The Force codebase only (however most things can apply to other projects at sourceforge.net). If you want a general CVS tutorial that covers everythings, read the
Open Source Development with CVS (aka the CVS Book) by Karl Fogel (available in many formats). Here i'll describe how to
checkout (iow: get everything),
update and
commit (send modifications) source code.
Preparations
First of all you need the CVS program. I recommend (just because i done it in that way) to get Cygwin from
http://www.cygwin.com/ and install cvs from the Devel subcategory. Also if you plan to commit code, you should get the vi editor (from Editors subcategory) in order to edit log files (something that you must do in order to commit code) and the SSH for Windows from
http://www.ssh.com/. After this, set the HOME variable to show in a directory where CVS will put configuration files. If you install Cygwin at -for example- C:\CygWin, i recommend to set it to C:\CygWin\home\
yourloginname (where
yourloginname is the login name that you use in Windows, which is created automatically by Cygwin's setup). The variable should be
permanent (iow: to remain there even if you reboot), so if you have Win95, Win98 or WinME put the line
SET HOME=path (where
path is the path that you want to use) in the
c:\autoexec.bat file and then reboot. If you have Win2K or newer, open the
Control Panel, then the
System icon, go at the
Advanced tab and click on the
Environment Variables button. After that, click on the
New button in the
System variables and give
HOME as name and the path that you want to use. Press Ok to make changes effect and re-open any opened Command Line window.
Checkout
First of all, you need to make a new directory, where you'll place the source code. Note that the source code will be placed under a subdirectory called
theforcegui (this will be THEFOR~1 or THEFORCE under plain DOS - i just forgot this issue when i was uploading files :-} but doesn't matter anyway).
After that, open a Command Line window and move to that directory. Then enter:
cvs -d :pserver:anonymous@cvs.theforcegui.sourceforge.net:/cvsroot/theforcegui checkout theforcegui
(Note: even if the layout breaks it, this is
one line). The download will start and you'll have a working directory ready when it finishes!
Update
In order to update your source code with the sources in The Force's CVS, you need to type:
cvs -q -d :pserver:anonymous@cvs.theforcegui.sourceforge.net:/cvsroot/theforcegui update
Note: you must be in the directory that you choose to place the source code at the "Checkout" part
or in the
theforcegui directory. If you are in any other subdirectory, the update will take effect only in that directory (eg: if you are in the
theforcegui/apps directory, only the contents of this directory will be updated).
If while updating, you see a
M in front of any file, then this file has been modified by you after the last checkout and you didn't committed it back to the repository.
Commit
In order to commit (send) source code back to the repository, you must register yourself at the
SourceForge.net. After that, you have to
inform me about your wills and what you want to do, in order to put you in the projects area. After that you have to set up the following environment variables using the same method that you used to set up HOME:
Variable | Value |
CVSROOT | login@cvs.theforcegui.sourceforge.net:/cvsroot/theforcegui |
CVS_RSH | ssh2 |
(Note: Change
login with your login name)
Now the fun(?) part: sending files back!
In order to do that, move to the directory where you have the source code and enter the command below:
cvs commit -m "
log message"
The
log message is a message that says in a few words what you have changed in the source code and why. The log will be applied to all modified files. If you want to specify a log message for each fire, OR you want just to commit one file an nothing else, type:
cvs commit -m "
log message"
filename
(where
filename is the file that you want to commit). If you want to commit more than one files, just put them after the first file:
cvs commit -m "
log message"
filename file2 file3 (etc)
Some words of advise (actually rules)
Before starting a new feature,
update your code base!
Update often. Isn't a good idea to have old sources.
Commit only when needed! Don't commit an unfinished feature. Finish it and then commit the file.
Update often. Having old sources is not a good idea for sure!
A broken source tree is a source tree that doesn't build.
Try to not break the tree. Broken source trees are not good for others.
This tutorial covers the VERY BASIC stuff that you have to know in order to work with CVS! I highlly recommend you to read the CVS Book before doing anything, and have a local copy of it in your computer. PLEASE don't make The Force's source code tree a mess.