Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Summary of installation configuration and Operation commands of CVS under Linux

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "summary of installation, configuration and operation commands of CVS under Linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Before introducing the CVS command, let's say something else.

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

The method of modifying the management file is equivalent to the source code file, which is extracted and modified by CVS command.

The purpose of each file is described below:

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

Commitinfo when the cvs commit command is executed, this file specifies the command to be executed when the music file is submitted

Cvswrappers defines that a wrapper program is executed when a document is registered or seized.

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

History tracks all commands that affect the warehouse

Loginfo is similar to coimmitinfo, except that it is executed after the file is submitted

Modules allows you to define a symbol for a set of files, otherwise it must be for each file to be referenced

Specify a partial pathname (relative to $CVSROOT)

Nitify controls 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 can be executed after any / "tag/" operation.

Installation of CVS server

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

The code is as follows:

Rpm-Q cvs

If the version information of CVS appears, it proves that the installation has been successful.

The CVS server installation package can be downloaded from many places on the Internet, or from the official website of CVS. According to the system you are using, download the corresponding version and install it. Because our project uses CVS server for version management under Redhat Linux, this article will mainly introduce it based on Redhat Linux. First download the rpm package of the CVS server, of course, you can download other packages such as the source package, and then install it with the following command:

The code is as follows:

Rpm-ivh cvs-1.11.7-1.i386.rpm

Configuration of CVS server

The first thing to do after installation is to configure the configuration file of the CVS server to make it work. First, add cvspserver to the / etc/services file to make it a service of Linux, that is, the entry of 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 don't need to add them.

Configure xinetd to start the CVS authentication server with xinetd:

Go to the / etc/xinetd.d/ directory and edit a text file whose name must be the same as the entry name cvspserver in / etc/services, so use cvspserver as the file name, and 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

}

Test whether the cvspserver service is configured successfully after editing the file.

Execution

The code is as follows:

/ etc/init.d/xinetd restart

Restart the service, and after starting successfully, execute the following statement to verify that the service starts properly:

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 continue to output the following words

Cvs [pserver aborted]: bad auth protocol start: hi

Connection closed by foreign host.

The above phenomenon indicates that the CVS user authentication server has been configured successfully.

If the following words appear to indicate that the configuration is not successful, please re-check the above configuration:

Trying 127.0.0.1...

Telnet: connect to address 127.0.0.1: Connection refused

Environment variables of CVS

CVS uses several environment variables

The full pathname of the root directory of the CVSROOT repository

If CVSREAD is set, it indicates that all files are set to read-only during checkout operation.

CVSBIN CVS uses the command of Le many RCS to specify the path of Le RCS tool.

CVSEDITOR specifies the editor that users use to write log information

The name of the shell that CVS_RSH uses when starting a remote CVS server

Name of CVS_SERVER decision / "cvs server/", default is CVS

CVSWRAPPERS cvswrapper script, which is used to specify the wrapper file name.

Keyword

A technique for managing source files is called / keyword replacement /. After each / "cvs commit/" operation

Some keywords in the source file will be replaced with available words

$AUTHOR$ user name

Time of registration of $Data$

The first part of the $Header$ standard, containing the full pathname, date, and author of the RCS

$Id$ is the same as $Header$ except that the RCS file name is incomplete.

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

$RCSfile$ contains the file name of RCS, excluding the path name

Version number assigned by $Revision$

Full name of the $Source$ RCS file

The status of the version assigned by $State$, assigned by cvs admin-s.

Example:

Before cvs commit, there was in main.c.

Static char * rcsid=/ "$Id$/"

After performing the cvs commit

The career change of main.c is as follows:

Static char * rcsid=/ "$Id: main.c,v 1.2 15:10:14 trimblef Exp$/ on 1999-04-29"

Let's start with the commands of CVS.

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

Extract the specified files from the warehouse to the current directory, establish the same structure, and create the CVS directory

Example

The code is as follows:

Bash$ cvs checkout project

Bash$ cvs checkout project/src/main

For convenience, we can create an abbreviation for a directory by modifying the

Modules file. (done with the 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 instead.

Cvs checkout project/src/print

The cvs checkout command gets the latest version by default. We can also get an old version.

The code is as follows:

Cvs checkout-r 1.1 print

Take out the code of version 1.1 of print.

For the detailed usage of cvs checkout, see the output of cvs-H checkout.

CVS commit command

After the modification of the file is completed, submit it to the warehouse with cvs commit.

The code is as follows:

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

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

After the submission is completed, the current version number will be updated, such as 1. 1, now 1. 2. Both versions are available in

On the backbone of the warehouse (maintrunk).

The-m option records comments about the submission. If the-m option is not specified, in the environment variable CVSEDITOR

The editor specified in is called (vi is the default) to prompt for text and modify record comments.

CVS update

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

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

For changes made by another person (already in the warehouse), cvs update is available.

The code is as follows:

Cvs update

CVS tag, CVS rtag

Creating branches allows users to modify some files without affecting the trunk (when commit).

To create a branch, first create a tag for some files to be modified. The tag is a symbol assigned to a file or group of files. During the life cycle of the source code, the files that make up a set of modules are assigned the same tag.

Create tags: execute cvs tag in the working directory

Example: create a tag 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: create a branch

-r release-1-0: specifies a label that exists

Releas-1-0-patch: branch

Print: module name

Merge

Use the cvs update-j option to merge changes on the branch with the local file copy.

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 inform other developers that this module is no longer in use.

The code is as follows:

Cvs release-d print

-d: deletin

Print: directory

Conflict

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

When you modify the same line of the same file at the same time.

At this point, if you update with cvs update, CVS detects the existence of a conflict, and it will change the conflicting code

Marked with / "/". At this point, you need to process this code manually. And cause

Developers in conflict can negotiate and modify the file and then submit it with cvs commit.

This is the end of the summary of the installation configuration and operation commands of CVS under Linux. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report