CVS is fully called Concurrent Version System (parallel version system). It is mainly used for version management and collaborative development of projects.
Note: In this example, the CVS client and server are installed on the same machine.
1. Server cvsnt
1. installation and configuration
: Http://www.cvsnt.org
This document downloads the latest version 2.5.03.
Double click to download the cvsnt-2 [1]. 5.03.2382.msi file, start installation, click "run" to go to the installation welcome page, and then click "Next" to go to the "accept user agreement" Page. Select "I accept ..." Select, accept the User Agreement, and click "Next" to go to the Select installation mode page, as shown in:
There are three installation modes: Typical, custom, and full installation. I chose a typical installation mode and click "Next" to go to the installation preparation page, as shown in:
In this figure, click "Install" to start installation. After the installation is complete, the installation completion page is displayed. Click "finish" in the installation completion figure to complete the installation. After the installation is complete, you will be prompted to restart the system to make the installation take effect, as shown in:
Click "yes" to restart the system.
After the installation is complete, you also need to configure the knowledge warehouse of CVS. You can first create a CVS directory under the e disk to serve as the knowledge base of CVS. Go to the cvsnt Control Panel through "program"> cvsnt-> cvsnt control panel, click the "repository configuration" tab, and click the "add" button to bring up the server parameter settings page, in location, select the created knowledge warehouse directory. The content is as follows:
Click "OK" to create a CVS knowledge warehouse. In this case, open the E:/CVS folder and you can see that a new cvsroot directory is created under this directory.
When different CVS clients connect to CVS, the reader also needs to switch to the compatibility label to check the response as CVS 1.11.2 to version R option.
To test whether the cvsnt is successful, enter the CVS command under the command line. If the following information is displayed, the installation is successful:
If you want to view the version of the installed cvsnt, you can enter the CVS version. The version installed in this article is 2.5.03.
2. Distribution of CVS
CVS is a typical software with a C/S structure. Therefore, it is also divided into two parts: the server side and the client side. As shown in:
3. Basic working ideas of cvsnt
Create a knowledge warehouse on a server, which can store files of many different projects.
Before using the repository, each user must first download the project files in the repository to the local device. Any modifications made by the user are first made locally and then submitted using the CVS command.
The warehouse concept is shown in:
4. Common commands and syntaxes
There are many common commands in cvsnt, such as adding CVS users, binding CVS users to the operating system, logging on to CVS, and checking out (check out) files or directories, submit files or directories, delete files or directories, etc. We will discuss them separately in this section.
In order to add and modify users, we also need to set the CVS resource library. here we need to set the cvsroot environment variable, go to "my computer"-> "advanced"-> "environment variable", and set the environment variable named cvsroot in the system variable. In this article, the value of the cvsroot variable is set: e: \ CVs.
Note: To make the settings take effect, you need to restart two services of cvsnt in the service: cvsnt dispatch service 2.5.03.2382 and cvsnt locking service 2.5.03.2382. Otherwise, the cvsroot is not set in the following steps, such as adding a CVS user.
1) Add a CVS user
Command: CVs passwd-A <CVS username>
For example, if you add a user named amigoxie, you can enter the following statement in the command line:
CVS passwd-A amigoxie
Press enter and enter the password you set in the command line. Enter 19821121 here, press enter, and then enter the password,
2) bind a CVS user to the Operating System
Command: CVs passwd-r winuser cvsuser
For example, bind the CVS user amigoxie created in 1) to the operating system user amigoxie. Run the command CVS passwd-r amigoxie. Press enter, the system prompts you to enter the new password and confirm the password. after entering the new password, you can bind the CVS user to the operating system.
3) unbind a CVS user to the Operating System
Command: CVs passwd-r cvsuser
For example, if you enter the command CVS passwd-r amigoxie, press enter and enter the new password and confirm the password. This completes the binding of CVS user amigoxie to the operating system.
4) set the user status to invalid
Command: CVs passwd-x cvsuser
For example, if you enter the command CVS passwd-x amigoxie, press the "enter" key to change the state of the CVS user amigoxie.
5) delete a user
Command: CVs passwd-x cvsuser
For example, if you want to delete a CVS user named amigoxie, enter the following command in the command line:
CVS passwd-x amigoxie
After you press enter, a message is displayed, indicating that the user is successfully deleted.
6) view information about the CVS Module
Command: CVs ls
Enter CVS ls in the command line to view the current module information of CVs, including at least one line of records, that is, cvsroot.
7) retrieve projects and files from the server
Command: CVs checkout projectname
For example, if you want to retrieve the cvsroot project, enter:
CVS checkout cvsroot
After you press the "enter" Key, information about each file is displayed in the command line. This command can export the source code of the latest version to the corresponding directory (C: \ Documents ents and Settings \ amigoxie directory is entered here, So cvsroot is imported into this directory ).
8) Update CVS files or projects.
Command: CVs update file_name
The file_name parameter can be left unspecified. If this parameter is left blank, files in all subdirectories are synchronized. We first create the cvsproject directory under the E:/CVS directory, and set it to the module of CVS by running the command set cvsroot =: sspi: localhost: e:/CVS/cvsproject, after the configuration is successful, run CVs ls in the command line. In addition to cvsroot, The cvsproject module is added. We can use the checkout command (CVS checkout cvsproject) in 7) to retrieve it. Enter CVS update in the command line to update the project.
9) add files or directories to the CVS server
Command: CVs add new_file_or_folder
First, create an amigodirectory and an amigo.txt file in the cvsprojectdirectory we downloaded. Then, go to the C: \ Documents and Settings \ amigoxie \ cvsproject directory in the command line and perform the following operations:
You can see the successfully added file and directory information in. Now we can go to the E: \ CVS \ cvsprojectdirectory to see more amigodirectories and amigo.txt files.
10) add files or directories to the CVS server
Command: CVs commit-M "Comments" file_name
Modify the amigo.txt file under the c: \ Documents ents and Settings \ amigoxie \ cvsprojectdirectory, and add the content amigo To the text file. Enter:
CVS commit-M "modified file" amigo.txt
The running result is as follows: |
In this case, go to the E: \ CVS \ cvsprojectdirectory and check the amigo.txt and V files. When you view the file content, you can see that the file contains the update information.
11) View File version information and modify Information
Command: CVs log file_name
For example, if you enter CVS log amigo.txt in the command line, you can view the modification information of the file and the comments during modification in the command line.
12) version Comparison
Command: CVs diff file_name
When the preceding file and the file in the database have a special command, for example, run the CVS diff amigo.txt command after modifying the amigo.txt file, you can see the relevant modification information in the command line.
View the differences between different versions of a file. Similar statements are available:
CVS diff-r 1.1-r 1.2 file_name
13) Delete the CVS file or directory
Command: CVs Rm-F file_name
CVS commit-M "reason to delete" file_name
For example, if you enter the following information in the command line, you can delete the amigo.txt File Created in 10 bytes, as shown in:
Ii. Client wincvs
Wincvs is a client program of CVS. It uses CVS as the basis. It runs on Windows and constructs a powerful GUI on it, this makes it easy for CVS users on Windows to collaborate. It can be used to log on to the CVS server on Windows and perform operations and management related to CVS.
1. installation and configuration
Http://sourceforge.net/project/showfiles.php? Group_id = 10072
You can download wincvs 2.1.1 on your own. The author downloads the Chinese version 1.3 of wincvs at http://www.8848software.com/wincvs /.
Before installing the wincvs Chinese version, download python at http://www.python.org/download/, and download 2.1.3.pdf.
Note: wincvs only supports versions earlier than python2.2.3. Some problems may occur in other versions. Check whether the correct version is downloaded.
Click the downloaded wincvs.exe file and follow the installation steps to open wincvs. The operation interface is as follows:
We also need to log on to wincvs and click "manage"> "Settings" to bring up the settings page. The settings are as follows:
Click "OK", click "manage"> "Log on", click "OK" on the displayed Logon Settings page, and then the password authentication page appears, enter amigoxie's password information 19821121 and click "OK". If you see the information "***** CVS exited normally with code 0 *****" at the end of the console *****", the logon is successful. The downloaded project is stored in the C:/tmp directory by default.
2. Common Operations
1) Add a file or directory
Create a new doc directory under the C:/tmp/cvsproject directory, and click the C:/tmp/cvsproject folder on the left in wincvs. The new folder is displayed in the displayed box on the right, select the doc folder and click the Add button in red to add the folder.
Create the sterning.txt file in the doccatalog. after entering the doc directory in wincvs, you can see the following information:
After you click the Add button, the status is as follows:
2) Submit a file or directory
After selecting sterning.txt in 1st region, right-click and select submit option. The input comment box is displayed. Click OK to complete directory submission. Directory submission is the same as this operation.
3) update files or directories
For example, the c: \ TMP \ cvsproject \ program file is re-downloaded to the doc directory.
4) version Comparison
The amigo.txt file is created under the doc directory based on steps 1 and 2, and submitted to CVS. The file content is amigo, and the file under c: \ TMP \ cvsproject \ doc is modified simultaneously (a new line is added, and the new line content is sterning ). After selecting the file in wincvs, right-click the file and choose compare option. In the Compare Settings dialog box that appears, click OK, you can see the comparison information between the client version and the latest version on the server, as shown in:
It is clearly displayed that the local (right) has a line more than the latest version (left) on the server.
5) delete a file or directory
For example, in wincvs, select one or more directories to be deleted, and click the black delete option in the Operation column. After the operation is successful, the deleted files are in red, select these files and select "Submit option" to delete them.
In essence, CVS does not delete any files or directories. Even if the above operations are performed, some files are deleted, the actual execution of remote CVS is to put the files submitted for deletion to a directory named [attic]. Therefore, these deleted files can be recovered through some methods.
6) Tag projects and modules
You can use wincvs to tag a project or module at certain stages of project development. The method is as follows:
Select the cvsproject project and click "T" (create tag) on the left of the Operation bar. The "create tag Settings" box is displayed, and the tag name and other information are filled in, for example, if the entered label is branch-release-1-1, click "OK" to add the branch-release-1-1 label to all files of this version.
7) import the project | module to CVS
Create a test folder under the c: \ tmpdirectory, and create the amigo.txt file under the folder. In the action bar on the left of wincvs, select the c: \ TMP \ test folder, right click Import project | module, and the import filter box is displayed, select the "continue" button. The "Import Settings" box is displayed. You can use the default settings. Click "OK" to import the project or module.
8) Check out the project from CVS | module to local path
Right-click a file in wincvs and select "Check project | module". The check out setting box is displayed. On the "check out Settings" tab, enter relevant information, the information entered by the author is as follows:
Iii. Summary
In this article, the author details the knowledge of cvsnt and wincvs, including the installation and configuration of the two, Common commands of cvsnt, and common operations of wincvs. by reading this article, you can be more proficient in version control using CVS.