3. Use LINUX as the CVS server

Source: Internet
Author: User
Article Title: LINUX as the CVS server 3. 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.
3. Related Technologies in management
  
3.1 A technology used to manage source files is called "keyword replacement". After each execution of the "cvs commit" operation, some keywords of the source files will be replaced with available words.
  
$ AUTHOR $ User Name
  
$ Data $ registration time
  
$ Header $ Standard Header, including the full path name, date, and author of the RCS
  
$ Id $ except for incomplete names of the RFM file, it is the same as $ Header $.
  
$ Log $ contains the full path name, version number, date, author, and Log information provided at the time of submission of the RCS.
  
$ RCSfile $ name of the file that contains the RCS, excluding the path name
  
$ Revision $ assigned version number
  
$ Source $ full name of the RCS File
  
$ State $ status of the allocated version, which is allocated by cvs admin-s.
  
For example, before cvs commit, main. c contains
  
Static char * rcsid = "$ Id $ ";
  
After executing cvs commit
  
Change the line of main. c:
  
Static char * rcsid = "$ Id: main. c, v 1.2 15:10:14 trimblef Exp $ ";
  
Of course, this is just a demonstration. In actual program development, this technology has a very useful role. I will not repeat it here. If you are interested, please refer to relevant books.
  
3.2 creating a branch will not affect the trunk when you use the command commit to modify some files. Creating a branch should first create a tag for the files to be modified ).
  
Tags are symbols assigned to a file or a group of files. In the life cycle of the source code, files that constitute a group of modules are assigned to the same tag. Execute them in the working directory.
  
~ Usr/teat/$ cvs tag release-1-0
  
After a tag is created, you can create a branch for it:
  
~ Usr/teat/$ cvs rtag-B-r release-1-0 release-1-0-path print
  
-B: Create a branch.
  
-R release-1-0: Specify the existing tag
  
Releas-1-0-patch: Branch
  
Print: Module name
  
You can use the cvs update-j option to copy and merge changes on the branch and local files.
  
~ Usr/teat/$ cvs update-j release-1-0 print. c
  
After modifying the source file, you can use cvs release to delete the local working copy.
  
And inform other developers that this module is no longer used.
  
~ Use/$ cvs release-d test
  
3.3 conflict resolution
  
When multiple users modify the same file, if the same part is modified and the modified content is different, conflicts are inevitable.
  
For example, there is a file test in the CVS file repository. c. Its version is 1.4. User A first checks out the file and modifies it. Later, user B checks out the file and submits the file to 1.5 in advance, in this way, A conflict occurs when user A submits the file again. In this case, CVS prompts that the file must be manually resolved.
  
For example, in the File Repository version 1.4, the content is:
  
# Include
  
Main ()
  
