CVS User Manual

Source: Internet
Author: User
Tags bug tracking system file diff ssh port ssh server version control system

CVS User Manual
Keywords: CVs Cvsweb cvstrac wincvs cvsroot

Summary:

CVS is a C/S system. Multiple developers use a central version control system to record file versions to ensure file synchronization. The working mode is as follows:

CVS server (file version Library)

/|/

(Same step for Version)

/|/

Developer 1 developer 2 Developer 3

As a general developer, you can select, And the CVS administrator needs to know more. Finally, we also briefly introduce the use of CVS clients in windows and remote users in CVS.

Authentication selection and integration with development environments such as bug tracking systems.

Initialize the CVS environment: Set up the administrator of the CVS Environment

Routine Use of CVS: the most commonly used CVS command in daily development, developer Administrator

Branch development of CVS: The project is administrator Based on Different progress and target concurrency

CVS user authentication: Remote User Authentication through SSH, secure, simple Administrator

Cvsweb: CVS Web access interface greatly improves code version comparison Efficiency Administrator

CVS Tag: add $ ID $ to code comments to track developers during the development process

CVS vs VSS: Comparison between CVs and virsual sourcesafe, developer Administrator

Wincvs: Set wincvs Authentication through SSH

Build a group development environment based on cvstrac: Implement CVS user management on the web interface through cvstrac, and integrate BUG Tracking and Wiki Communication

User permission management in CVS: system user-based CVS permission management and cvsroot/passwd-based virtual user management

20% of a system's functions often meet 80% of the requirements, and CVS is no exception. The following are the most common features of CVs, and may not reach 20% of all its command options.

It is enough to use CVS update and CVS commit. More requirements will naturally appear in the actual application process. Looking back at the relevant documents from time to time, there are often unexpected gains.

CVS environment Initialization

Environment setting: Specifies the path of the CVS library cvsroot

Tcsh

Setenv cvsroot/path/to/cvsroot

Bash

Cvsroot =/path/to/cvsroot; export cvsroot

The remote CVS server settings are also described below:

Cvsroot =: ext: $ USER@test.server.address # port:/path/to/cvsroot cvs_rsh = SSH; export cvsroot cvs_rsh

Initialization: the initialization of the CVS version library.

CVS init

First import of a project

CVS import-M "write some comments here" project_name vendor_tag release_tag

After execution: all source files and directories will be imported to the/path/to/cvsroot/project_name directory.

Vender_tag: developer tag

Release_tag: Version release tag

Export Project: Export Code from the CVS Library

CVS checkout project_name

CVs will create the project_name directory and export the source code of the latest version to the corresponding directory. Check out in this checkout and virvual sourcesafe is not a concept,

Compared with virvual sourcesafe, check out is CVS update, and check in is CVS commit.

Routine Use of CVS

Note: after the first export, instead of Synchronizing files through CVS checkout, you need to go to the project_name directory exported by CVS checkout project_name.

Synchronize (ADD, modify, and delete) versions of specific files.

Synchronize files to the latest version

CVS update

If no file name is specified, CVs will synchronize the files in all subdirectories. You can also specify a file name/directory for synchronization.

CVS update file_name

It is recommended that you do this once a day before starting work or importing your work to the CVS repository, and develop the habit of "Synchronize and modify". Unlike virvual sourcesafe

The concept of File Locking. All conflicts are resolved before commit. If someone else modifies the file and commit it to the CVS library during the modification, CVs will notify you of file conflicts and automatically

Use conflicting parts

>>>>>>

Content on CVS server

>>>>>

Mark the conflict content.

Version conflicts are generally caused by modifying one file by multiple people, but such project management problems should not be solved by CVS.

Confirm to write the modification to the CVS Library

CVS commit-M "write some comments here" file_name

Note: many actions of CVs are confirmed and modified through CVS commit. It is best to modify only one file at a time. Before confirmation, you also need to enter the modification notes to help

Other developers understand the reasons for the change. If you directly confirm 'cvs commit file_name 'without writing-M "Comments", CVS automatically calls the default text editor (

Usually VI) requires you to write comments.

