Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Cederqvist P.Version management with CVS 1.11.21.pdf
Скачиваний:
4
Добавлен:
23.08.2013
Размер:
1.11 Mб
Скачать

Chapter 2: The Repository

17

The most important of these files is the ‘modules’ file. It defines all modules in the repository. This is a sample ‘modules’ file.

CVSROOT

CVSROOT

modules

CVSROOT modules

cvs

gnu/cvs

rcs

gnu/rcs

diff

gnu/diff

tc

yoyodyne/tc

The ‘modules’ file is line oriented. In its simplest form each line contains the name of the module, whitespace, and the directory where the module resides. The directory is a path relative to $CVSROOT. The last four lines in the example above are examples of such lines.

The line that defines the module called ‘modules’ uses features that are not explained here. See Section C.1 [modules], page 135, for a full explanation of all the available features.

2.4.1 Editing administrative files

You edit the administrative files in the same way that you would edit any other module. Use ‘cvs checkout CVSROOT’ to get a working copy, edit it, and commit your changes in the normal way.

It is possible to commit an erroneous administrative file. You can often fix the error and check in a new revision, but sometimes a particularly bad error in the administrative file makes it impossible to commit new revisions.

2.5 Multiple repositories

In some situations it is a good idea to have more than one repository, for instance if you have two development groups that work on separate projects without sharing any code. All you have to do to have several repositories is to specify the appropriate repository, using the CVSROOT environment variable, the ‘-d’ option to cvs, or (once you have checked out a working directory) by simply allowing cvs to use the repository that was used to check out the working directory (see Section 2.1 [Specifying a repository], page 7).

The big advantage of having multiple repositories is that they can reside on di erent servers. With cvs version 1.10, a single command cannot recurse into directories from di erent repositories. With development versions of cvs, you can check out code from multiple servers into your working directory. cvs will recurse and handle all the details of making connections to as many server machines as necessary to perform the requested command. Here is an example of how to set up a working directory:

cvs -d server1:/cvs co dir1 cd dir1

cvs -d server2:/root co sdir cvs update

The cvs co commands set up the working directory, and then the cvs update command will contact server2, to update the dir1/sdir subdirectory, and server1, to update everything else.

18

CVS—Concurrent Versions System v1.11.21

2.6 Creating a repository

This section describes how to set up a cvs repository for any sort of access method. After completing the setup described in this section, you should be able to access your cvs repository immediately via the local access method and several remote access methods. For more information on setting up remote access to the repository you create in this section, please read the section on See Section 2.9 [Remote repositories], page 19.

To set up a cvs repository, first choose the machine and disk on which you want to store the revision history of the source files. CPU and memory requirements are modest, so most machines should be adequate. For details see Section 2.9.1 [Server requirements], page 19.

To estimate disk space requirements, if you are importing RCS files from another system, the size of those files is the approximate initial size of your repository, or if you are starting without any version history, a rule of thumb is to allow for the server approximately three times the size of the code to be under cvs for the repository (you will eventually outgrow this, but not for a while). On the machines on which the developers will be working, you’ll want disk space for approximately one working directory for each developer (either the entire tree or a portion of it, depending on what each developer uses).

The repository should be accessible (directly or via a networked file system) from all machines which want to use cvs in server or local mode; the client machines need not have any access to it other than via the cvs protocol. It is not possible to use cvs to read from a repository which one only has read access to; cvs needs to be able to create lock files (see Section 10.5 [Concurrency], page 67).

To create a repository, run the cvs init command. It will set up an empty repository in the cvs root specified in the usual way (see Chapter 2 [Repository], page 7). For example,

cvs -d /usr/local/cvsroot init

cvs init is careful to never overwrite any existing files in the repository, so no harm is done if you run cvs init on an already set-up repository.

cvs init will enable history logging; if you don’t want that, remove the history file after running cvs init. See Section C.9 [history file], page 148.

2.7 Backing up a repository

There is nothing particularly magical about the files in the repository; for the most part it is possible to back them up just like any other files. However, there are a few issues to consider.

The first is that to be paranoid, one should either not use cvs during the backup, or have the backup program lock cvs while doing the backup. To not use cvs, you might forbid logins to machines which can access the repository, turn o your cvs server, or similar mechanisms. The details would depend on your operating system and how you have cvs set up. To lock cvs, you would create ‘#cvs.rfl’ locks in each repository directory. See Section 10.5 [Concurrency], page 67, for more on cvs locks. Having said all this, if you just back up without any of these precautions, the results are unlikely to be particularly dire. Restoring from backup, the repository might be in an inconsistent state, but this would not be particularly hard to fix manually.

When you restore a repository from backup, assuming that changes in the repository were made after the time of the backup, working directories which were not a ected by the

Соседние файлы в предмете Электротехника