Essential CVS (Essentials)

   

This chapter explains how CVS can be used for source or content control ” how to manage a group of developers working together on a project without having them overwrite each other's work, causing loss of data. It also describes commands that show what each person has done to a file.

The problem of source control occurs when you don't have any management software. If you have a central location for data and two people are using the same storage, such as the same file, the second person to save a file can overwrite the first person's changes. Source control software can prevent this, by either capturing both sets of changes and merging them together, or by preventing two people from having the same file checked out at the same time.

CVS is designed to allow developers to work simultaneously on a file. Several people can work on the same file, each in their own sandbox, and CVS tries to merge their changes to the data in the central repository. If the changes can't be merged easily, the developer who commits the second set of changes is asked to resolve the conflict. This pattern is explained in Chapter 3.

An alternative to simultaneous development is exclusive development, where one developer at a time has the editing rights for a file. Some development teams prefer to use exclusive development, which is effective for files that can't be merged. CVS supports the exclusive development of files with a choice of two methods :

Whether you use exclusive or simultaneous development, source control works only if your project members use it. It is also essential that they communicate the basic design and structure of the project with each other. No source control system can take the place of a shared vision of the project.

Once you are working in a team, you need to be able to see the changes made by other team members. Studying the history of changes can help keep the team working toward the same goals, or it can help determine where the team's goals have diverged. CVS provides a range of commands for viewing changes.

The diff and rdiff commands display the changes made between specific revisions of a file and also allow you to make patches that can be installed with the GNU patch program. The annotate command displays the most recent change to each line of a file, along with the revision number of the revision in which the line was changed and the username of the user who made the change. The log command displays the log messages and status information for files.


   
Top

Категории