The quality of comments is very important: So not only do you have to write, but you also have to write something meaningful: to make it easier for other developers to understand.

It is difficult for other developers to quickly understand bad comments, such as-M "bug fixed" or-m ""

Good comments can even be used in Chinese:-M "added email address verification during user registration"

Modify a version comment: it is a good habit to confirm that only one file is sent to the CVS library at a time, but sometimes you forget to specify the file name and comment multiple files to the CVS library as well.

The following command allows you to modify the comment of a certain version of a file:

CVS admin-M 1.3: "write some comments here" file_name

Add File

After creating a new file, for example, touch new_file

CVS add new_file

Note: For images, Word documents, and other non-plain text items, use the CVS add-kb option to import files in binary format (k indicates the extension option, and B indicates the binary type ), otherwise it is possible

File Corruption

For example:

CVS add-kb new_file.gif

CVS add-kb readme.doc

What if the keyword replacement attribute is set incorrectly during the first import?

CVS admin-KKV new_file.css

Then confirm the modification and comment out

CVS ci-M "write some comments here"

Delete an object

After a source file is physically deleted, for example, RM file_name

Cvs rm file_name

Then confirm the modification and comment out

CVS ci-M "write some comments here"

The method for merging the preceding two steps is as follows:

CVS Rm-F file_name

CVS ci-M "why delete file"

Note: Many CVS commands are abbreviated to commit => Ci; update => up; checkout => Co/get; remove => RM;

Add directory

CVS add dir_name

View modification history

CVS log file_name

CVS history file_name

View differences between different versions of the current file

CVS diff-r1.3-r1.5 file_name

View the differences between the current file (which may have been modified) and the corresponding file in the library

CVS diff file_name

The CVS Web interface provides a more convenient way to locate the differences between file modification and version comparison. For specific installation settings, see the Cvsweb usage later.

The correct method to restore the old version through CVS:

If CVS Update-r1.2 file. Name is used

This command adds a stick tag to file. Name: "1.2", although you only want to restore it to version 1.2.

The correct method to restore the version is: CVs Update-p-r1.2 file_name> file_name

If you have accidentally added the stick tag, use CVS Update-a to solve the problem.

Rename a mobile file/File

CVS does not include CVS move or CVS rename, because these two operations can be implemented by first CVS remove old_file_name and then CVS add new_file_name.

Delete/move a directory

The most convenient method is to allow the Administrator to directly move and delete the corresponding directories in the cvsroot (because the subdirectories of a CVS project are independent, they can all be used as new directories in the $ cvsroot directory.

Independent project: similar to a tree, in fact, any shard can survive independently), after modifying the directory, ask its developers to re-export the project CVS checkout

Project_name or use CVS Update-DP for synchronization.

Project release export source files without the CVS directory

During development, you may notice that CVS creates a CVS/directory under each Development Directory. There are files used to record the corresponding information between the current directory and the CVS library. But the project

Generally, you do not want to include the file directory with the CVS directory containing CVS information during the release. This one-time export process uses the CVS Export command, but export can only be used for one

Tag or date export, for example:

CVS export-r release1 project_name

CVS export-D 20021023 project_name

CVS export-D now project_name

CVS branch: synchronous development of multiple branch projects

Confirm version milestones: The version numbers of multiple files are different. When the project reaches a certain stage, you can specify a milestone version number for all files so that you can follow the milestones in the future.

The version number of the Project is exported, which is also the basis for the development of multiple branches of the project.

CVS tag release_1_0

Start a new milestone:

CVS commit-R 2 mark all files and start development in 2.x

Note: The revsion in CVS does not have a direct relationship with the released version of the software package. However, it is easier to maintain the version of all files with the same version as the released version.

Build a version Branch

When the 2.x version of the Development Project is found to have a problem with 1.x, but 2.x does not dare to use it, export a branch release_1_0_patch from the milestone marked earlier: release_1_0

