Using cvs | ||
| Prev | KDE CVS | Next |
The cvs utility is probably on your system. If not, you should visit http://www.cvshome.org. To learn to use I would recommend reading the man page! But, I've included explanations of some common functions below.
In some situations you may want to use a graphical cvs client to make your life easier. There are many cvs GUIs, like f.ex. Cervisia.
Let's assume for this section that you've got a cvs account as described in the previous section. Your cvs username is <joedeveloper>. As written below you should enter all of these commands from some base directory. (KDE/CVS is not a bad choice!) Set the environment variable CVSROOT to :pserver:joedeveloper@cvs.kde.org:/home/kde Inside the bash shell you'd do the following: export CVSROOT=":pserver:joedeveloper@cvs.kde.org:/home/kde" or setenv CVSROOT ":pserver:joedeveloper@cvs.kde.org:/home/kde" if you are using tcsh/csh.
In case you do not have a cvs account or you do not want to access it that way, you can use the anonymous method. In that case you can set the environment variable CVSROOT to :pserver:anonymous@anoncvs.kde.org:/home/kde.
You can't do this directly unfortunately. You can, however, view the contents of the file /home/kde/modules (which is similar, but not necessarily the same as a list of modules :) with
cvs -z4 co -cThe -z4 option tells the server to compress the code at "level 4" (higher levels mean more compression, but also more compression time) before sending it to you. This may speed things up for you. (In this case, since the module listing is small, it may not matter.)
For example, check out kdelibs from the default branch.
cvs -z4 checkout -r HEAD kdelibs
cvs -z4 checkout kdelibsThe -r options tells cvs which branch you want to checkout from. The default is the HEAD branch.
For example, check out kdelibs, from KDE_3_1_BRANCH
cvs -z4 checkout -r KDE_3_1_BRANCH kdelibs
You could use co as an abbreviation for checkout.
For example: Check out kjots, which is in the kdeutils module, from the HEAD branch.
(1)
cvs -z4 co -l kdeutils
(2)
cvs -z4 co -l admin
(3)
cvs -z4 co -l kdeutils/kjots
(4)
cd kdeutils; ln -s ../admin
The -l in line (1) tells cvs not to recurse the subdirectories of kdeutils. This means will get the configure script and its companions (discussed below), but none of the application source code.
Line (2) gets the admin directory which contains support files for autoconf and friends. (This directory is retrieved automatically when checking out an entire module.)
Line (3) gets the kjots source.
Line (4) makes a link to the admin directory. (This is better than copying or moving the directory here. If you leave admin where cvs put if then you can easily update the admin directory with cvs. You could also make links to admin from any other modules you check out this way and thus have only one, up-to-date copy of admin.)
For example, update kdeutils/kjots.
cvs -z4 update -P -d kdeutils/kjotsThe source code for kjots on your hard drive will be updated to match the code in the CVS. You don't need to specify the branch here. The correct branch is stored in kdeutils/kjots/CVS/Tag.
For example, commit kdeutils/kjots.
cvs -z4 commit kdeutils/jotsYou'll be prompted to edit a comment. Enter a short one which desribes the changes you're making with this commmit. (You can use your editor of choice by setting the EDITOR or CVSEDITOR environment variable.)
For example, add the file kdeutils/kmyapp/greatnewcode.cpp.
(create the file first!) cd kdeutils/kmyapp cvs add greatnewcode.cpp cvs commit
For example, delete the file kdeutils/kmyapp/badoldcode.cpp.
cd kdeutils/kmyapp rm badoldcode.cpp cvs remove badoldcode.cpp cvs commit
For example, add kdeutils/kmyapp, with the source file kmysource.cpp.
cd kdeutils mkdir kmyapp (create the kmyapp/kmysource.cpp file) cvs add kmyapp cvs add kmyapp/kmysource.cpp cvs commit (actually puts the directory and file in the CVS)
You need to have files in a directory to commit it.
For example, remove kdeutils/kmyapp.
cd kdeutils/kmyapp (delete all files, as described above in "Deleting a file") cd .. cvs -P update (will remove the local kmyapp automatically)
cvs also provides the ability to store commonly used switches in a resource file. In your home you can create a file called .cvsrc. The KDE developers recommend the following settings in this file:
cvs -z4 -q diff -u3 -p update -dP checkout -P
Having these items store in this file keeps you from having to specify them on the command line every time you perform a command.