version 7, including all changes.
.
Rev |
Author |
# |
Line |
1 |
AristotlePagaltzis |
1 |
!!! Intro |
|
|
2 |
|
|
|
3 |
There are 3 commands you need to know to use [CVS]: |
|
|
4 |
|
|
|
5 |
* <tt>cvs checkout</tt> |
|
|
6 |
* <tt>cvs update</tt> |
|
|
7 |
* <tt>cvs commit</tt> |
|
|
8 |
|
|
|
9 |
More commands are necessary to set up a repository, but the above are all you need to get things out of and back into an existing repository. |
|
|
10 |
|
|
|
11 |
To work with a repository you can either pass a <tt>-d ''/path/to/cvsroot''</tt> argument to cvs(1) for every operation, or set the <tt>CVSROOT</tt> EnvironmentVariable to point to it: |
|
|
12 |
|
|
|
13 |
<verbatim> |
|
|
14 |
export CVSROOT=/path/to/cvsroot |
|
|
15 |
</verbatim> |
|
|
16 |
|
|
|
17 |
This is most useful when you actually work with a particular repository. Passing the <tt>-d</tt> switch is more convenient for one-off operations, such as checking someone else's project out of their repository for compiling with no intent to actually commit back any changes. |
|
|
18 |
|
|
|
19 |
Checking stuff out of the repository is trivial. You just need to know which “module” you want to check out: |
|
|
20 |
|
|
|
21 |
<verbatim> |
|
|
22 |
cd ~/src # where to check out the code to |
|
|
23 |
cvs checkout report # check out module named "report" |
|
|
24 |
</verbatim> |
|
|
25 |
|
|
|
26 |
Note that the files are not checked out into the current directory, but into a directory named after the module. So next you'll probably want to go in there: |
|
|
27 |
|
|
|
28 |
<verbatim> |
|
|
29 |
cd report |
|
|
30 |
</verbatim> |
|
|
31 |
|
|
|
32 |
Now make the desired changes to the respective files. Getting the changes back into the repository is very easy: |
|
|
33 |
|
|
|
34 |
<verbatim> |
|
|
35 |
cvs commit |
|
|
36 |
</verbatim> |
|
|
37 |
|
|
|
38 |
You need to do this from the correct directory, because [CVS] needs to find the files with MetaData it created when you checked things out. These records store information such as which module in which repository things came from. |
|
|
39 |
|
|
|
40 |
You can also commit specific files only: |
|
|
41 |
|
|
|
42 |
<verbatim> |
|
|
43 |
cvs commit README todo.txt |
|
|
44 |
</verbatim> |
|
|
45 |
|
|
|
46 |
!!! Setting up a local [CVS] repository |
|
|
47 |
|
|
|
48 |
If the machine does not have a repository set up, you need to decide where to store the modules. <tt>/var/lib/cvs/</tt> might be a good place for a multiuser system: |
|
|
49 |
|
|
|
50 |
<verbatim> |
|
|
51 |
sudo mkdir -m 775 /var/lib/cvs/ |
|
|
52 |
export CVSROOT=/var/lib/cvs/ |
|
|
53 |
</verbatim> |
|
|
54 |
|
|
|
55 |
Or for just yourself, use your home directory: |
|
|
56 |
|
|
|
57 |
<verbatim> |
|
|
58 |
mkdir ~/cvs |
|
|
59 |
export CVSROOT=~/cvs |
|
|
60 |
</verbatim> |
|
|
61 |
|
|
|
62 |
Or pick any other place you might prefer. Then create a skeleton repository: |
|
|
63 |
|
|
|
64 |
<verbatim> |
|
|
65 |
cvs init |
|
|
66 |
</verbatim> |
|
|
67 |
|
|
|
68 |
Now, you need to import a SourceCode module and store it in the repository. First, decide on a module name; this will be a directory name internally, so it should probably have no spaces. Additionally, you need a “vendor tag” to identify the owner of the files; in practice, any arbitrary name will do. You also need to pick a “release tag” which will be used as the initial version of the files being imported. |
|
|
69 |
|
|
|
70 |
<verbatim> |
|
|
71 |
cd source/code/topdir # wherever the files and directories to import are |
|
|
72 |
MODULENAME="report" |
|
|
73 |
VENDORTAG="original upstream" |
|
|
74 |
RELEASETAG="initial" |
|
|
75 |
cvs import "$MODULENAME" "$VENDORTAG" "$RELEASETAG" |
|
|
76 |
</verbatim> |
|
|
77 |
|
|
|
78 |
cvs(1) will launch the editor specified in your <tt>EDITOR</tt> or <tt>VISUAL</tt> EnvironmentVariable to ask for a comment. Just put <tt>initial version</tt> or something. |
|
|
79 |
|
|
|
80 |
This will create a new directory <tt>$CSVROOT/$MODULENAME</tt>. Note that this only sets up the module. You now need to check it out of the repository before making any changes. |
|
|
81 |
|
|
|
82 |
<verbatim> |
|
|
83 |
cvs checkout "$MODULENAME" |
|
|
84 |
</verbatim> |
|
|
85 |
|
|
|
86 |
!!! Legend of the <tt>cvs update</tt> status letters |
|
|
87 |
|
|
|
88 |
__A__: |
|
|
89 |
added to your checked out version by [CVS] |
|
|
90 |
__C__: |
|
|
91 |
conflict between your local changes and someone else's committed changes |
|
|
92 |
__M__: |
|
|
93 |
modified on your end but not yet committed |
|
|
94 |
__P__: |
3 |
JohnMcPherson |
95 |
patched to bring your (unmodified) version up-to-date with the last change. |
1 |
AristotlePagaltzis |
96 |
__R__: |
|
|
97 |
removed from the main repository |
|
|
98 |
__U__: |
3 |
JohnMcPherson |
99 |
updated your (unmodified) version with other people's (multiple?) changes |
1 |
AristotlePagaltzis |
100 |
|
|
|
101 |
---- |
|
|
102 |
|
|
|
103 |
!! An examples using the GreenStone SourceCode |
|
|
104 |
|
|
|
105 |
This particular repository allows anonymous, read-only checkout. pserver is the protocol used for that. |
|
|
106 |
|
|
|
107 |
<verbatim> |
|
|
108 |
export CVSROOT=:pserver:cvs_anon@cvs.scms.waikato.ac.nz:/usr/local/global-cvs/gsdl-src |
|
|
109 |
</verbatim> |
|
|
110 |
|
|
|
111 |
You would need a username and password on that particular machine and use [SSH] to have write access. If you do, the EnvironmentVariable~s will be slightly different: |
|
|
112 |
|
|
|
113 |
<verbatim> |
|
|
114 |
export CVS_RSH=ssh |
|
|
115 |
export CVSROOT=:ext:username@server:/directory/to/repository |
|
|
116 |
</verbatim> |
|
|
117 |
|
|
|
118 |
Now check out the code: |
|
|
119 |
|
|
|
120 |
<verbatim> |
|
|
121 |
cvs checkout gsdl |
|
|
122 |
</verbatim> |
|
|
123 |
|
|
|
124 |
Make your own changes to the source code: |
|
|
125 |
|
|
|
126 |
<verbatim> |
|
|
127 |
dd if=/dev/random of=a_source_file.cpp bs=1k count=$RANDOM |
|
|
128 |
</verbatim> |
|
|
129 |
|
|
|
130 |
(I swear this is how some of our 4th years come up with their code...) |
|
|
131 |
|
2 |
AlastairPorter |
132 |
Now, you can use [CVS] to see how your stuff differs from everyone else's, and how to get everyone else's changes into your checked out version. |
1 |
AristotlePagaltzis |
133 |
|
|
|
134 |
<pre> |
|
|
135 |
__$ cvs update__ |
|
|
136 |
? HTMLPlug.pm-readme |
|
|
137 |
? mht |
|
|
138 |
cvs server: Updating . |
|
|
139 |
P ~ConvertToPlug.pm |
|
|
140 |
M HTMLPlug.pm |
|
|
141 |
P ~WordPlug.pm |
|
|
142 |
</pre> |
|
|
143 |
|
|
|
144 |
P means "patched"; my version was patched to be updated to other people's changes that they have committed. M means locally modified (ie by me). |
|
|
145 |
|
|
|
146 |
You can see what is different between my version and the current checked in version: |
|
|
147 |
|
|
|
148 |
<pre> |
|
|
149 |
__$ cvs diff HTMLPlug.pm__ |
|
|
150 |
Index: HTMLPlug.pm |
|
|
151 |
=================================================================== |
|
|
152 |
RCS file: /usr/local/global-cvs/gsdl-src/gsdl/perllib/plugins/HTMLPlug.pm,v |
|
|
153 |
retrieving revision 1.58 |
|
|
154 |
diff -r1.58 HTMLPlug.pm |
|
|
155 |
524c524 |
|
|
156 |
< $tmptext =~ s/\s\S*$/…/; |
|
|
157 |
--- |
|
|
158 |
> $tmptext =~ s/\s\S*$/…/; # horizontal ellipsis ... |
|
|
159 |
705,707c705,707 |
|
|
160 |
< $$textref =~ s/&(lt|gt|amp|quot|nbsp);/&z$1;/go; |
|
|
161 |
< $$textref =~ s/&(~[^;]+);/&ghtml::getcharequiv($1,1)/gseo; |
|
|
162 |
< $$textref =~ s/&z(lt|gt|amp|quot|nbsp);/&$1;/go; |
|
|
163 |
--- |
|
|
164 |
> # $$textref =~ s/&(lt|gt|amp|quot|nbsp);/&z$1;/go; |
|
|
165 |
> $$textref =~ s/&(~[^;]+);/&ghtml::getcharequiv($1,0)/gseo; |
|
|
166 |
> # $$textref =~ s/&z(lt|gt|amp|quot|nbsp);/&$1;/go; |
|
|
167 |
</pre> |
|
|
168 |
|
|
|
169 |
So this diff shows that I added a comment to line 524, and commented out lines 705 and 707 (and changed line 706). You may or may not recognise this gibberish as [Perl] code... |
|
|
170 |
|
|
|
171 |
Other useful [CVS] commands: |
|
|
172 |
|
|
|
173 |
<pre> |
|
|
174 |
__$ cvs status__ |
|
|
175 |
src/gsdl/perllib/plugins$ cvs status HTMLPlug.pm |
|
|
176 |
=================================================================== |
|
|
177 |
File: HTMLPlug.pm Status: Locally Modified |
|
|
178 |
|
|
|
179 |
Working revision: 1.58 |
|
|
180 |
Repository revision: 1.58 /usr/local/global-cvs/gsdl-src/gsdl/perllib/plugins/HTMLPlug.pm,v |
|
|
181 |
Sticky Tag: (none) |
|
|
182 |
Sticky Date: (none) |
|
|
183 |
Sticky Options: (none) |
|
|
184 |
</pre> |
|
|
185 |
|
|
|
186 |
<pre> |
|
|
187 |
__$ cvs annotate__ |
|
|
188 |
src/gsdl/perllib/plugins$ cvs annotate HTMLPlug.pm |
|
|
189 |
''~[ trimmed for brevity ]'' |
|
|
190 |
1.7 (sjboddie 06-Dec-99): # if no title use first 100 characters |
|
|
191 |
1.7 (sjboddie 06-Dec-99): my $tmptext = $$textref; |
|
|
192 |
1.43 (jrm21 21-May-01): $tmptext =~ s/<\/(~[^>]+)><\1>//g; # (eg) </b><b> - no space |
|
|
193 |
1.30 (say1 14-Oct-00): $tmptext =~ s/<~[^>]*>/ /g; |
|
|
194 |
1.56 (jrm21 11-Jul-02): $tmptext =~ s/(?: |\xc2\xa0)/ /g; # utf-8 for nbsp... |
|
|
195 |
1.43 (jrm21 21-May-01): $tmptext =~ s/^\s+//s; |
|
|
196 |
1.16 (gwp 22-Jun-00): $tmptext =~ s/\s+$//; |
|
|
197 |
1.14 (gwp 24-May-00): $tmptext =~ s/\s+/ /gs; |
|
|
198 |
1.56 (jrm21 11-Jul-02): $tmptext =~ s/^$self->{'title_sub'}// if ($self->{'title_sub'}); |
|
|
199 |
1.56 (jrm21 11-Jul-02): $tmptext =~ s/^\s+//s; # in case title_sub introduced any... |
|
|
200 |
1.30 (say1 14-Oct-00): $tmptext = substr ($tmptext, 0, 100); |
|
|
201 |
1.14 (gwp 24-May-00): $tmptext =~ s/\s\S*$/.../; |
|
|
202 |
1.15 (sjboddie 20-Jun-00): $doc_obj->add_utf8_metadata ($section, $field, $tmptext); |
|
|
203 |
1.33 (paynter 02-Nov-00): print $outhandle " extracted \"$field\" metadata \"$tmptext\"\n" |
|
|
204 |
1.36 (sjboddie 18-Jan-01): if ($self->{'verbosity'} > 2); |
|
|
205 |
1.16 (gwp 22-Jun-00): next; |
|
|
206 |
''~[ trimmed for brevity ]'' |
|
|
207 |
</pre> |
|
|
208 |
|
|
|
209 |
This shows each line (as checked in) of the file, showing when that line was last edited, who by, when, and which version. So if you make a stuff-up, everyone else knows who to blame. |
4 |
AristotlePagaltzis |
210 |
|
|
|
211 |
---- |
7 |
LawrenceDoliveiro |
212 |
CategoryVersionControl CategoryHowto |