CVS rtag-B-r release_1_0 release_1_0_patch proj_dir

Some people first export the release_1_0_patch branch in another directory: solve the urgent problem in 1.0,

CVS checkout-r release_1_0_patch

Others are still developed on the main branch 2. x of the project.

Correct the error on release_1_0_patch and mark a 1.0 Error Correction version.

CVS tag release_1_0_patch_1

If 2.0 thinks that these errors are also required to be modified in 2.0, you can also merge the changes in release_1_0_patch_1 in the Development Directory of 2.0 to the current code:

CVS Update-J release_1_0_patch_1

Remote Authentication of CVS remote access to CVS through SSH

It is difficult to use pserver-based Remote Authentication in CVS. You need to define the server and user group, user name, and password,

Common login formats are as follows:

CVS-D: pserver: cvs_user_name@cvs.server.address:/path/to/cvsroot Login

Example:

CVS-D: pserver: cvs@samba.org:/cvsroot Login

It is not safe, so it is generally used as an anonymous read-only CVS access method. In terms of security, it is better to pass the local account authentication and SSH transmission.

Set the following content in/etc/profile:

Cvsroot =: ext: $ USER@cvs.server.address # port:/path/to/cvsroot cvs_rsh = SSH; export cvsroot cvs_rsh

All local users of all clients can map to corresponding accounts with the same name on the CVS server.

For example:

The CVS server is 192.168.0.3. The cvsroot path above is/home/cvsroot, and the other development client is 192.168.0.4. If Tom has an account of the same name on both machines,

Then we set the following from 192.168.0.4:

Export cvsroot =: ext: tom@192.168.0.3:/home/cvsroot

Export cvs_rsh = SSH

Tom can directly access the cvsroot of 192.168.0.3 on 192.168.0.4 (if you have the permission)

CVS checkout project_name

CD project_name

CVS update

...

CVS commit

If the ssh port on the server where CVS is located is not the default 22, or is inconsistent with the default ssh port on the client and the CVS server, it is sometimes set:

: Ext: $ USER@test.server.address # port:/path/to/cvsroot

The error message is as follows:

SSH: Test. server. Address # port: Name or service not known

CVS [checkout aborted]: End of file from server (consult abve messages if any)

The solution is to make a script to specify port redirection (if alias is not available, the file cannot be found ):

Create a/usr/bin/ssh_cvs file. Assume that the ssh port of the remote server is not the default port: 34567.

#! /Bin/sh

/Usr/bin/ssh-P 34567 "$ @"

Then: chmod + x/usr/bin/ssh_cvs

And cvs_rsh = ssh_cvs; export cvs_rsh

Note: Port refers to the SSH port of the corresponding server, not the pserver port dedicated to CVS.

Cvsweb: Improves file browsing efficiency

Cvsweb is the CVS Web interface, which can greatly improve the efficiency of programmers in locating and modifying:

The sample can be seen: http://www.freebsd.org/cgi/cvsweb.cgi

Download Cvsweb: Cvsweb has evolved from the original version into a richer multi-functional interface version. This is my personal feeling that the installation settings are more convenient:

Originally in: Workshop

The Cvsweb project has had a better development. At the beginning, the version of FreeBSD was not used because there was no color file diff function.

Download and unpack:

Tar zxf Cvsweb. tgz

Put the configuration file Cvsweb. conf in a safe place (for example, in the same directory as Apache configuration ),

Modify: Cvsweb. cgi allows CGI to find the configuration file:

$ Config = $ ENV {''cvsweb _ config''} | ''/path/to/Apache/CONF/Cvsweb. conf '';

Go to/path/to/Apache/conf and modify Cvsweb. conf:

Modify the cvsroot path settings:

