1. Login:
$export cvsroot=:p Server:username@the_server_name:/home/cvsroot
Note:pserver is the way to access, if the server is set password authentication, it is pserver.
Username is the user name of the CVS server and can be modified according to your settings;
The_server_name is the name or IP address of the CVS server;
/home/cvsroot is the Cvsroot directory of your CVS server, modified according to your CVS server settings or asked the administrator.
Log on to the CVS server:
$CVS Login
At this point, CVS will ask for your password, please knock your password on the CVS server:
Passwd:xxxxxxxx
2. Submit Project--import
CVS import [-options] repository Vendortag releasetag ...
Note: This command imports all files (including subdirectories) from the current directory into the source code repository.
Repository: The name of the project, and a warehouse named after this name is created on the CVS server.
Vendortag: The total mark of the project branch. (not commonly used)
Releasetag: Tag that identifies the input level of the file. (General with Start)
When you submit a project using import, CVS asks for a description of the project. In the default state, CVS pops up the text editor. Users can also use the-M "Log_message" to enter descriptive information.
For example
$cvs import-m "Upload the" the "new module" Judecvs v_0_0_1 start
Tip: Import is typically used the first time you import a module. After you modify the file later, you can submit the modified file directly using the Commit command.
3. Export project from CVS--checkout
CVS checkout [options] modules ...
This command exports the items that are already in the source code repository to the current directory.
Modules: Project name
For example, the source file for the JUDECVS project is retrieved from the warehouse.
$cvs Checkout Judecvs
4.CVS Main command---Update updates files in the current working directory
CVS Update [-options] [files ...]
This command compares files in the specified CVS source library with files in the current directory, and updates files in the current directory if there is a later version of the source file in the CVS Source library. This command can only be used after the checkout command has been used.
When executing the update command, CVS is not simply overwriting the current file with the new version, but trying to add the changes made by the new version to the current file. If a conflict occurs, CVS indicates that the conflict occurred in the string "<<<<<<" and ">>>>>>". At this point you can modify the file and resubmit it.
Tip: If you've already done a checkout, then you don't need to checkout, just go to the Cvstest project directory and update it:
For example:
$CD Judecvs
$CVS Update
5.CVS Main command---Status if you do not want to update directly, just want to see if there are newer things, then:
$cvs status
will give each file a status report, similar to this:
==================================================
File:client.c status:up-to-date
Working revision:1.1.1.1 ' Some Date '
Repository revision:1.2/home2/cvsroot/judecvs/client.c,v
The most important thing here is the status bar, where there may be four states in total:
Up-to-date: Indicates that the file you are going to is up to date.
Locally Modified: Indicate that you have modified the file, but have not submitted it, your version is newer than the warehouse.
Needing Patch: Indicates that someone has modified the file and submitted it! Your version is older than the one in the warehouse.
Needs Merge: Indicate that you have modified the document, but others have also modified the file, but also submitted to the warehouse!
6.CVS Main command---Commit save modified to CVS
CVS commit [-LNR] [m ' Log_message ' |-f file] [-R Revision] [files ...]
This command compares the source code in the current directory with the latest version in CVS and updates it.
[-M ' Log_message ']: Enter a description of the change.
[-R Revision]: Specifies the version.
[Files ...] : Specifies that the file be modified.
$cvs commit-m "Add XXX function" client.c
The system will prompt
CVS:----------------------------------------------------------------------
Cvs:enter Log. Lines beginning with ' CVS: ' are removed automatically
Cvs:
Cvs:committing in.
Cvs:
Cvs:modified Files:
Cvs:client.c
CVS:----------------------------------------------------------------------
After exiting, the system asks if continue, enter C, completes checkin
Log message unchanged or not specified
A) bort, c) ontinue, E) dit,! Reuse this message unchanged for remaining dirs
Action: (Continue) C
Checking in client.c;
/home2/cvsroot/judecvs/client.c,v <--client.c
New revision:1.2; Previous revision:1.1
Done
If the file on CVS has been updated by someone else, which is not the latest version of my current job, the system prompts for a commit failure, which requires an update before you commit the consolidated file.
CVS server:up-to-date check failed for ' client.c '
CVS [Server aborted]: correct above errors first!
CVS commit:saving log Message in/tmp/cvsceja9n
Tip: Update or view file status before modifying the file to confirm that the current working version is the latest version.
7. Add files to the project---add
CVS add [k Kflag] [-M ' message '] files ...
This command does not actually add files, just registers them with the project, wants to actually add the files, and also uses the commit command.
For example:
$cvs add-m "Test Add" testadd.c
Tips:
CVS server:scheduling file ' testadd.c ' for addition on branch ' V_0_0_2 '
CVS Server:use ' CVs commit ' to add this file permanently
$cvs Commit
As with the commit process, CVS adds TESTADD.C to the project
8.CVS Main command---Remove files from the project
CVS Remove [-K kflag] [-M ' message '] files ...
As with the add command, this command does not actually delete the file, except to cancel the file from the project, to actually delete the file, and to use the commit command.
e.g.
$RM TESTADD.C
$cvs RM testadd.c
System prompts
CVS server:scheduling ' testadd.c ' for removal
CVS Server:use ' CVs commit ' to-remove this file permanently
$cvs Commit TESTADD.C
At this point, CVS removes the TESTADD.C from the latest version of the project, but if it has a previous version, the previous version still exists.
Simplified forms of some common commands:
CVS Co
CVS up filename Commit modification
CVS CI filename confirm modification
CVS log filename View modify log
CVS St filename viewing file status
CVS RM filename Deletes a source file physically
Using the CVS command on Linux
1 Login to CVS server:
cvs-d:p server:username@host:/$CVSROOT Login
You will then be prompted to enter your password. or direct use:
cvs-d:p Server:user:pwd@host:/cvs Login
2) Checkout:
cvs-d:p Server:host:/cvsroot Checkout ProjectName
3 If you want to omit the-D and service directory above, execute:
Export cvsroot=:p Server:user@host:/cvsroot
4) Update:
CVS Update
CVS Update-c (Override and update)
5 CVS Status: Displays the update status of the current file.