|
| 1 | +--- |
| 2 | +--- |
| 3 | + |
| 4 | +# General Things To Know About CVS |
| 5 | +**Author:** Pantelis Roditis |
| 6 | +**Created:** 2006/08/14 05:08 |
| 7 | + |
| 8 | +# Introduction |
| 9 | +Here is a basic tutorial for CVS for new users. If you are new to CVS these are some basic commands to help you. |
| 10 | + |
| 11 | +# Basic Commands |
| 12 | + * **`cvs add`**: Add a new file or directory to the repository. After the |
| 13 | + add, a cvs commit must be performed. The files will be added in the |
| 14 | + repository the next time you run a "cvs commit". |
| 15 | + * **`cvs commit`**: Use this command when you wish to `publish` your |
| 16 | + changes to other users. |
| 17 | + * **`cvs update`**: This command is executed when you wish to update your |
| 18 | + copies of source files from changes that other users have made to the source |
| 19 | + in the repository. |
| 20 | + * **`cvs checkout`**: Creates the private copy of the source. You can work |
| 21 | + with this copy without interfearing with the other users. |
| 22 | + * **`cvs import`**: Incorporates a set of updates from off-site into the |
| 23 | + repository. |
| 24 | + * **`cvs remove`**: remove files from source repository, pending a cvs commit |
| 25 | + on the same files. |
| 26 | + * **`cvs diff`**: show changes between files in working directory and source |
| 27 | + repository, or between 2 revisions in same repository. |
| 28 | + * **`cvs release`**: cancel a cvs checkout |
| 29 | + * **`cvs status`**: show the current status of files |
| 30 | + |
| 31 | +# How to add a new user |
| 32 | + |
| 33 | +In order to add a new user you need to modify two files, the **passwd** and the |
| 34 | +**readers/writers** file. Both files can be found under the CVSROOT directory. |
| 35 | + |
| 36 | +The first step is to add the user into the passwd file. The file looks something like: |
| 37 | +``` |
| 38 | +user1:-p1MW3dBhIj3w:cvs |
| 39 | +user2-pgh0UZHzz4ho::cvs |
| 40 | +user3:-pRzNIIV2J0L6:cvs |
| 41 | +``` |
| 42 | + |
| 43 | +Where, **user1** is the username of each user, **p1MW3dBhIj3w** is the |
| 44 | +encrypted password of the user and **cvs** is the optional system username. |
| 45 | + |
| 46 | +In order to add a new user simply copy a line and change the username and the |
| 47 | +password in its encrypted form. In order to encrypt the password type: |
| 48 | + |
| 49 | +``` |
| 50 | +encrypt -s SA -p |
| 51 | +Enter string: type here the desired password |
| 52 | +``` |
| 53 | + |
| 54 | +After adding the user to the passwd file, you also need to add him/her into the |
| 55 | +readers or writers file (see more details about readers and writers file in the |
| 56 | +sections that follow). |
| 57 | + |
| 58 | +The readers/writers files look something like: |
| 59 | + |
| 60 | +``` |
| 61 | +user1 |
| 62 | +user2 |
| 63 | +user3 |
| 64 | +``` |
| 65 | + |
| 66 | +So just simply type the user you desired to add in a new line. |
| 67 | + |
| 68 | +# How to give write access to a user |
| 69 | + |
| 70 | +In order to give write access to a user, simply add his/her name to the |
| 71 | +**writers** file which can be found under CVSROOT directory. The writers file |
| 72 | +looks something like: |
| 73 | + |
| 74 | +``` |
| 75 | +user1 |
| 76 | +user2 |
| 77 | +user3 |
| 78 | +``` |
| 79 | + |
| 80 | +To add a new user into the writers file, simply add that user in a new line. |
| 81 | +Save and exit. |
| 82 | + |
| 83 | +# How to give read only access to a user |
| 84 | + |
| 85 | +Similarly to above, but this time the name of the user is added in the file |
| 86 | +**readers** which can be found under the CVSROOT directory. The readers file |
| 87 | +looks something like: |
| 88 | + |
| 89 | +``` |
| 90 | +user1 |
| 91 | +user2 |
| 92 | +user3 |
| 93 | +``` |
| 94 | + |
| 95 | +In order to add a new user to the readers file, simply add him/her under a new |
| 96 | +line. Save and exit. |
| 97 | + |
| 98 | +# Start a new project |
| 99 | +In order to start a new project follow the following steps: |
| 100 | + |
| 101 | + |
| 102 | +* Go to the top of the project tree: |
| 103 | +``` |
| 104 | +cd /home/myproj |
| 105 | +``` |
| 106 | + |
| 107 | +* Import the new project to cvs. start = releasetag |
| 108 | +``` |
| 109 | +cvs import -m "Initial Import into CVS" myproj echothrust start |
| 110 | +``` |
| 111 | + |
| 112 | +Where: |
| 113 | +- `myproj` is the name under which you will check out the project, |
| 114 | +- `echothrust` is the vendor tag that we will be using |
| 115 | + |
| 116 | +> NOTE: `cvs` will ignore certain files based on some rules: |
| 117 | +> * Empty directories will not be imported (you can fix this by simply creating a dummy file like \ |
| 118 | +> `find . -type d -empty -exec touch {}/.dummy \;` |
| 119 | +> * Certain filename and directory patters will not be imported. This can be fixed by adding `-I!` |
| 120 | +> after the import, so the command will look like \ |
| 121 | +> `cvs import -I! -m "mycomment" myproj echothrust start` |
| 122 | +
|
| 123 | + |
| 124 | +# How to create new file/directory |
| 125 | + |
| 126 | +* In order to create a new file into the cvs, firstly you need to create that file. |
| 127 | +``` |
| 128 | +vi new_file |
| 129 | +``` |
| 130 | + |
| 131 | +* In order to add that file into the repository, simply type |
| 132 | +``` |
| 133 | +cvs add new_file |
| 134 | +``` |
| 135 | + |
| 136 | +* The last step is to publish your file to the others. In order to commit the file type: |
| 137 | +``` |
| 138 | +cvs commit new_file |
| 139 | +``` |
| 140 | + |
| 141 | +* Now you are done. Another user can see the new_file when s/he will update the CVS. |
| 142 | + |
| 143 | + |
| 144 | +The added files will be placed in the repository after a cvs commit will be |
| 145 | +performed. If a file was removed and a cvs commit has not taken place yet, you |
| 146 | +can retrieve that file using cvs add. |
| 147 | + |
| 148 | + |
| 149 | +Similarly, in order to create a new **directory** in the repository firstly you |
| 150 | +need to: |
| 151 | + |
| 152 | +* Make a new directory |
| 153 | +``` |
| 154 | +mkdir new_directory |
| 155 | +``` |
| 156 | + |
| 157 | +* Then you need to add that directory in the repository, using |
| 158 | +``` |
| 159 | +cvs add new_directory |
| 160 | +``` |
| 161 | + |
| 162 | +**NOTE**: You cannot add an empty directory into the repository. You need to |
| 163 | +create a file into the directory and then you can do: |
| 164 | +``` |
| 165 | +cvs add new_directory |
| 166 | +cvs add new_file |
| 167 | +``` |
| 168 | + |
| 169 | +* In order to publish your new_directory to the other users, commit your work by using: |
| 170 | +``` |
| 171 | +cvs commit |
| 172 | +``` |
| 173 | + |
| 174 | +* The other users will be able to see the new directory once they update their CVS. |
| 175 | +``` |
| 176 | +cvs update |
| 177 | +``` |
0 commit comments