% Cvsroot = (

''Development'' => ''/path/to/cvsroot'', #"1 ",#

Authname "CVS authorization"

Authtype basic

Authuserfile/path/to/Cvsweb. passwd

Require valid-user

CVS tags: $ ID: cvs_card.html, V 1.5 2003/03/09 08:41:46 chedong exp $

Adding $ ID: cvs_card.html, V 1.9 2003/11/09 07:57:11 chedong exp $ to the comments at the beginning of the program file is a good habit. CVs can automatically explain and update its

The content is in the format of file_name version time user_name, such as cvs_card.txt, v 1.1 2002/04/05 04:24:12 chedong exp.

Last object modifier and modification time

Several common default files: Default. php

2003/11/09 07:57:11 chedong exp $ */?> ============================================ Default. java: note that the file header is usually annotated with/* to start javadoc.

Comments/** start difference/** copyright (c) 2002 mycompany name. * $ header:/home/cvsroot/Tech/cvs_card.html, V 1.9 2003/11/09

07:57:11 chedong exp $ */package com. mycompany; import java.;/*** comments here */public class default {/***

Comments here * @ Param * @ return */Public tostring (){}}

============================================ Default. pl :#! /Usr/bin/perl-W # copyright (c) 2002 company name. # $ header:

/Home/cvsroot/Tech/cvs_card.html, V 1.9 2003/11/09 07:57:11 chedong exp $ # file comments hereuse strict;

CVS vs VSS

CVS does not have the file lock mode. vss simultaneously records the file to be locked by the Export owner while checking out.

CVS update and commit, VSS is get_lastest_version and check in

The CVS corresponding to the checkout/undo check out of VSS is edit and unedit.

In CVs, the automatic update function is enabled by default, which also brings about a potential problem. If binary files are not added using the-kb method, automatic update of CVS may result in

Invalid parts.

$ Header:/home/cvsroot/Tech/cvs_card.html, V 1.5 2003/03/09 08:41:46 chedong exp $ Date: 2003/11/09 07:57:11 $

In virsual sourcesafe, it is called keyword explaination. It is disabled by default. You need to enable it through opition and specify the file type for keyword scanning of the source file:

*. Txt, *. Java, *. html...

Tags common to both virsual sourcesafe and CVs are:

$ Header:/home/cvsroot/Tech/cvs_card.html, V 1.5 2003/03/09 08:41:46 chedong exp $

$ Author: chedong $

$ Date: 2003/11/09 07:57:11 $

$ Revision: 1.9 $

I suggest using common keywords whenever possible to ensure that code can be easily tracked in CVs and VSS.

Wincvs

Download:

CVS Windows Client: stable version 1.2

Http://cvsgui.sourceforge.net

SSH Windows Client

Http://www.networksimplicity.com/openssh/

After the above two software are installed:

Admin ==> preference settings of the wincvs Client

1. In the general menu

Set cvsroot: username@192.168.0.123:/home/cvsroot

Set authorization: Select SSH Server

2 Port

HOOK: Check for alternate RSH name

Set the ssh.exe path, which is installed in C:/program files/networksimplicity/ssh/ssh.exe by default.

Then you can use wincvs to perform the CVS operation. All operations will jump out of the command line window and require you to enter the authentication password on the server.

Of course, if you think this is annoying, another way is to generate a public/private key pair without a password, and set CVS to use SSH Authentication Based on the public/private key (in general

Menu ).

Optional diff tool: examdiff

Download:

Http://www.prestosoft.com/examdiff/examdiff.htm

In the wincvs menu admin ==> preference, choose wincvs.

Selected: externel diff Program

And set the diff tool path, such as: C:/program files/ed16i/examdiff.exe

When diff is applied to a file, you need to select use externel diff in the lower right corner of the window for the first time.

Establish a group development environment based on cvstrac

As a group-level development environment, Version Control Systems and bug tracking systems all involve user authentication. It is very difficult to easily integrate these systems,

After all, we cannot expect a version control/BUG Tracking integration system that is as integrated as source offsite in Linux.

I personally disagree with remote user authentication in pserver mode, but if most of the team members use Windows clients for development, cvsroot/passwd authentication is generally used.

It is still difficult to avoid, but it is troublesome to manage CVS users. Originally, I planned to write a management interface using Perl until I found cvstrac: a Web-based interface bug.

Tracking System, which is plug-in to the bug tracking system on the CVS system, including managing cvsroot/passwd files on the web interface, and even integrating the wikiwiki discussion group function.

Here we will first talk about user authentication in the pserver mode of CVS. The user authentication service of CVS is based on inetd:

Cvspserver stream tcp Nowait Apache/usr/bin/CVS CVs -- allow-root =/home/cvsroot pserver

It is generally on port 2401 (this port number is very memorable: the square of 49)

The CVS user database is based on the cvsroot/passwd file. The file format is as follows:

[Username]: [crypt_password]: [mapping_system_user]

Since the passwords are encrypted using the UNIX standard crypt, the format of this passwd file is basically an extension of the Apache htpasswd format (one more system than the Apache passwd file)

User ing field), so the simplest method of this file can be used

