CVS is a C / S system that records file versions through a central version control system to achieve the purpose of ensuring the synchronization of files. The working mode is as follows:
CVS server (file repository)
/ | /
(Version of the same step)
/ | /
Developer 1 Developer 2 Developer 3
Developers can choose 2,6, CVS administrators need more more, and finally introduce some CVS clients under Windows, the selection of remote user authentication, and BUG Tracking system and other integration issues.
CVS Environment Initialization: Construction Administrators in CVS Environment
CVS daily use: the most common CVS command in daily development, developer administrator
CVS branch development: Items in accordance with different progress and goals
CVS user authentication: remote user authentication, security, simple administrator through SSH
CvsWeb: The web access interface of CVS greatly improves the efficiency administrator of the code version comparison
CVS Tag: Take the $ header $ joined in the code annotation to facilitate the development process
CVS VS VSS: Comparison Developer Administrator for CVS and Virsual SourceSafe
WinCVS: WinCVS certification settings certified by SSH
CVS team collaborative development: Development of the development environment for development environment construction, implements the CVS user management and integrated bug tracking and Wiki communication of the web interface through CVSTRAC.
A system 20% of the system is often capable of meeting 80% of the demand, and CVS is no exception. The following is the most common function of CVS, may not reach 20% of its all command options, more features experience in the actual application process, How much do you want to use, you will look back from time to look at the unexpected gain.
CVS environment initialization
============
Environmental Settings: Specify path of CVS library CvsRoot
TCSH
SetENV CVSROOT / PATH / TO / CVSROOT
Bash
Cvsroot = / path / to / cvsroot; Export CvsRoot
The settings of the remote CVS server are also mentioned later:
Cvsroot =: ext: $ u@test.server.address#port: / path / to / cvsroot cvs_rsh = ssh; export cvsroot CVS_RSH
Initialization: Initialization of the CVS repository.
CVS init
First import of a project
CVS Import -M "Write Some Comments Here" Project_name Vendor_Tag Release_tag
After execution: import all source files and directories into / path / to / cvsroot / project_name directory
Vender_TAG: Development Trademark
Release_tag: Version Publishing Mark
Project Export: Export the code from CVS CVS
CVS Checkout Project_name
CVS will create a Project_name directory and export the latest version of the source code to the corresponding directory. This Checkout and VirVual SourceSafe are not a concept. Check out is CVS Update, Check IN is CVS Commit relative to the Check Out of VirVual SourceSafe. Daily use of CVS
=============
Note: After the first export, the file is not synchronized by CVS Checkout, but to enter the version of the specific file in the project_name directory that just exported CVS Checkout Project_Name, the specific file is synchronized (add, modify, delete) operation.
Synchronize files to the latest version
CVS Update
Do not set the file name, CVS will synchronize the files in all subdirectory, or you can develop a filename / directory to synchronize
CVS Update file_name
It is best to do once before you start working or import your work into the CVS reservoir, and develop the habit of "first synchronous and modified", and VirVual SourceSafe, there is no file lock in CVS, all conflicts It is solved before commit before. If you have modified, there are other people modified and commit to the CVS library, and CVS will notify you of the file conflict and automatically use the conflict part.
>>>>>>
Content On CVS Server
<<<<<<
Content in your file
>>>>>>
Mark comes out, by your conflict content.
Version conflicts are generally caused by multiple individuals to modify a file, but the problem on this project management should not be expected to be solved by CVS.
Confirmation modification to CVS Current
CVS commit -m "write some comments here" file_name
Note: Many of the CVS is the final confirmation and modification via CVS Commit, it is best to modify only one file each time. Before confirming, users need to fill in the modified comments to help other developers understand the causes of modifications. If you don't need to write -m "comments", please confirm the `cvs commit file_name`, CVS automatically call the system default text editor (generally VI) to request you to write a comment.
The quality of the comment is very important: so we must not only write, but also must write some meaningful content: so that other developers can understand well.
Wild comments, it is difficult to let other developers quickly understand: -m "bug mixed" or even -m ""
Good comments, even in Chinese: -m, add an email address check in the user registration process. "
Modifying a version Note: Every time you only confirm that a file is a good habit, it is inevitable that sometimes I forgot to specify the file name, put multiple files to CVS library, the following command can be Allow you to modify a version of a file:
CVS Admin-M 1.3: "Write Some Comments Here" File_Name
add files
After creating a new file, such as: Touch New_File
CVS Add New_File
Note: For items such as pictures, Word documents, you need to use the CVS Add -b option to import 2 credit mode, otherwise the case where file is destroyed, for example:
CVS add -b new_file.gif
CVS Add -b Readme.doc
Then confirm the modification and comment
CVS CI -M "Write Some Comments"
Delete Files
After deleting a source file, such as rm file_name
CVS RM File_Name
Then confirm the modification and comment
CVS CI -M "Write Some Comments"
The method of combining the top 2 steps above is:
CVS RM -F File_Name
CVS CI -M "why delete file"
Note: Many CVS commands have abbreviations: commit => ci; update => Up; checkout => co / get; remove => rm;
Add directory
CVS Add Dir_name
View modified history
CVS log file_name
CVS History file_name
View different versions of the current file
CVS Diff -r1.3 -r1.5 file_name
View the current file (may have been modified) and the difference between the corresponding files in the library
CVS DIFF file_name
CVS's web interface provides more convenient location file modification and comparison, specific installation settings, please look at the CVSWEB used later
Correctly recovering an old version through CVS:
If you use cvs update -r1.2 file.name
This command is given to file.name plus a Stick Tag: "1.2", although your original intention just wants to return it to version 1.2
The correct recovery version is: cvs Update -p -r1.2 file_name> file_name
If you accidentally add Stick Tag: Solve with CVS Update -a
Mobile file / file rename
There is no CVS Move or CVS Rename in CVS, because the two operations can be implemented by first cvs remove ly_file_name, then CVS add new_file_name.
Delete / mobile directory
The most convenient way is to let the administrator move directly, delete the corresponding directory in cvsroot (because the subdirectories under the CVS project are independent, and can be used as a new independent project under the $ cvsroot directory: like a tree, actually Cutout any branch can survive independently), after modifying the catalog, requires its developers to re-export project CVS Checkout Project_name or synchronize with CVS Update -DP.
Project release export source file without cvs directory
When you are developing, you may notice that in each development directory, CVS creates a CVS / directory. There is a file to record the corresponding information between the current directory and the CVS library. But when the project is released, you generally don't want to put the file directory with a CVS directory containing CVS information. This one-time export process uses the cvs export command, but Export can only export for a TAG or date, such as:
Cvs export -r release1 project_name
CVS EXPORT -D 20021023 Project_name
CVS export -d now project_name
CVS Branch: Project multi-branch synchronous development
============================= Confirm version milestone: Multiple files are different from the number of files, the projects go to a certain stage, you can give all The document is unified to specify a stage milestone version number, which is convenient to export items in this stage milestone, and the basis for multiple branch development of the project.
CVS Tag Release_1_0
Start a new milestone:
CVS commit -r 2 tag all files start entering 2.x development
Note: The release version of the Revsion and the package in CVS can have no direct relationship. However, all files use and publish version of the version number contribute to maintenance.
Establishment of version branches
When the 2.x version of the project is discovered 1.x there is a problem, but 2.x does not dare to use, from the previously tagmate: release_1_0 Export a branch release_1_0_patch
CVS RTAG -B -R release_1_0 release_1_0_patch proj_dir
Some people first export Release_1_0_patch in another directory: solve the problem of emergency in 1.0,
CVS checkout -r release_1_0_patch
Other people are still developing on the main branch of the project.
After fixing an error on the release_1_0_patch, mark a 1.0 error correction version number
CVS Tag Release_1_0_patch_1
If 2.0 thinks these error modifications are also required in 2.0, and can also be made in the 2.0 development directory to modify the modifications in Release_1_PATCH_1 to the current code:
CVS Update -j release_1_0_patch_1
CVS remote authentication: Visit CVS remotely via SSH
=======================================================================================================================================================
Using CVS itself based on PServer-based remote authentication is cumbersome, you need to define server and user groups, user names, set passwords, etc.
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
Not very safe, so it is generally an anonymous read-only CVS access. From safety considerations, through system local account authentication and through SSH transmission is a better way, set the content in the client / etc / profile:
Cvsroot =: ext: $ u er cp pt c = = = = = =;;;;;;;;
All clients all local users can map to the CVS server corresponding to the same name account.
such as:
The CVS server is 192.168.0.3, the CVSROOT path is / home / cvsroot, another development client is 192.168.0.4, if Tom has the same name on 2 machines, then set up from 192.168.0.4:
Export cvsroot =: ext: Tom@192.168.0.3: / home / cvsrootexport cvs_rsh = ssh
TOM can access 192.168.0.0's cvsroot directly in 192.168.0.4 (if there is permission)
CVS Checkout Project_name
CD Project_name
CVS Update
...
CVS commit
If the SSH port of the server where the CVS is not in default 22, or and the client is inconsistent with the CVS server SSH default port, sometimes it is set:
: ext: $ u er 特est.server.address#port: / path / to / cvsroot
Still not, such as the following error message:
SSH: Test.Server.Address # port: name or service not known
CVS [Checkout Aborted]: End of File From Server (Consult Above Messages if any)
The solution is to do a script specified port steering (you can't use Alias, you can't find a file error):
Create a / usr / bin / ssh_cvs file:
#! / usr / bin / sh
/ PATH / TO / SSH -P 34567 "$ @"
Then: chmod x / usr / bin / ssh_cvs
And cvs_rsh = ssh_cvs; export cvs_rsh
Note: Port refers to the port of the corresponding server SSH, not the port of CVS PServer
CVSWEB: Improve file browsing efficiency
=====================================================================================================================================================
CvsWeb is the web interface of CVS, which greatly enhances the efficiency of programmers positioning modifications:
Samples can be seen: http://www.freebsd.org/cgi/cvsweb.cgi
CVSWeb Download: CvsWeb has evolved from the initial version to have a richer version of the function interface, this is the convenient installation setting:
http://www.spaghetti-code.de/software/linux/cvsweb/
Download Unpack:
TAR ZXF CVSWeb.tgz
Put the configuration file CVSWeb.conf to a safe place (such as in the same directory with the same directory with the Apache),
Modify: cvsweb.cgi Let CGI find configuration files:
$ config = $ env {'cvsweb_config'} || '/path/to/apache/conf/cvsweb.conf';
Go to / path / to / apache / confation and modify cvsWeb.conf:
Modify the CVSROOT path settings:
% Cvsroot =
'Development' => '/ path / to / cvsroot', # <== Modify points to local cvsroot
);
By default, you do not display documents that have been deleted:
"hideattic" => "1", # <== default not displayed document
In the configuration file cvsWeb.conf, you can also customize the description of the page header. You can modify $ long_INTRO to become the text CVSWeb you need, you can't open it to all users, so you need to use web user authentication:
Mr. is Passwd:
/ path / to / apache / bin / htpasswd -c cvsweb.passwd user
Modify httpd.conf: increase
Authname "CVS Authorization"
Authtype Basic
Authorfile /Path/to/cvsweb.passwd
Require Valid-User
Directory>
CVS Tags: Who? When?
====================
It is a good habit of adding $ ID $ to the beginning of the program file. CVS can automatically explain the contents of the update: file_name version time user_name format, such as: cvs_card.txt, v 1.1 2002/04/05 04 : 24: 12 Chedong Exp, you can learn about the final modifier and modification time of the file
Several commonly used default files:
DEFAULT.PHP
PHP
/ *
* CopyRight (C) 2002 Company Name.
* $ Header $
* /
?>
=====================================
Default.java: Note File Head General Note Use / * Start Javadoc Note Use / ** Start
/ *
* CopyRight (c) 2002 mycompany name.
* $ Header $
* /
Package com.mycompany;
Import java .;
/ **
* Comments here
* /
Public classes default {
/ **
* Comments here
* @Param
* @Return
* /
Public toString () {
}
}
=====================================
DEFAULT.PL:
#! / usr / bin / perl -w
# CopyRight (C) 2002 Company Name.
# $ HER $
# File Comments Here
Use strict;
CVS VS VSS
===========
CVS has no file lock mode, and VSS is simultaneously in Check Out, and the file is logged by the exporter.
CVS's Update and Commit, VSS is Get_lastest_version and Check IN CVS in the CVS of Check Out / undo Check Out, EDIT and UNEDIT
In CVS, the label automatic update feature is open, which brings a potential problem, which is the time that the file can be expired when the CVS is automatically updated without the -kb mode.
$ HEADER $ DATE $ TIST Solving KEYWORD EXPLAINATION in Virsual SourceSafe, the default is off, you need to open through Opition, and specify file types that need to perform source file keywords: *. Txt, *. Java , *. html ...
Tags common for Virsual SourceSafe and CVS:
$ Header $
$ Author $
$ Date $
$ Revision $
I suggest trying to use general keywords to ensure that the code can be easily tracked in CVS and VSS.
WinCVS
======
download:
CVS Windows client: Currently stable version is 1.2
http://www.wincvs.org/
SSH Windows client
http://www.networksimumity.com/openssh/
After installing the above 2 software:
WinCVS client admin ==> preference setting
1 in the general menu
Set cvsroot: username@192.168.0.123: / home / cvsroot
Set Authorization: Select SSH Server
2 port menu
Hook: Check for Alternate RSH Name
And set the path to SSH.exe, the default is installed in C: / Program files / networksImplicity / ssh / ssh.exe
Then you can use WinCVS to perform CVS operation, all operations will jump out of the command line window asking you to enter the authentication password of the server.
Of course, if you feel so annoying, there is another way to generate a public key / private key pair without a password, and set the CVS using the public key / private key SSH certification (in the general menu).
You can choose DIFF tools: ExamDiff
download:
http://www.prestosoft.com/examdiff/examdiff.htm
Still in the WinCVS menu admin ==> Preference's WinCVS menu
Optional: Externel Diff Program
And set the path to the DIFF tool, such as: C: / Program Files / ED16I / ExamDiff.exe
When the file is sent to the file, the first time you need to select the USE EXTERNEL DIFF in the lower right corner of the window.
CVS-based group development environment
=========================
As a group-level development environment, version control systems and BUG tracking systems, etc., all involve the user authentication section. How to easily integrate these systems is a very interesting thing, after all, we can't count on the version control / bug tracking integrated system with high integration as Source OFFSITE.
I personally oppose remote user authentication using the PServer mode, but if most of the group members develop by using the Windows client, generally use cvsroot / passwd certifications or difficult to avoid, but CVS users are more troublesome. Originally, I planked to write a management interface with Perl until I found CVSTRAC, a web-based BUG tracking system, which hangs on the CVS system, including the management of the cvsroot / passwd file of the web interface, and even Integrated Wikiwiki feature. Here first, the user authentication in the CVS's PServer mode, the CVS user authentication service is based on inetd:
CVSPServer Stream TCP NOWAIT NOBODY / USR / BIN / CVS CVS - Allow-root = / home / cvsroot PServer
Generally at 2401 port
CVS user database is based on cvsroot / passwd file, file format:
[username]: [CRYPT_PASSWORD]: [mapping_system_user]
Since the password is used by the Unix standard Crypt encryption, this Passwd file is basically the extension of apache's HtpassWD format (one system user mapping field than the PACHE's PASSWD file), so the simplest method of this file can be used.
Apache / bin / htpasswd -b myname mypassword
create. Note: The file created by htpasswd will not map the field of the system user.
E.g:
New: gebvosup / zkl2
Setup: aisqunaavoy3qw
Test: hWEPZ / BX.Redu
The purpose of the mapping system user is: You can create a special CVS service account, such as the CVS, and give this user with all the permissions under the / home / cvsroot directory, then create different development user accounts in the Passwd file, but develop The last file read and write permission of the user account is mapped to CVS users, avoiding multiple file read and write permission issues for other users after a number of developing users in SSH mode.
Further, you can map the user to 2 groups, using 2 users' permissions settings to avoid access to each other with each other.
New: gebvosup / zkl2: Proj1
Setup: AisqunaAoy3QW: Proj2
Test: hWEPZ / BX.Redu: Proj1
Cvstrac is well solved the management problem of cvsroot / passwd, and includes the BUG tracking report system and integrated Wikiwiki communication function, and the installation of the CGI mode is installed, and based on the GNU Public License:
Installation process
Download: You can download from http://www.cvstrac.org
I use it is already compiled on Linux: cvstrac-1.1.1.bin.gz,
% gzip -d cvstrac-1.1.1.bin.gz
% chmod x cvstrac-1.1.1.bin
#mv cvstarc-1.1.1.bin / usr / bin / cvstrac
Initialization Cvstrac Database: Suppose Database Name is MyProj
On the CVS server already installed (the CVS library should already be initialized, such as: cvs init in / home / cvsroot), run
% CVSTRAC Init / Home / CvsRoot MyProj
After running, there will be a MyProj.db library in / home / cvsroot, using cvstraac service, /Home/cvsroot/myproj.db / home / cvsroot / cvsroot / readers / Home / CVSROOT / CVSROOT / WRITERS / HOME / CVSROOT / CvsRoot / passwd These files should be writable for web services, on redhat 8, there is a Apache user and an Apache group in the default, so I set up with Apache users in httpd.conf files. Web service: User apache
GROUP APACHE,
If Apache is used on the server, for example: Nobody NOGROUP runs, the user / group is set to Nobody NOGROUP later.
Then I set it #chown -r apache: apache / home / cvsroot
-rw-r - r - 1 apache apache 55296 Jan 5 19:40 myproj.db
DRWXRWXR-X 3 Apache Apache 4096 Oct 24 13:04 Cvsroot /
Drwxrwxr-x 2 apache apache 4096 Aug 30 19:47 Some_proj /
Also set in / home / cvsroot / cvsroot:
CHMOD 664 Readers Writers Passwd
Create a 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
From http://cvs.server.address/cgi-bin/cvstrac/myproj to the management interface
By default login name: setup password setup
For general users from:
http://cvs.server.address/cgi-bin/cvstrac/myproj
Modify the login password, perform BUG report, etc.
More use details can be learned in use.
Remarks:
Add CVSPSERVER services in inetd:
CVSPSERVER STREAM TCP NOWAIT APACHE / USR / BIN / CVS CVS - Allow-Root = / Home / CVSROOT PSERVER
XIETD profile:% Cat CVSPServer
Service CVSPServer
{
Disable = no
Socket_type = stream
Wait = NO
User = apache
Server = / usr / bin / cvs
Server_Args = -f - allowow-root = / home / cvsroot pserver
LOG_ON_FAILURE = UserID
}
Note: The user here is set to Apache to consistent with all users of / home / cvsroot, and this user must make this user to generate myProj.db generated by using the cvsroot / passwd and CvSTRAC initialization of / home / cvsroot / CVSROJ.DB with read permissions.
For the previously mentioned WinCVS set in Perference:
CVSROOT bar input: username@ip.address.of.cvs: / home / cvsroot
Authenitation Selection: Use Passwd File On Server Side
Yes.
to sum up:
With CVS (WinCVS / CVSWEB / CVSTRAC), a relatively perfect cross-platform development version control environment is formed.
related resources:
CVS Home:
http://www.cvshome.org
CVS FAQ:
http://www.loria.fr/~molli/cvs-index.html
Related website:
Http://directory.google.com/top/computers/software/configuration_management/tools/concurrent_versions_system/
CVS free book:
http://cvsbook.red-bean.com/
Quick check card for cvs command:
http://www.refcards.com/about/cvs.html
WinCVS:
http://www.wincvs.org
Cvstrac: a web-based bug and patch-set tracking system for cvs
http://www.cvstrac.org