One of the CVS servers in LINUX

Source: Internet
Author: User
Article Title: LINUX is one of the CVS servers. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
I. Concepts of version control and introduction to several version control tools
  
1. Concept of source file identification and version
  
The source file is the most important component of a software. Therefore, the management of source files is also the most important part of the software composition management. It is the critical age for efficient software development. to manage source files, you must mark them. generally, only file names are required. in fact, in a version maintenance tool, the source file is marked in two parts: File Name and version. that is, the source file can be represented by {filename, version} using the following Binary Group };
  
Generally, software developers have an intuitive understanding of the version, but it is difficult to make accurate definitions. version refers to the potential existence of a specific instance of a specific object. A specific object here refers to a software component unit managed by a version maintenance tool, which generally refers to the source file. A specific instance refers to a real copy of a software component unit recovered by a software developer from the software storage room with certain content and attributes.
  
Defining a version as a potential existence is based on the following considerations: as a representation of the source file, the software developer actually wants to get different source files corresponding to different versions for its reference, therefore, the version is an abstraction. it defines the content and attributes of a specific instance. that is to say, the version is the potential existence of a specific instance, and is the abstraction of the different embodiment of the source file.
  
With the above understanding of the version concept. you have a certain understanding of the version maintenance tool: the version maintenance tool should be transparent to developers to block the storage of source files, developers do not need to understand what source files are in the software repository. They only need to explain what source files are needed and what source files are to be stored. The version maintenance tool automatically completes all this work. the theory of version maintenance also includes: Version space, dimension, version representation, storage, and merging. Because we mainly describe the linux Server of cvs, everything is simplified, if you are interested in this aspect, you can read related books.
  
The cvs mentioned in this chapter is such a powerful tool. before talking about cvs, we will first introduce several other maintenance tools.
  
2. Introduction to several maintenance tools
  
2.1 SCCS
  
The full name of SCCS is Source Code Control System. The concept of a work file is defined before the introduction. A work file is a Source file with the write permission obtained from the software storage room.
  
SCCS is a basic source file version control tool, which is suitable for version maintenance of any body file. it is based on version control of a single file. Generally, its software storage room is in the same directory as the file to be maintained.
  
When SCCS is working, a special SCCS file retains the encoding version of its source file, which records enough information to generate a new version, and records who has the right to modify the file, has the "Lock" of this version ".
  
The version of SCCS is a good thing, that is, the issue number, level number, branch number, serial number (release, level, banch, sequence)
  
2.2 RCS
  
As another basic source code management tool, RC is WALTER. f. tichy was developed at the Purdue University in Indina in 1980. similar to SCCS, the version maintenance system is also based on a single file. RSC manages files through RSC files. The process of maintaining the files using the RCS is similar to that of SCCS. It is also implemented in the recovery submission mode.
  
The RFM file is the storage room for source files in the RFM system. It is a special encoding file that contains sufficient information for developers to restore the source files of the old version for development. it is usually. V is a suffix
  
Its structure is as follows:
  
* This part records the version number of the version tree header of the corresponding file,
  
* Version Description: This section describes the attribute properties of each node on the RCS tree.
  
* Initial information: part of the information is expressed when the first version of the RCS is created.
  
* File Content
  
Similar to SCCS, the RCS also organizes the maintained version into a tree structure. however, the RCS allows multiple branches, that is, the version number of the RCS is not as a quad-tuple as that of SCCS. format: Release number, level number, [branch number, serial number]. the version tree is as follows:
  
2.3 Summary
  
The two versions of maintenance tools share the same thing: the "Lock" method is adopted, so that users who stick to the "Lock" method have the right to modify the file. they adopt the so-called "lock-modify-unlock" mechanism ". there is only one well-known weakness, that is, the use of concurrent users.
  
2. Build a cvs server in linux
  
1. Introduction to CVS and Basic Principles
  
CVS stands for Current Version Control. CVS is a GNU software package. developed by Intersolv, the latest version is 1.10.8. it is a maintenance tool based on the RCS system. it explicitly isolates the storage of source files from the user's workspace, and extends the recovery submission function of the RCS in a certain mode. and make it advantageous for parallel development.
  
CVS stores the source file's RC file in a directory based on its source tree hierarchy. The absolute path of the directory is defined by the Environment Variable CVSROOT.
  
The directory can be divided into two parts: $ {CVSROOT}/CVSROOT, which contains some management files required by CVS. another part is the source file generated by the RCS file, which is structured according to the source code tree of software development.
  
2. Features of CVS in source code management
  