Apache/bin/htpasswd-B myname mypassword

Create. Note: The file created by using htpasswd does not have a field mapped to the System user.

For example:

New: gebvosup/zkl2

Setup: aisqunaaoy3qw

Test: hwepz/BX. redu

The purpose of the ing system user is: you can create a dedicated CVS service account, for example, run the user Apache with Apache, and grant all permissions under the/home/cvsroot directory

This user creates different development user accounts in the passwd file, but the final file read and write permissions of the development user account are mapped to Apache users. In SSH mode, multiple systems are enabled.

Users must be in the same group to read and write files in the CVS library to each other.

Further, You can map users to the Apache system users.

New: gebvosup/zkl2: Apache

Setup: aisqunaaoy3qw: Apache

Test: hwepz/BX. redu: Apache

Cvstrac solves the problem of cvsroot/passwd management. It also includes a bug tracking report system and integrated wikiwiki communication functions.

Under GNU Public License:

Add the cvspserver service to inetd:

Cvspserver stream tcp Nowait Apache/usr/bin/CVS CVs -- allow-root =/home/cvsroot pserver

Xietd configuration file: % cat cvspserver

Service cvspserver

{

Disable = No

Socket_type = stream

Wait = No

User = Apache

Server =/usr/bin/CVS

Server_args =-f -- allow-root =/home/cvsroot pserver

Log_on_failure + = userid

}

Note: The purpose of setting this parameter to Apache is to be consistent with that of all users of/home/cvsroot, and this user must pair the cvsroot/passwd and

The myproj. DB generated during cvstrac initialization has the read permission.

Installation Process

Download: Download from http://www.cvstrac.org

I am using an application package that has been compiled on Linux: cvstrac-1.1.2.bin.gz,

% Gzip-D cvstrac-1.1.2.bin.gz

% Chmod + x cvstrac-1.1.2.bin

# Music cvstarc-1.1.1.bin/usr/bin/cvstrac

For source code compilation:

Download the SQLite RPM package from the http://www.sqlite.org/download.html:

Rpm-I sqlite-devel-2.8.6-1.i386.rpm

Download package from ftp://ftp.cvstrac.org/cvstrac/

Unpackage, assume that the unpackage is under/home/chedong/cvstrac-1.1.2, and plan to install cvstrac under/usr/local/bin directory, CD/home/chedong/cvstrac-1.1.2

Series linux-gcc.mk:

Modify:

Srcdir =/home/chedong/cvstrac-1.1.2

Installdir =/usr/local/bin

Then

Music linux-gcc.mk makefile

Make

# Make install

Initialize the cvstrac database. Assume that the database name is myproj.

On the installed CVS server (the CVS library should have been initialized at this time, for example, the CVS init is initialized in/home/cvsroot), run it.

% Cvstrac init/home/cvsroot myproj

After running, the/home/cvsroot will have a myproj. DB library that uses the cvstrac service,/home/cvsroot/myproj. DB/home/cvsroot/readers

/Home/cvsroot/writers/home/cvsroot/passwd files should be writable for Web Service running users. On redhat8

An Apache user and an Apache Group are called. Therefore, the httpd. conf file sets the Apache user to run the Web Service:

User Apache

