Latest

Archive

Community news

C++

Communities and Content

Databases

Editorials

Emacs

General

HTML

Java

Notices

PHP

XML

Apache

C++

Database

General

HTML

Java

Javascript

Linux

Object oriented programming

Open source

Perl

PHP

Python

Ruby

SOAP

XML

Suggest a link

Advertise on zez

Contribute

Contact us

About zez


Version Control management with CVS - Part 1



Updating

Updating, one of two widely used CVS commands, is vital to any cvs project. It makes sure your local copy is up to date with the remote repository.

First lets picture a scenario:

You successfully checked out the project and have used it successfully for a couple of days. You then get a message from your friend telling you that a new super cool feature has been committed to the project. And of course you're interested in getting it.

Well the solution is simple, what you need to do is to perform a CVS action called updating, this is done with the CVS command update. To do the update you first need to change the current directory to wherever you have the project locally, then you do a

cvs -z3 update

or using the short form

cvs -z3 up

there is no longer any need to specify the location of the repository this is because when you checked out the project the location was stored locally.

When you execute the command you will notice that it lists a couple of files with some letters in front of them. The letter in front gives you a clue on the status of the file. For instance

U means the file was brought up to date.
P means the file has been patched with the repository version.
A the file was added by you but not committed yet.
R the file was removed by you but not committed yet.
M the file has been modified by you but not committed yet.
C the file has been committed by you locally and in the repository so a conflict has occurred, more information on conflicts follows in the next part.
? the file is not part of the CVS project.

One thing to notice when you update is that you only get the changes in the files you already have locally. Any new files or directories will not be downloaded. To make sure you get those too you have to add an update specific option -d.

cvs -z3 up -d

The reason for not updating all files by default is that you sometimes don't want all files in a project and has explicitly checked out only a small portion of them, it can then be very annoying if the number of files just keeps increasing on each update.

Another option, which can be useful, is to stop the CVS program from recursing trough subdirectories. Sometimes you just want to perform an action in the local directory. To perform a non-recursive update you do

cvs -z3 up -l

which performs the update but only in the current directory.

One other handy trick you can do with the update command is to get a simple status report on the repository. Sometimes you're just curious if the CVS repository has changed in any way but don't want to do an actual update to find out. To do this you have to specify the global -n option. This option tells the CVS program not to perform any changes to the local files. We can then do

cvs -z3 -n up -d

we then get the same list of files as we do with a normal update but no files are changed. You can then easily pick out which files need patching, which ones are new and which ones are removed.


<< Previous page | 1 | 2 | 3 | < 4 > | 5 | Next page >> | Printer-friendly page |

Comment List


There are no comments.


Forgot your password?

Register a new user

Results

Polls