Configuration and use of CVS servers and WinCVS
2003-9-17 Wei network power
The first part of the configuration CVS server (to version 1.10) Author: Wu Yan Xi Email: Yanxi-Wu @ 21cn.com1, install CVS and CVS servers brief: CVS is the more popular version with an excellent management and control tool, it deeply Most developers are loved by system management, and it is also a powerful tool for managing other daily documents (such as Word Work Documents). This section will make a simple, concatenation and use method of the CVS server, to help you use CVS as soon as possible to make some versions of management and control work. 2, the installation of the CVS server can be downloaded from many places on the Internet, or you can download it from the official website of CVS. Download the appropriate version according to the system you use, then install it. Because most people are managed using the CVS server under Linux, and Redhat Linux is one of the most popular Linux distributions, so this article is mainly based on Redhat Linux. First download the RPM package of the CVS server, of course, you can also download other methods such as source packages, which is one of Linux's advantages. Then use the following command to install: rpm -ivh cvs-1.10.8-3.i386.rpm 3, configure / etc / services file: The first thing after installation is to configure the configuration file of the CVS server so that it can Normal work. First, add CVSPServer in the Services file, which makes it a service of Linux, is the entrance of the CVS server routine, configured as follows: CVSPServer 2401 / TCP # CVS Client / Server Operations CVSPSERVER 2401 / UDP # CVS Client / Server Operations 4, Configure xinetd, start the CVS server with xinetd: Go to the /etc/xinetd.d/ directory, then edit a text file, the name must be the same as the entry name CVSPServer in / etc / services, so here CVSPServer is used as the file name, The contents of the file are as follows: Service cvspserver {disable = nosocket_type = streamwait = number = rootenv = Home = server = / usr / bin / cvsserver_args = -f --allow -root = / home / cvsroot pserver // Specify the authentication method PSERVER, Note: -f} Note: A. The name behind the service must be the same as the CVS service name in the / etc / service file; b, env = home = The purpose of this line is to solve some CVS operations The error generated by the read /Root/.cvsignore file, the above ENV is the meaning of the line to set the environment variable home when running the CVS service, so although the user who performs CVS is root, but because there is no HOME environment Variables, so CVS will not read /Root/.cvsignore files. 5. Configuring CVS users with CVSRoot's home and genus: First create a user group CVS, you can use GroupAdd or addgroup, you can also add this group directly to the / etc / group file, then add a user cvsroot, then modify / modify / The ETC / Passwd file enables the default group of the CVSRoot user, not the cvsroot group (that is, modifications).
Create a cvsroot directory in the / home directory (you can also be built in other directory you like), then modify the host and attributes of / home / cvsroot: #Chown cvsroot.cvs / home / cvsroot #chmod 771 / home / cvsroot 6 , VS is initialized: Another important thing after installing the CVS server is to initialize the root directory of the CVS server, and the CVS project created later will be built in this directory, the commands adopted are as follows: #CVS -D / home / cvsRoot init This directory / home / cvsroot is the root directory of the CVS server, and the directory created later will save the default in this directory. 7. Log in to the CVS server (Sign in under Linux or other UNIX system): a, if it is remote login, use the following syntax: #cvs -d: pserver: cvsroot @ host: / home / cvsroot login cvs password: / / Enter the password of the user cvsroot; if no other prompts appear, it means that the login is successful, otherwise, according to the prompt, the corresponding modification is performed. The syntax of the login command will be described: where: PServer means that the user login authentication is used in the PServer mode, and the general CVS server uses this approach. Of course, other ways, specific references;: cvsroot The username of the login, as long as it is a member of the CVS group, such as: Cather; @Host means that the server to log in, can be a DNS name, or an IP address, such as: 10.104.1.204;: / home / cvsroot Represents CVS Directory on the server or other directory (by directory decision by using the initial initialization you specify in Section 6); Tip: You can also put export cvsroot =: pserver: jchuang@192.168.0.8: / home / CVSRoot This sentence is written directly in the user's initialization file (such as: .bash_profile) so that users can log in to the CVS server only when the user logs in each time you log in. b, if it is locally logged in, you can write export cvsroot = / home / cvsroot in the user's initialization file such as .bash_profile; then directly 8, add a new project module to CVS, us, there is one or more A project, so we can generate a new CVS project with the following steps. Place a project file in CVS for version control, referred to as import (Import) in CVS terms. It can be seen from the name that you need to work for this before importing. The basic requirement of the input operation is a "clean" directory structure. "Clean" means that there is no version of the file that is 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. Note that CVS thinks that the empty directory 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. It is recommended that you create a file called readme.txt whose content is a brief description of the directory.
Enter the directory of an existing project, such as the cvstest: $ cd cvstest running command to import the project file into the CVS warehouse: $ cvs import -m "this is a cvstest project" cvstest v_0_0_1 Start Description: Import is one of the commands of CVS Indicates input project files to the CVS warehouse. The strings behind the -m parameter are description text, describe the project, if the -m parameter is not added, then CVS will automatically run an editor (typically vi, but can change to you like to use the environment variable editor. Editor) Let you enter information, cvstest is the project name (actually a warehouse name, stored in the warehouse named after this name) v_0_0_1 is the total mark of this branch. Nothing to use (or not common) START is the key to the input level of the IMPORT logo file, no use. This creates a CVS module called cvstest under the directory / home / cvsroot specified by the user, then, we can delete this test item file, test how to get files from the warehouse this will be in the future End article will be described. (Note: This section mainly refers from HTTP: //LINUXAID.COM.CN He Weiping's "CVS Server Quick Guide") 9, from the CVS local server, the corresponding module: A. If it is on the computer where the CVS server is located, Use the following command directly: #CVS Checkout STW will put the STW project module Checkout to the current directory. B. If you are running Linux or other UNIX system, you can also use the previous command to Checkout to the current directory after logging in. In addition, if you checkout in the Windows side, WinCVS can be used, then some of the other configurations of WinCVS, the next part will specifically describe its configuration method. Part II WINCVS Configuration and Usage Method 1 Since there are many companies currently use Linux / UNIX to do server, use Windows to do a client, so WinCVS and CVS servers will use the most powerful version control and management system. 2, WinCVS download and installation; the latest WinCVS can be downloaded from http://sourceforge.net/project/showfiles.net/project/showfiles.php?group_id=10072 address, or downloaded to the latest on http://sourceforge.net/project Or other versions of WinCVS.
After downloading to the corresponding version, install it according to the wizard, you have to use CVS users, install this WinCVS should have no problem! 3, configure the setting of WinCVS: A, general option, select admin-> preferences ..., the following interface appears: First, Authentication: The authentication method used to configure the CVS server, you can select another authentication method from the drop-down box, but general As long as you choose the default PServer mode, you should note that you must consistent with the authentication method specified in the CVS server configuration; second, PATH: The main directory path used to configure the CVS on the server, that is, the server is used for CVS Initialized directory, such as: / home / cvsroot; third, host address: The address used to configure the server where the CVS server is located, or the DNS name, such as: 10.104.1.204; fourth, user name: Used to configure the username to log in to the CVS server, such as: cvsyxwu, the user's login must be added by the administrator to the CVS user group; fifth, cvsroot: This general does not require users to modify, users When a few options on the input, the system will automatically generate this corresponding content according to the user's input. b, the setting of the global option, select "Globals" on the previous interface: This configuration is mainly important to pay attention to these options: First, Checkout Read-Only Don't choose, otherwise, Checkout's source code will not allow The user is modified, and this option is selected by default; second, prune (transove) EMPTY DIRECTORIES should not be selected, otherwise it will automatically delete the empty directory; third, there is no special requirements for general configuration, put Dirty Files Support, Supply Control when Adding is selected; 4. Login Server: Select Admin-> Login, the following dialog box requests the user to enter the login password into the password, select the "OK" button if the CVS server is configured with WinCVS If you haven't erroneous, you will be prompted in the status bar of CVS: cvs -z9 -d: pserver: cvsyxwu@10.104.1.204: / home / cvsroot login logging in To: PServer: cvsyxwu@10.104.1.204: 2401 / Home / CvsRoot ***** CVS EXITED NORMALLY WITH code 0 ***** Code 0 indicates the correct login; if an error, it will be Code 1, then the corresponding modification is performed according to the error prompt. 5. From the CVS server, the CHECK OUT corresponding module: First, in the modules in Workspace Select the directory you want to store the Checkout module; On The Server is to store the directory of Checkout content, input by user; and Local Folder To Checkout To is the directory selected by the first in the first middle.
6. After the modification, the file is submitted to the CVS server a), only one user modifies the file to modify the file from the file, and the file after the modification will be red, as follows Figure EXAMPLE.H file: Select the red file eXample.h and right click to select the "Commit Selection" option, if no other users have modified it and have been submitted to the CVS server, everything will be submitted to the example.h file will be submitted. Go to the CVS server and restore the icon into the original color. b), the case of modifying the different parts of the same file in two or more users is that the user A and the user B CHECKOUT has the file EXAMPLE.H, the content is as follows: int Callby (int count) {Printf ("ExcelStor! / N");} void main (int Argv, char * argc) {// added by my cvsprintf ("i am cather / n");} int mainexample () {Printf ("ok / n" );} Then user A is modified as follows, and submitted to the CVS server (generally submitted): int Callby (int count) {// addprintf ("excelstor! / N");} void main (int Argv, char * Argc) {// added by My CVSPrintf ("I am Cather / N");} int mainexample () {// addprintf ("ok / n");} Then the user B is modified as follows: int Callby (int COUNT) {// addprintf ("excelstor! / n");} void main (int Argv, char * argc) {// modifiedprintf ("I am cather / n");} int mainexample () {// addprintf ("OK / n ");} When the user b selects" Commit Selection ": CVS Server: Up-to-Date Check Failed for` Example.h'cvs [Server Aborted]: Correct Above Errors first! At this time, there is already Users modify and submit them to the CVS server for the same file, at this time, select "Update Selection" to synchronize and merge the EXAMPLE.H file on the CVS server, without any options that appear without selecting any options. Directly select "OK", then the following: cvs -z9 Update Example.h (in Directory C: / My CVS file: / src /) RCS file: / HOME/cvsRoot/stw/src/example.h, VRETRIEVING Revision 1.5 RETRIEVING Revision 1.6ME RGING DIFFERENCES BETWEEN 1.5 and 1.6 INTO EXAMPLE.HM EXAMPLE.H ***** CVS EXITED NORMALLY WITH CODE 0 ***** Indicates that user B is the modification of user b and user A. The icon of the file EXAMPLE.H will also By red, the merged file is stored on the local machine of User B. To update to the CVS server, you must also select Example.h and right click to select the "commit selection" to submit the result of the user A and the user B. Go to the CVS server. Note: m indicates that this file has been modified.
c), two or more users modify the same part of the same file, as the user A and the user B download the file eXample.h, the content is as follows: void main (int Argv, char * argc) {Printf ("I am Cather / N");} Then user A modifies the file into the following and submits to the CVS server (generally submitting normal): void main (int Argv, char * arg) {printf "I am Cather / N"); Printf ("I am PAT / N");} Then the user B modifies the files as follows: void main (int Argv, char * arg) {printf ("I am Cather / N "); Printf (" i love you cather / n ");} If User B selects" Commit Selection "to prepare to submit the modification result to the CVS server, the following error tips are displayed: cvs -z9 commit -m "Update in 11:20" Example.h (in Directory C: / My CVS / STW / SRC /) CVS Server: Up-to-Date Check Failed for `Example.h'cvs [Server Aborted]: Correct Above Errors First ***** CVS EXITED NORMALLY WITH CODE 1 ***** Indicates that user B changes conflicts with other users, then select "Update Selection", will display the following prompt: CVS -Z9 Update Example. h (in directory C: / my cvs / STW / src /) RCS file: /home/cvsroot/STW/src/example.h,vretrieving revision 1.9retrieving revision 1.10Merging differences between 1.9 and 1.10 into example.hrcsmerge: warning: Conflicts During MergeCvs Server: Conflicts Found in Example.hc Example.h ***** CVS EXITED NORMALLY with CODE 0 * **** EXAMPLE.H The previous C represents a conflict with other users, and the icon of the file will display a "C" as follows: Double-click Example.h will display the contents of Example.h, as follows: Void Main (int Argv, char * argc) {printf ("I am yanxi / n"); Printf ("I am cather / n"); <<<<<<< Example.hprintf ("i love you yanxi, TOO ! / n "); // This part is your modification ======= Printf (" i love you "); // This part is a modification of other users >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 1.10} At this point you should negotiate with the user A to determine how to modify it.
For example, it can be modified: void main (int Argv, char * arg) {printf ("I am yanxi / n"); Printf ("I am Cather / N"); Printf ("i love you yanxi, TOO! / n "); // This section provides your modification of Printf (" I Love You Cather! / N "); // This section is the modification} of other users} and select" Commit Selection "to submit, will display the following prompt information : Cvs -z9 commit -m "Update in 11:20" EXAMPLE.H (in Directory C: / My CVS / STW / SRC /) Checking in Example.h; /Home/cvsRoot/stw/src/example.h, V <- example.hnew revision: 1.11; previous revision: 1.10done ***** CVS EXITED NORMALLY WITH code 0 **** indicates that user a and user changes have been merged. In this way, the issues that will be submitted to the CVS server are basically these, and users should modify according to the actual issues encountered. 7. Adding a new file to the CVS server After adding a file locally, you are submitted to the server. First select the file, then click "Add button", after adding the file, then select the submit command "Commit Selection" in the right-click menu. As shown in the figure, select the file eXample.h.bak, because eXample.h.bak is currently not a CVS file, this "Add button" will be changed by the unique state to an optional state, so Status is displayed as "Noncvs File", select After the "Add button", the example.h.bak icon will turn red and add an A letter, then select Example.h.bak, right click, select "Commit Selection" to submit the file EXAMPLE.H.BAK to CVS A file that is CVS on the server. 8. Conclusion here, you basically have configured a practical CVS server with WinCVS client for yours or companies, and work with CVS to use CVS to perform system development or other documents.
Author: tonny Source: Reproduced