Group Apache,

Set the user to be in the Apache user group and the Apache Group.

# Chown-r Apache: Apache/home/cvsroot

-RW-r -- 1 Apache 55296 Jan 5 myproj. DB

Drwxrwxr-x 3 Apache 4096 Oct 24 cvsroot/

Drwxrwxr-x 2 Apache 4096 Aug 30 some_proj/

In addition, you have set the following parameters in/home/cvsroot:

Chmod 664 readers writers passwd

Create the script cvstrac in the Apche/cgi-bin directory:

#! /Bin/sh

/Usr/bin/cvstrac cgi/home/cvsroot

Set the script to execute:

Chmod + x/home/Apache/cgi-bin/cvstrac

Entering the management interface from http://cvs.server.address/cgi-bin/cvstrac/myproj

Default Login Name: Setup password setup

For general users:

Http://cvs.server.address/cgi-bin/cvstrac/myproj

After you reset the cvsroot path in setup,/home/cvsroot

If the file is used for the first time, you need to create the passwd, readers, and writers files under/home/cvsroot.

Touch passwd readers writers

Then set the user that belongs to Apache,

Chown Apache. Apache passwd readers writers

After the setup user is used to create a new user, the account under cvsroot/passwd will be updated synchronously.

Change the logon password and report bugs,

You can learn more about the usage details.

For the wincvs mentioned above, set in perference:

Cvsroot field input: username@ip.address.of.cvs:/home/cvsroot

Authenitication: Use passwd file on server side

You can perform the CVS operation on the server.

CVS user permission management

CVS has two permission management policies:

System User Management Based on System File Permissions: Suitable for development by multiple developers who use system accounts on Linux.

Virtual user management based on cvsroot/passwd: Suitable for multiple developers on Windows platforms to map accounts to system accounts.

Why are Apache/Apache users used? First, redhat8 is available by default, and this user can easily perform Web management through cvstrac.

Chown-r Apache. Apache/home/cvsroot

Chmod 775/home/cvsroot

Multiple developers who connect to the CVS server through SSH on Linux: Share and read files through the Apache Group

Developers have a system account on the Development Server: sysuser1 sysuser2, which makes them belong to the Apache Group, because all newly imported projects through CVs are open to the group: 664 Permissions

In this way, no matter the project file imported by the System user, as long as the file group host is Apache, all other system development users in the same group can read and write; ssh-based Remote Authentication is also

Same.

Apache (system group)

/|/

Sysuser1 sysuser2 sysuser3

Multiple developers connecting to the CVS server through cvspserver on Windows: Through ing the passwd file to Apache users, the files can be shared and read and written.

Their accounts are managed through files such as cvsroot/passwd and readers writers, and all virtual users are mapped to Apache users through cvstrac.

Apache (system user)

/|/

Windev1 windev2 windev3

CVS + (wincvs/Cvsweb/cvstrac) is used to form a relatively complete cross-platform workgroup development version control environment.

Related Resources:

CVS home:

Http://www.cvshome.org

Cvs faq:

Http://www.loria.fr /~ Molli/cvs-index.html

Related Websites:

Http://directory.google.com/Top/Computers/Software/Configuration_Management/Tools/Concurrent_Versions_System/

CVS-parallel version System

Http://www.soforge.com/cvsdoc/zh_CN/book1.html

CVS free book:

Http://cvsbook.red-bean.com/

Quick query card of CVS command:

Http://www.refcards.com/about/cvs.html

Wincvs:

Http://cvsgui.sourceforge.net/

Cvstrac: A web-based bug and patch-Set Tracking System for CVS

Http://www.cvstrac.org

Statcvs: Code statistics Tool Based on CVs: by the amount of code, by the developer's statistical table, etc.

Http://sourceforge.net/projects/statcvs

How to plan CVS in Web development: Check "CVS Web Development" on Google"

Http://ccm.redhat.com/bboard-archive/cvs_for_web_development/index.html

Some ide environments integrated with CVS:

Eclipse

Magic C ++

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.