Full resolution of CVS installation configuration and Operation commands under Linux

Source: Internet
Author: User
Tags commit wrapper root directory

Before you introduce the CVS command, say something else.

As previously said, the warehouse in addition to the music source files, but also includes a series of management documents. Located in $cvsroot/cvsroot

The method of modifying a management file is equivalent to a source code file, extracted and modified using CVS commands.

The purpose of each file is described below:

Checkoutlist supports other management files for the Cvsroot directory, allowing you to set up information for various CVS commands

Commitinfo when the CVS commit command executes, this file specifies the command to execute when the file is submitted

Cvswrappers definition Le a wrapper is executed when a file is registered or seized.

Editinfo allows you to execute a script before the commit command is recorded before the log information is logged

History track all commands that affect the warehouse

Loginfo similar to Coimmitinfo, only executed after file submission

Modules allows you to define a symbol for a set of files, or you must use each file you want to refer to

Specify partial path names (relative to $cvsroot)

Nitify controls the notifications from/"watch/"./"watch/" by/"CVS watch add/" and/"CVS edit/"

Set up

RCSINFO specifies a template for the commit log reply.

Taginfo defines a program that is executed after any/"tag/" operation.

Installation of a CVS server

By default, CVS is installed in Redhat Linux, which can be run on the Linux command line:

The code is as follows:

Rpm–q CVS

If the CVS version information appears, it will prove that the installation is successful.

The CVS server installation package can be downloaded from many places on the web, or to the official CVS website. Depending on the system you are using, download the appropriate version and install it. Since our project is using CVS server for versioning under Redhat Linux, this article will mainly be based on Redhat Linux. First download the CVS server's RPM package, of course, you can download other packages such as the source package, and then use the following command to install:

The code is as follows:

RPM-IVH cvs-1.11.7-1.i386.rpm

Configuration of the CVS server

The first thing to do after installation is to configure the CVS server's configuration file to work properly. First, add Cvspserver to the/etc/services file to make it a Linux service, which is the portal to the CVS server routine, configured as follows:

Cvspserver 2401/TCP # CVS Client/server operations

Cvspserver 2401/UDP # CVS Client/server operations

If the above two lines of text already exist in the file, you do not need to add them.

Configure XINETD to start the CVS authentication server with xinetd:

Go to the/etc/xinetd.d/directory, and then edit a text file, the name must be consistent with the/etc/services in the entry name Cvspserver, so here with Cvspserver as the file name, the contents of the file are as follows:

The code is as follows:

Service Cvspserver

{

Disable = no

Flags = Reuse

Socket_type = Stream

wait = no

user = root

Server =/usr/bin/cvs

Server_args =-F--allow-root=/usr/cvsroot pserver

Log_on_failure + + USERID

}

After you edit the file, test that the Cvspserver service is configured successfully.

Perform

The code is as follows:

/etc/init.d/xinetd restart

Restart the service, and after the startup succeeds, execute the following statement to verify that the service is starting correctly:

The code is as follows:

telnet localhost 2401

If the following words appear:

Trying 127.0.0.1 ...

Connected to localhost.

Escape character is ' ^] '.

Enter Hi and will continue to output the following words

CVS [PServer aborted]: Bad Auth protocol Start:hi

Connection closed by foreign host.

The above symptoms indicate that the CVS user authentication server has been configured successfully.

If the following words appear, indicating that the configuration is unsuccessful, please check the above configuration again:

Trying 127.0.0.1 ...

Telnet:connect to address 127.0.0.1:connection refused

Environment variables for CVS

CVS use le several environment variables

Cvsroot the full path name of the warehouse root directory

Cvsread if set to indicate that all files are placed read-only when checkout operation

Cvsbin CVS uses the Le many RCS commands to specify the path of the Le RCS tool

Cvseditor the editor used to specify the user writing log information

Cvs_rsh the name of the shell to use when starting a remote CVS server

Cvs_server decision/"CVS server/" name, default is CVS

Cvswrappers cvswrapper script to specify the wrapper file name.

Key words

One technique for managing source files is called/"keyword replacement/". After each execution/"CVS commit/" operation

Some keywords from the source file are replaced with the words that are available