{
  
Int I;
  
For (I = 0; I <100; I ++)
  
Printf ("Count: % d
", I );
  
}
  
User B 1.5:
  
# Include
  
Main ()
  
{
  
Int I;
  
For (I = 0; I <10; I ++)
  
Printf ("Count: % d
", I );
  
Printf ("Over
");
  
}
  
User:
  
# Include
  
Main ()
  
{
  
Int I;
  
For (I = 0; I <50; I ++)
  
Printf ("Count: % d
", I );
  
Return;
  
}
  
A conflict is prompted during submission, which requires manual editing. If user A runs $ cvs update and then edits test. c, the content of test. c is as follows:
  
# Include
  
Main ()
  
{
  
Int I;
  
<Test. c
  
For (I = 0; I <50; I ++)
  
========
  
For (I = 0; I <10; I ++)
  
>>>>>>>> 1.5
  
   
  
Printf ("Count: % d
", I );
  
<Test. c
  
Return;
  
========
  
Printf ("Over
");
  
>>>>>>>> 1.5
  
}
  
In this way, manual modification is required based on different tasks, which is troublesome. Therefore, in real collaborative development, it is rare to give to the same file, many users share the same permission for submission.
  
3.4 file version management
  
The most important part of the version management system is file version management. The default version number used for system version upgrade is certain. if you want to customize the version number of a file for special purposes, run the following command:
  
Cvs log [-lR] [-r rev] [-d date] [-w login] [files…]
  
The parameter meanings are as follows:
  
-L do not process subdirectories
  
-R handles subdirectories in the same way.
  
-R: Specifies the version number.
  
-D specifies the time
  
-W: specified Login Name
  
Use the following command to see the version number of the current module or all historical versions of the specified file.
  
Cvs annotate [-lR] [-r rev |-D date] files
  
The parameter meanings are as follows:
  
-L do not process subdirectories
  
-R handles subdirectories in the same way.
  
-R: Specifies the version number.
  
Use the following command to see all the modifications to the specified file (after detection.
  
$ Cvs annotate cvstest/c/test. c
  
The output is: Version modifier time source code.
  
1.1 (tang 18-Jan-00): # include
  
1.1 (tang 18-Jan-00): # include
  
1.1 (tang 18-Jan-00 ):
  
1.1 (tang 18-Jan-00): main ()
  
1.1 (tang 18-Jan-00 ):{
  
1.1 (tang 18-Jan-00): int I = 0;
  
1.1 (tang 18-Jan-00 ):
  
1.1 (tang 18-Jan-00): for (I = 0; I <20; I ++)
  
1.1 (tang 18-Jan-00): printf ("Count: % d
", I );
  
1.1 (tang 18-Jan-00 ):
  
1.3 (tang 18-Jan-00): printf ("222222
");
  
1.4 (tang 18-Jan-00): printf ("333333
");
  
1.1 (tang 18-Jan-00 ):}
  
Use the following command to generate a branch version relative to a specified master version:
  
Cvs rtag? B? R rev_root rev_branch file_name
  
The parameter meanings are as follows:
  
-B: generate a branch version.
  
-R: Specifies the trunk node version number of the branch.
  
Rev_root trunk version
  
Rev_branch branch version
  
File_name: Specifies the file. "." indicates all files in the current directory.
  
Use the following command to generate a branch version corresponding to the version number. Because the CVS version number is represented by numbers, the versions of different files in the same module may be different, therefore, it is more convenient to use the logo.
  
Example:
  
$ Cvs rtag? B? R 1.2 tlb-1 SOURCE
  
You can use the "-r" option to access the branch version later.
  
$ Cvs checkout? Tlb-1 SOURCE
  
Switch from the detected version to a branch version:
  
$ Cvs update? Tlb-1 SOURCE
  
Run the following command to view the version information:
  
Cvs status [? VlR] files
  
The parameter meanings are as follows:
  
-V: show all information
  
-L do not display subdirectory Information
  
-R: displays subdirectory information.
  
Command: cvs update? J rev module combines the current modification with the file of the specified version.
  
For example, trunk 1.1 1.2 1.3 1.4 1.5 1.6 trunk
  
Branch tlb-1 1.2.2.1 1.2.2.2 1.2.2.3
  
If you want to merge versions on the branch tlb-1:
  
$ Cvs update? J 1.2.2.3? J tlb-1 test. c
  
1.2.2.3 generates an easy-to-remember identifier by using the tag command.
  
If you want to merge the branch tlb-1 to 1.2 on the trunk:
  
$ Cvs update? J tlb-1 test. c
  
If you want to merge different versions of the trunk (note that the order is important, and all modifications between the specified versions will be discarded ):
  
$ Cvs update? J 1.5? J 1.2 test. c
  
If the module files are increased or decreased between different versions, you can:
  
$ Cvs update? A
  
$ Cvs updata? Jbranch_name
  
Iv. Command set
  
The examples in this chapter introduce a lot of detailed usage of commands, most of which are analyzed from the application perspective. actually. cvs has a large number of commands. similar to gcc, there are not many commonly used commands in cvs. In this section, we list some commonly used commands. the attempt is not repeated in the preceding sections. of course, it is impossible to list all the commands of cvs at the time and level. interested friends. yes. For more information, see cvs instructions and linux man documents.
  
1. Check the source file
  
Cvs checkout [-r rev] [-D date] [-d dir] [-j merg1] [-j merg2] modules
  
The parameter meanings are as follows:
  
-R: Check the module of the specified version.
  
-D check out the module of the specified date
  
-D: Check the specified directory instead of the module.
  
-J: merge the current version with the specified version.
  
Use the following command to check the generated module and generate a directory structure identical to that in the file repository in the current directory:
  
Usr $ cvs checkout project
  
Usr $ cvs checkou
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.