2.1 source code space and user space are separated.
  
The CVS system places the source code file under repository. to modify the file, you must copy the file under repository as a copy before proceeding,
  
2.2 concurrent access
  
The CVS system allows multiple developers to obtain source files of the same version of the same file at the same time. of course, this is the main reason why CVS is widely used. when a developer extracts a file, a copy of the file is created in the workspace of the developer. the version number of the file is the same as that of the file header, unless you use the commit command to perform a permanent version upgrade. at this time, other users can use the undate command to make their own version number consistent with the "latest header version number.: If the front page is changed after checkout, you can use the rcsmerge command of the RCS system to form a new file, which includes the original content and the modified content. this vulnerability conflicts with other developers who are simultaneously modifying the same file and can be notified to manually modify the file.
  
Therefore, the CVS system is a Copy-Modify-Merge algorithm, rather than the lock-modify-unlockj mechanism adopted by the above two systems, software developers can obtain a Copy of the source file without locking the file. Therefore, it is possible for parallel development, developers can Modify the file in their own development environment, and then submit the modified file to Merge the file with the source file (Merge ). form a new version,
  
2.3 source file sharing
  
CVS uses $ {CVSROOT}. Different users can copy different templates as needed. After modification, the carrier is handed over to $ {CVSROOT }. in this way, you can share the source file. this is of course necessary for us to establish a CVS server.
  
2.4 independent working environment
  
Users modify and develop in their own work environment. Naturally, they have an independent work environment, which is worth noting. CVS also supports the "Lock" mechanism. allows users to lock the template copy they have obtained
  
2.5 mark
  
CVS introduces a tag file, which is located in the user's working directory and operates on a specific tag file in the CVS directory at the file level marked by it, that is, operations on the corresponding version, even if this version has been modified.
  
3. obtain and install CVS
  
CVS is installed by default in general linux releases. it doesn't matter if your system is not installed. CVS can be conveniently obtained on intenet. its source code is on ftp: // 202.113.29.4/pub1/unix/cvs. Its instructions are on ftp: // 202.113.29.4/doc/cvs. anyone can download it easily. currently, his latest version is 2 .. 10. 8 ..
  
The installation process is roughly as follows:
  
Unbind the downloaded compressed file from any directory.
  
Use the Installation tool in the package to complete the installation ).
  
Usually: make config and make install
  
(The installation method may vary depending on different versions. For details, see the installation documentation provided by Alibaba Cloud)
  
4. Server Installation and Use
  
After installing the CVS system, we can start the installation of the CVS repository. in linux, CVS is generally used as a command line, and some GUI front-end tools, such as TKCVS. here we will apply the General command CVS [cvs option] cvs-command [command Option] to complete the server configuration.
  
4.1 repository Management
  
Create the CVSROOT root directory
  
First, edit the related environment variables. (several important environment variables of CVS are as follows:
  
Complete path name of the root directory of the CVSROOT Repository
  
If CVSREAD is set, all files are set to read-only during the checkout operation.
  
Cvsbin cvs uses a lot of RCS commands to specify the path of the Le RCS Tool
  
CVSEDITOR specifies the editor used by the user to write log information.
  
Name of the shell used when CVS_RSH starts a remote CVS server
  
CVS_SERVER determines the name of "cvs server". The default value is CVS.
  
CVSWRAPPERS cvswrapper script, used to specify the packaging file name .)
  
CVSROOT indicates the location of the Warehouse. It is essential to create a new warehouse. therefore, we generally need to add the definition of the environment variable CVSROOT. for example, add the following two lines to the/etc/bashrc file:
  
CVSROOT =/cvsroot
  
Export CVSROOT
  
Or directly execute
  
$ Export CVSROOT =/cvsroot
  
Create CVSROOT at the corresponding location
  
$ Mkdir cvsroot
  
$ Cvs init
  
If the variable CVSROOT is not defined, the following message is displayed:
  
Cvs init: No CVSROOT specified! Please use the '-d' option
  
Cvs [initn aborted]: or set the CVSROOT environemnt variable
  
If you do not want to define environment variables, you can use the following command:
  
Cvs? D/cvroot init, but even if you have defined CVSROOT, what is the parameter? The content after d will also overwrite it. If there is no error message, congratulations, your CVS software library has been created.
  
The remaining question is how multiple users can use this repository for parallel software development and version control. as a CVS administrator, you should set the permissions of your users. at this time, your cvsroot has a CVSROOT subdirectory. the configuration file of CVS in the following files
  
Ls/cvsroot/CVSRO
Related Article

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.