$AUTHOR $ user Name

$Data $ Time of registration

$Header $ standard header that contains the full pathname of the RCS, date, author

$Id $ with $header$ except for incomplete RCS file names.

$Log $ contains the full pathname, version number, date of the RCS, the author, and the log information provided at the time of submission.

$RCSfile $ file name containing RCS, excluding path names

$Revision $ assigned version number

Full name of $Source $ RCS file

$State $ The status of the version assigned, which is assigned by the CVS Admin-s.

Cases:

Before the CVS commit, MAIN.C had

static char *rcsid=/"$Id $/";

After performing a CVS commit

MAIN.C changes to:

static char *rcsid=/"$ID: Main.c,v 1.2 1999/04/29 15:10:14 Trimblef";

Now, let's start with the CVS command.

We have the following warehouse data as an example

$CVSROOT

--cvsroot

--project

--src

--main

--main.c

--main.h

--print

--print.c

--print.h

--term

--term.c

--term.h

CVS Checkout Command

Extracts the specified files from the warehouse to the current directory, establishes the same structure, and creates a CVS directory

Cases

The code is as follows:

bash$ CVS Checkout Project

bash$ CVS Checkout Project/src/main

For ease of use, we can create an abbreviation for a directory by modifying the $cvsroot/cvsroot/

Modules files. (complete with CVS command, of course)

The code is as follows:

CVS Checkout Cvsroot/modules

CD Cvsroot

VI Modules

We added at the end of the file

The code is as follows:

SRC project/src

Print Project/src/print

CVS Commit

In the future, we can use CVS checkout print to replace

CVS Checkout Project/src/print

The CVS Checkout command defaults to getting the latest version. We can also get some old version

The code is as follows:

CVS Checkout-r 1.1 Print

Remove the 1.1 version of the print code.

The detailed usage of CVS checkout is shown in the output of cvs-h checkout.

CVS Commit Command

After the modification of the file is completed, commit to the warehouse with a CVS commit.

The code is as follows:

CVS commit-m/"Update by xxxxx/" project

CVS commit-m/"Update main.c/" main.c

When the submission is complete, the current version number is updated, such as 1.1, now 1.2. These two versions are in

The trunk of the warehouse (Maintrunk).

The-m option can record comments about submissions. If the-m option is not specified, in the environment variable Cvseditor

The editor specified in is called (vi is the default), prompting you to type text and modify the record annotation.

CVS Update

CVS allows multiple people to modify a file at the same time.

Assuming that the mud is modifying part of the file, now you want to merge and update your local copy (checkout) and

Changes made by another person (already in the warehouse), available CVS update

The code is as follows:

CVS Update

CVS tag, CVS Rtag

Creating a branch allows users to modify some files without affecting the backbone (when commit).

Create a branch first create a label (tag) for some of the files that you intend to modify, which is the symbol assigned to a file or group of files. In the lifecycle of the source code, the files that make up a set of modules are assigned the same label.

Create tags: perform CVS tag in the working directory

Example: Create a label for SRC:

The code is as follows:

CVS Checkout src

CVS Tag release-1-0

Once the label is created, you can create a branch for it:

The code is as follows:

CVS Rtag-b-R release-1-0 Release-1-0-path Print

-B: Creating a Branch

-R release-1-0: Specifies the existing label

Releas-1-0-patch: Branch

Print: module name

Merge

Use the CVS update-j option to merge changes on the branch with local file copies.

The code is as follows:

CVS Update-j release-1-0 print.c

CVS Release

After making the necessary modifications to the source file, you can delete the local working copy with CVS release

and notify other developers that this module is no longer in use.

The code is as follows:

CVS release-d Print

-D: Delete

Print: Table of Contents

Conflict

Because CVS allows multiple people to modify the same file at the same time, conflicts are unavoidable. For example when two people

Modifies the same row of the same file at the same time.

At this point, as with the CVS update, CVS detects the existence of a conflict that will conflict the code

With/"<<<<<<<<<<<<<< >>>>>>>>>>> >>>/"identification. This code needs to be handled manually. and caused

The conflicting developer negotiates, and the file is modified to be submitted with a CVS commit.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.