1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
2 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
3 |
|
4 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
5 |
<head> |
6 |
<meta name="generator" content="HTML Tidy, see www.w3.org" /> |
7 |
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> |
8 |
<base href="http:/mitgcm.org" /> |
9 |
|
10 |
<!-- Hinting for menu generation --> |
11 |
<meta name="add_name_0" content="Source Code" /> |
12 |
<meta name="add_name_1" content="Using CVS" /> |
13 |
<meta name="add_name_2" content="" /> |
14 |
<meta name="add_title" content="Using CVS" /> |
15 |
<!-- Hinting for menu generation --> |
16 |
|
17 |
<style type="text/css"> |
18 |
span.c2 {font-size: 110%} |
19 |
div.c1 {text-align: center} |
20 |
</style> |
21 |
</head> |
22 |
|
23 |
<body> |
24 |
|
25 |
<center> |
26 |
<h3>Obtaining the MITgcm Source using CVS</h3> |
27 |
</center> |
28 |
|
29 |
<h4>Using CVS "pserver" for Anonymous Access</h4> |
30 |
|
31 |
<p>The most convenient way to get local copies of the MITgcm source code is |
32 |
to use the CVS "pserver" mechanism. This method only allows you to "check |
33 |
out" (or obtain a local copy) of the source. It does not provide a |
34 |
mechanism for "committing" or "checking in" changes (please see below). |
35 |
Using CVS pserver from the command line requires just a three commands. |
36 |
Using a Bourne, "bash", or "sh-compatible" shell they are:</p> |
37 |
|
38 |
<pre> |
39 |
$ export CVSROOT=':pserver:cvsanon@mitgcm.org:/u/gcmpack' |
40 |
$ cvs login |
41 |
( enter the CVS password: "cvsanon" ) |
42 |
$ cvs co MITgcm MITgcm_contrib |
43 |
</pre> |
44 |
|
45 |
<p>Using a "C", "csh", or "tcsh" shell the commands are:</p> |
46 |
|
47 |
<pre> |
48 |
$ setenv CVSROOT ':pserver:cvsanon@mitgcm.org:/u/gcmpack' |
49 |
$ cvs login |
50 |
( enter the CVS password: "cvsanon" ) |
51 |
$ cvs co MITgcm MITgcm_contrib |
52 |
</pre> |
53 |
|
54 |
<p>Note that you will only need to perform the "cvs login" once. And for |
55 |
convenience, you may want to add the CVSROOT variable to your shell's |
56 |
environment (that is, define it within your "~/.bashrc" or "~/.chsrc" |
57 |
files).</p> |
58 |
|
59 |
|
60 |
<h4>Getting Parts of the Source "Tree"</h4> |
61 |
|
62 |
<p>The above commands demonstrate how to check out all of the MITgcm code |
63 |
and the "contributed" (that is, unsupported by often useful) information |
64 |
within the "MITgcm_contrib" directory. In many cases, this is overkill |
65 |
and can result in long download times. To reduce the volume of |
66 |
information downloaded and thereby speedup the download times, one can |
67 |
select one of the following pre-defined "aliases" that will provide a |
68 |
sub-set of the entire MITgcm source "tree":</p> |
69 |
|
70 |
<table align="center" border="0" cellpadding="10" width="90%" summary="CVS |
71 |
aliases"> |
72 |
<tr bgcolor="#00cccc"> |
73 |
<td width="25%">Alias Name</td> |
74 |
<td>Information (directories) Contained</td> |
75 |
</tr> |
76 |
<tr bgcolor="#bbffdd"> |
77 |
<td width="25%">MITgcm_code</td> |
78 |
<td>Only the source code -- none of the verification examples.</td> |
79 |
</tr> |
80 |
<tr bgcolor="#bbddff"> |
81 |
<td width="25%">MITgcm_verif_basic</td> |
82 |
<td>Source code plus a small set of the verification examples |
83 |
("global_ocean.90x40x15", "aim.5l_cs", "hs94.128x64x5", |
84 |
"front_relax", and "plume_on_slope").</td> |
85 |
</tr> |
86 |
<tr bgcolor="#bbffdd"> |
87 |
<td width="25%">MITgcm_verif_atmos</td> |
88 |
<td>Source code plus all of the atmospheric examples.</td> |
89 |
</tr> |
90 |
<tr bgcolor="#bbddff"> |
91 |
<td width="25%">MITgcm_verif_ocean</td> |
92 |
<td>Source code plus all of the oceanic examples.</td> |
93 |
</tr> |
94 |
<tr bgcolor="#bbffdd"> |
95 |
<td width="25%">MITgcm_verif_all</td> |
96 |
<td>Source code plus all of the verification examples.</td> |
97 |
</tr> |
98 |
<!-- |
99 |
<tr bgcolor="#bbddff"> |
100 |
<td width="25%"></td> |
101 |
<td></td> |
102 |
</tr> |
103 |
<tr bgcolor="#bbffdd"> |
104 |
<td width="25%"></td> |
105 |
<td></td> |
106 |
</tr> |
107 |
--> |
108 |
</table> |
109 |
|
110 |
<p>It is important to note that the CVS aliases above cannot be used in |
111 |
conjunction with the CVS <i>-d DIRNAME</i> option. However, the MITgcm |
112 |
directories they create can be changed to a different name following the |
113 |
check-out:</p> |
114 |
<pre> |
115 |
$ cvs co MITgcm_verif_basic |
116 |
$ mv MITgcm MITgcm_verif_basic |
117 |
</pre> |
118 |
|
119 |
<h4>Getting Specific Releases or "Checkpoints"</h4> |
120 |
|
121 |
<p>As shown within the <a |
122 |
href="http://dev.mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm/doc/tag-index"> CVS |
123 |
Code Browser</a>, the MITgcm code is continuously undergoing updates. At |
124 |
points during the development (typically, after work has been done and the |
125 |
source code has passed the <a href="testing/latest.html">verification |
126 |
tests</a>), a release or checkpoint "tag" is created. These tags are a |
127 |
convenient mechanism for referring to different times or points within the |
128 |
development. One can check out these versions using the "-r TAG_NAME" CVS |
129 |
option such as: </p> |
130 |
|
131 |
<pre> |
132 |
$ cvs co -r release1_p5 MITgcm |
133 |
$ cvs co -r checkpoint52a_post MITgcm |
134 |
</pre> |
135 |
|
136 |
<p>By default (that is, when no tag is specified), CVS will retrieve the |
137 |
latest version of all files.</p> |
138 |
|
139 |
|
140 |
<h4>Show changes that YOU have made</h4> |
141 |
|
142 |
<p>If you are running into difficulties it is very useful to see the changes |
143 |
that you yourself have made since obtaining the code. From within |
144 |
your working directory:</p> |
145 |
|
146 |
<pre> |
147 |
cvs diff |
148 |
</pre> |
149 |
|
150 |
|
151 |
<p>will show the differences between your version and the version that you |
152 |
checked out. It acts recursively on all directories below your current |
153 |
directory. You can limit the operation to just one file or directory by |
154 |
specifying those as arguments:</p> |
155 |
|
156 |
<pre> |
157 |
cvs diff <i>file</i> |
158 |
</pre> |
159 |
|
160 |
|
161 |
<h4>Show changes to the repository that you don't have</h4> |
162 |
|
163 |
<p>The source code evolves continuously and you should try to stay up to |
164 |
date. To see what needs to be updated:</p> |
165 |
|
166 |
<pre> |
167 |
cvs -n update |
168 |
</pre> |
169 |
|
170 |
<p>behaves just as "cvs update" but doesn't actually change anything. This |
171 |
is a useful way of summarizing the state of your code. The meaning of the |
172 |
output is summarized in the next topic.</p> |
173 |
|
174 |
<h4>Getting updates from the repository</h4> |
175 |
|
176 |
<p>You can download and merge updates from the repository to bring you |
177 |
working code up to date:</p> |
178 |
|
179 |
<pre> |
180 |
cvs update -d -P |
181 |
</pre> |
182 |
|
183 |
<p>will work recursively on all files in the current directory and below. |
184 |
To update just a specific file or directory:</p> |
185 |
|
186 |
<pre> |
187 |
cvs update <i>file</i> |
188 |
</pre> |
189 |
|
190 |
<p>You can also update to a specific version, just as you could check out |
191 |
a specific version.</p> |
192 |
|
193 |
<pre> |
194 |
cvs update -d -P -r release1_p5 |
195 |
</pre> |
196 |
|
197 |
<p>If you checked out a specific version and want to update to the very |
198 |
latest use the -A option will remove associated with a specific version as |
199 |
follows:</p> |
200 |
|
201 |
<pre> |
202 |
cvs update -d -P -A |
203 |
</pre> |
204 |
|
205 |
<p>"cvs update" produces output to the terminal with the following |
206 |
meanings:</p> |
207 |
|
208 |
<table align="center" border="0" cellpadding="10" width="90%" summary="CVS |
209 |
update codes"> |
210 |
<tr bgcolor="#00cccc"> |
211 |
<td width="20%">Return Code</td> |
212 |
<td>Description</td> |
213 |
</tr> |
214 |
<tr bgcolor="#bbffdd"> |
215 |
<td width="20%">U <i>file</i></td> |
216 |
<td>indicates that <i>file</i> was brought up to date with the |
217 |
repository or that it exists in the repository but not in your work |
218 |
space</td> |
219 |
</tr> |
220 |
<tr bgcolor="#bbddff"> |
221 |
<td width="20%">P <i>file</td> |
222 |
<td>does exactly as above but uses the "patch" method</td> |
223 |
</tr> |
224 |
<tr bgcolor="#bbffdd"> |
225 |
<td width="20%">M <i>file</i></td> |
226 |
<td>means the <i>file</i> was modified in your work space. Any |
227 |
additional changes from the repository were merged in |
228 |
successfully</td> |
229 |
</tr> |
230 |
</tr> |
231 |
<tr bgcolor="#bbddff"> |
232 |
<td width="20%">C <i>file</i></td> |
233 |
<td>means a merge is necessary because both the your copy and the |
234 |
repository have changed <b>but</b> there is a conflict between the |
235 |
changes</td> |
236 |
</tr> |
237 |
<tr bgcolor="#bbffdd"> |
238 |
<td width="20%">? <i>file</i></td> |
239 |
<td>means the file exists in your work space but not on the |
240 |
repository</td> |
241 |
</tr> |
242 |
</table> |
243 |
|
244 |
<p>When conflicts arise, the sections of code are both kept and surrounded |
245 |
by <<<<<, ===== and >>>>> indicators. You need to examine |
246 |
these lines of the files and resolve the conflict.</p> |
247 |
|
248 |
<h4>Wow! CVS is so good, where can I learn more?</h4> |
249 |
|
250 |
<p>The <a href="http://www.loria.fr/~molli/cvs/doc/cvs_toc.html">basic |
251 |
manual</a> is a good reference. There is also an <a |
252 |
href="http://web.mit.edu/afs/athena.mit.edu/project/gnu/doc/html/cvs_toc.html">online |
253 |
tutorial</a> as well as an <a |
254 |
href="http://www.loria.fr/~molli/cvs/cvstrain/cvstrain.html">training |
255 |
manual</a>. For those who prefer the good old fashioned book there's <a |
256 |
href="http://cvsbook.red-bean.com/">"Open Source Development With |
257 |
CVS"</a>.</p> |
258 |
|
259 |
</body> |
260 |
</html> |
261 |
|