Cvs
Yes
Concurrent Version SYSTEM
Abbreviation for (parallel version of the system) for version management. If you have participated in the projects that have collaborated with many people, everyone must have such a painful experience: because many people have modified the same document,
The procedures for their hard-working modifications are completely deleted by others. Also, if your software
/
The program has released three versions.
At this time, the user needs you to modify the second version, maybe you will cry because only the latest version is kept. There is also some modifications to the program, but the modifications are very few, you only want to send a different version of the different versions to the distant colleagues, which can be exempted from the mailbox is not big enough, the network speed is too slow. . In order to solve problems like this, and such as generating patch files, historical version modifications, etc., a bunch of hackers (commendation) is originally
Unix
Mature in the system
SCCS
with
RCS
On the basis of developing
Cvs
.
(SCCS)
:
Source Code Control System
,
RCS
:
Revision Control System
).
Cvs
Basic Work Idea is this: Create a repository on a server, and the source of many different items can be stored in the warehouse. The source program is managed by the warehouse administrator. In this way, it seems that only one person is like a file. Avoid conflicts. Each user first uses the warehouse to download the project file in the warehouse to the local. Any changes to users are first conducted locally, then use
cvs
Command to submit, by
cvs
Warehouse administrator unified
modify. This will do tracking file changes, conflict control, and more.
due to
Cvs
Typical
C / S
Software, so it is also divided into two parts: the server side and the client. Most
Cvs
Software will be all over them. We will discuss from the perspective of servers and clients, respectively.
cvs
usage of.
Cvs
Server installation
First ensure that the system is installed
cvs
:
[root @ mail xinetd.d] # rpm -qa | GREP CVSCVS-1.11.1p1-3
If the command output is similar to the above output, the system has been installed
cvs
Otherwise, you need to install from the installation CD.
cvs
of
rpm
package.
One creation CVS host user:
# useradd -d / cvsroot CVS # chmod 771 / CV SROOT
Second, establish a CVS warehouse (initialization CVS)
# su cvs $ cvs -d / cvsroot init $ exit #
Fourth, start the CVS server
in
/etc/xinetd.d/
Create files in the directory
CVSPSERVER
The content is as follows:
# Default: on # description: The cvs server sessions; service cvspserver {socket_type = stream wait = no user = root server = / usr / bin / cvs server_args = -f --allow-root = / cvsroot pserver log_on_failure = USERID only_from = 192.168.0.0/24}
among them
ONLY_FROM
It is used to restrict access, and can be not or modified according to the actual situation.
Modify this file permission: # chmod 644 CVSPSERVER
Then restart
xinetd
:
# /etc/rc.d/init.d/xined restart
Then observe
cvs
Whether the server has been running:
[root @ mail xinetd.d] # netstat -lnp | grep 2401tcp 0 0 0.0.0.0:2401 0.0.0.0:0:4401 0.0.0.0:0:0:0:0:0:0:2401 0.0.0.0:0:0:4401 0.0.0.0:0:0:0:0:0:2401 0.0.0.0:0:0:4401 0.0.0.0:0:0:0:0:4401 0.0.0.0:0:0:0:0:0:0:0:0:0:0:0:0:0:4401 0.0.0.0:8 Listen 7866 / xinetd
Description
cvs
The server has been running.
5. Create a user who uses to access CVS
Previously created
cvs
User is
cvs
Warehouse management users, and to allow users to access users:
# UserAdd CVSPUB # usemod -g CVS CVSPUB
Here added a user
CVSPUB
And add this user to
cvs
Group.
6. Manage CVS servers
management
cvs
server. The server can be used, and now everyone is most concerned about how to manage the server. For example, I want some people to read and
/
Or write
Cvs
Warehouse permissions, but don't want to give it system permissions? It is not difficult,
cvs
After the initialization, in the admin user
(
here is
cvs
user
)
There is one in the main directory
CvsRoot
Directory, there are three profiles in this directory:
Passwd, readers, Writers
. We can configure these three files
Cvs
The server, the following is the role of these files, respectively:
Passwd
:
cvs
User user list file, its format is very like
Shadow
file:
{CVS
username
}: [
Encrypting password
]:
Equivalent system username
]
If you want a user just
cvs
Users, not system users, then you have to set this file, this file may not exist after you have just installed it, you need to
cvs
Administrator identity
(SU CVS)
The user is manually created, of course, according to the above format;
The second field is the encryption password of the user, that is
Crypt (3)
Encryption, you can write a program to do encryption, you can also use two lazy ways: first create a system user, name and
cvs
Like the user, the password is ready to give it.
cvs
User password, after the creation
/ etc / shadow
Copy the second field of the user, then
Remove this user again. This method is relatively convenient to deal with fewer users, and people are not suitable, and there are conflict conditions.
(Race Condition)
Safety hazard,
root
Permissions, it is not very good, but the equity is illegible; another method is to use
APCHE
of
Htpasswd
Order creation
Passwd
User, add users only need
htpasswd passwd username
Add users to
Passwd
In the file, it is necessary to add one of the last additions to the west in the file.
":"
Call registration and corresponding equivalent system username; the best is to write a program to generate this
Passwd
Document.
The third field is an equivalent system username. It is actually assigned to one.
cvs
User's equivalent system user's permissions, look at the following example, you understand its function.
readers
:Have
cvs
The user list file of the read permissions is a one-dimensional list. Users in this file
cvs
Only read permissions.
Writers
:Have
cvs
Users of users of write permissions, and readers
Like, it is a one-dimensional list. Users in this file
cvs
There is write permission.
The above three files may not exist when the default installation, you need to create it yourself, ok, now let us use an example to teach. Suppose we have the following users need to use
cvs
:
Cvsuser1, Cvsuser2, Henry, Betty, Anonymous
among them
Lase
with
gumpwu
Is system user, and
Henry, Betty, Anonymous
We don't want to give system user privileges, and
Betty
with
Anonymous
It's all read-only users, and
Anonymous
It is even more than one password.
Then edit
cvs
Administrator's catalog
CvsRoot / Passwd
Document, add the following line:
Laser: $ xxefajfka; faffa33: CVSPUB GUMPU: $ AJFAAL; 323R0OFeeanv: CVSPUB HENRY: $ FAJKDPAIEJE: CVSPUB BETTY: FJKAL; FFjieInfn /: CVSPUB Anonymous :: CVSPUB
Note: The second field above (separator is
:
) Is a secret text, you have to use the program or use my dirt.
edit
readers
Document, add the following line:
Anonymous Betty
edit
Writer
Document, add the following line:
Laser gumpwu henry
This way
OK
If you use several users to log in to test, you will find everything
OK
. The principles and instructions in this are not much to say, in fact, very simple, and the concept of system management users.
7. Establish a new CVS project
Generally we have one or more projects so we can use the following steps to generate a new one.
Cvs
project.
Place a project file in
Cvs
Made in the version control,
Cvs
Terminology is called import
(import)
. It can be seen from the name that you need to work for this before importing.
The basic requirement of the input operation is
"
clean
"
Directory structure.
"
clean
"
It means that the files that do not require version control are removed (such as compiled and generated files, backup files, etc.). If the project has started for a while, this is very important. In the directory, some are not intended to place them under version control, but I want to put them here. In this case, you have to remove them before entering, and then move back.
Please be aware of
Cvs
It is considered that the empty catalog does not exist. If you want to add a directory that neither files that don't contain subdirectories, you need to create a dummy file under. I suggest you create a name
Readme.txt
The file whose content is a brief description of the directory.
Enter the directory of existing projects, such as
Cvstest
:
$ cd cvstest
Run the command to import the project file into
cvs
Warehouse:
$ CVS IMPORT -M "this is a cvstest project" cvstest v_0_0_1 start
Description:
Import
Yes
cvs
One of the orders, indicating
cvs
Warehouse input project file.
-M
The strings behind the parameters are description text, describe the project, if not
-M
Parameter, then
cvs
Will run an editor automatically (generally
vi
, But can modify environment variables
Editor
Come to the editor you like to use to enter information, cvstest
Is the project name (actually a warehouse name,
Cvs
The server will be stored in the warehouse named after this name)
v_0_0_1
It is the total mark of this branch. No use (or not common)
Start
Every time
Import
Identifies the input level of the file, no use.
This way we have established a
Cvs
The warehouse, then, we can delete this test item file, test how to obtain files from the warehouse This will be described later.