First, what is CVS? CVS - Concurrent Versions System Parallel version system; it is a standard version control system; centralized management of code; record code all changes history; provide collaborative development; support multiplayer while Checkout and merge . Working in client / server mode, all users perform CVS operations on the client, and all commands are performed in the CVS server.
Second, CVS Basic Concept 1.CVS Warehouse: Also known as the master copy, is where the CVS system saves software resources. All versions of all files in all projects are saved in this library. 2. Version: Developers have formed a new version each time to submit to CVS. 3. Work Copy: Out from the CVS server side, save the code copy on the client computer we are using. Each person has a copy of your own work. 4. Check the code (Create a copy check out): Remove the code from the server, it is the process of creating a copy. 5. Submit code: Send the code to the server, and COMMIT is called Check IN. 6. Import Code: The code that is not managed by the CVS is introduced into the CVS system, and it will be managed by CVS. 7.CVS log: CVS used to record information for each operation. Log information can be viewed with a cvs log command. 8. Update: In collaborative development environments, take the latest changes made by others from the CVS warehouse to your work copy, so that you have to work with the latest version of the warehouse. Using Update is a means of synchronizing each working copy. 9. Conflict: In a collaborative development environment, a conflict occurs when two developers have modified the same file and submit a CVS warehouse sequentially. This conflict requires developers to handle, and submit new versions of the formation of release conflicts into the CVS warehouse.
Third, the CVS command: 1. Set the environment variable. Set cvsroot =: pserver: xxx@192.168.0.226: E: / cvsroot
Set cvsroot =: pserver: xxx@ansi.3322.org: E: / CVSROOT
2. Check out the work version to the working directory. $ CD $ CVS CO Account / src / Common This command only checks out the Account / SRC / Common directory structure to the local. If you use $ CVS CO Account, all directory structures under Account are checked out.
3. Submit a modified file to the CVS version library: $ cvs ci
4. Submit a new directory or file to the CVS version of the library: $ CVS Add
5. Delete the directory and file, you need to delete the file in the directory $ RM
Perform $ CD .. $ CVS UP -P
Remove the empty directory (just delete the empty directory of the local work copy).
6. View file status $ CVS Status
For example: $ cvs st ffun.c
============================================================================================================================================================================================================= =============== File: ffun.c status: up-to-date
Working revision: 1.1 WED NOV 6 11:29:04 2002
Repository revision: 1.1 /szunicom/dev/billing/src/preproc/cdma/ffun.c ,v
Sticky Tag: (NONE)
Sticky Date: (NONE)
Sticky Options: (NONE)
Note: The most important thing is the Status column, you can have the following status: up-to-date: indicating that your work copy is the latest. Locally Modified: Indicates that you have modified the file, but have not submitted, your version is new than the warehouse. Needing Patch: Indicates that someone has modified the file and has been submitted! You have not modified but your work copy version is more than the old in the warehouse. Needs Merge: Indicates that you have modified the file but did not commit, and some people also modified this file and submitted to the warehouse. LOCALLY Added: Indicates that the "add" command adds the file, but there is no "commit" locally remoded: indicates that you use the "Remove" command, but there is no "commit" unkown: CVS does not know about this file. For example, you created a new file without using the "add" command
Workaround: If the status is LOCALLY MODIFIED, you need to perform $ CVS CI
If the status is: LocallyAdded, you need to perform $ CVS CI
7. View the modification between the last version of the work copy and the last version of the warehouse $ CVS DIFF SRC.C
8. View the modification between the specified version $ CVS DIFF -R 1.1 -R 1.2
9. Version Retreat (Take a previous version) There are two ways: First, only the file of a version is output to standard output: $ cvs up -p -r
The other is to redirect the output to the standard output to the file: $ cvs up -p -r
Such as: Currently the version number of the ABC.C file is 1.5, to remove the 1.2 version, then execute $ cvs up -p -r 1.2 ABC.c> abc.c
If you do not use the "-P" option to return, but use the $ cvs up -r 1.2 abc.c command, then if you modify the 1.2 version, you will appear as follows: CVS Ci
CVS commit: examining.
Cvs Commit: Sticky Tag `1.2 'for File` Abc.c' is not a branch
CVS [Commit Aborted]: CORRECT ABOVE ERRORS FIRST!
Solution two ways: i, modify the CVS / Entries file, delete the following yellow markings. $ CD CVS
$ VI E *
/Abc.c/1.2/tue Dec 17 13:33:06 2002 // T1.2
Di
~
~
II, use the $ cvs up -a abc.c command to eliminate the attached label, but the command is merged with the latest version, but also modify ABC.C and resubmit.
10. How to restore the file or directory that has been deleted: I. Recover the file after the [REMOVE] command is executed. ◇ [Ctrl L] directly enter the command cvs add xxxxx, or execute the [Add Selection] interface operation. ◇ This can directly recover the deleted files that have not been submitted. Ii. Recovered files after the [commit] command is executed. ◇ You can only enter the command cvs add xxxxx directly with [CTRL L], and you will get an empty file. ◇ Select this empty file, execute [update] operation, get the entity of this file. ◇ Select this file again, execute the [commit] operation, get the latest version of this file. Iii. Because any directory is not deleted in the CVS system, it is not possible to recover the recovery of the directory, but the CVS system is to delete the empty directory on the user's local (such as: YCW2000), so Use the following method to get an empty directory that has been deleted: CVS Checkout -P XXX, or you can set it in the Admin => Preference [Global] page.