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 |
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 |
52 |
</pre> |
53 |
|
54 |
<p>A large amount of additional (optional!) content can be obtained from the |
55 |
MITgcm_contrib directory that can be checked out using: |
56 |
|
57 |
<pre> |
58 |
$ cvs co MITgcm_contrib |
59 |
</pre> |
60 |
|
61 |
In general, we do not recommend checking out all of MITgcm_contrib since |
62 |
it takes a long time to download (particularly from remote locations) and |
63 |
much of it is specific to certain setups (eg. high-res setups, |
64 |
in-development material that is not yet part of the "main" code, |
65 |
etc.).</p> |
66 |
|
67 |
<p>Note that you will only need to perform the "cvs login" once. And for |
68 |
convenience, you may want to add the CVSROOT variable to your shell's |
69 |
environment (that is, define it within your "~/.bashrc" or "~/.chsrc" |
70 |
files).</p> |
71 |
|
72 |
|
73 |
<h4>Getting Parts of the Source "Tree"</h4> |
74 |
|
75 |
<p>The above commands demonstrate how to check out all of the MITgcm code |
76 |
and the "contributed" (that is, unsupported by occasionally useful) |
77 |
information within the "MITgcm_contrib" directory. In many cases, this is |
78 |
overkill and can result in long download times. To reduce the volume of |
79 |
information downloaded and thereby speedup the download times, one can |
80 |
select one of the following pre-defined "aliases" that will provide a |
81 |
sub-set of the entire MITgcm source "tree":</p> |
82 |
|
83 |
<table align="center" border="0" cellpadding="10" width="90%" summary="CVS |
84 |
aliases"> |
85 |
<tr bgcolor="#00cccc"> |
86 |
<td width="25%">Alias Name</td> |
87 |
<td>Information (directories) Contained</td> |
88 |
</tr> |
89 |
<tr bgcolor="#bbffdd"> |
90 |
<td width="25%">MITgcm_code</td> |
91 |
<td>Only the source code -- none of the verification examples.</td> |
92 |
</tr> |
93 |
<tr bgcolor="#bbddff"> |
94 |
<td width="25%">MITgcm_verif_basic</td> |
95 |
<td>Source code plus a small set of the verification examples |
96 |
("global_ocean.90x40x15", "aim.5l_cs", "hs94.128x64x5", |
97 |
"front_relax", and "plume_on_slope").</td> |
98 |
</tr> |
99 |
<tr bgcolor="#bbffdd"> |
100 |
<td width="25%">MITgcm_verif_atmos</td> |
101 |
<td>Source code plus all of the atmospheric examples.</td> |
102 |
</tr> |
103 |
<tr bgcolor="#bbddff"> |
104 |
<td width="25%">MITgcm_verif_ocean</td> |
105 |
<td>Source code plus all of the oceanic examples.</td> |
106 |
</tr> |
107 |
<tr bgcolor="#bbffdd"> |
108 |
<td width="25%">MITgcm_verif_all</td> |
109 |
<td>Source code plus all of the verification examples.</td> |
110 |
</tr> |
111 |
<!-- |
112 |
<tr bgcolor="#bbddff"> |
113 |
<td width="25%"></td> |
114 |
<td></td> |
115 |
</tr> |
116 |
<tr bgcolor="#bbffdd"> |
117 |
<td width="25%"></td> |
118 |
<td></td> |
119 |
</tr> |
120 |
--> |
121 |
</table> |
122 |
|
123 |
<p>It is important to note that the CVS aliases above cannot be used in |
124 |
conjunction with the CVS <i>-d DIRNAME</i> option. However, the MITgcm |
125 |
directories they create can be changed to a different name following the |
126 |
check-out:</p> |
127 |
<pre> |
128 |
$ cvs co MITgcm_verif_basic |
129 |
$ mv MITgcm MITgcm_verif_basic |
130 |
</pre> |
131 |
|
132 |
<h4>Getting Specific Releases or "Checkpoints"</h4> |
133 |
|
134 |
<p>As shown within the <a |
135 |
href="http://mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm/doc/tag-index"> CVS |
136 |
Code Browser</a>, the MITgcm code is continuously undergoing updates. At |
137 |
points during the development (typically, after work has been done and the |
138 |
source code has passed the <a href="testing/latest.html">verification |
139 |
tests</a>), a release or checkpoint "tag" is created. These tags are a |
140 |
convenient mechanism for referring to different times or points within the |
141 |
development. One can check out these versions using the "-r TAG_NAME" CVS |
142 |
option such as: </p> |
143 |
|
144 |
<pre> |
145 |
$ cvs co -r release1_p5 MITgcm |
146 |
$ cvs co -r checkpoint52a_post MITgcm |
147 |
</pre> |
148 |
|
149 |
<p>By default (that is, when no tag is specified), CVS will retrieve the |
150 |
latest version of all files.</p> |
151 |
|
152 |
|
153 |
<h4>Show changes that YOU have made</h4> |
154 |
|
155 |
<p>If you are running into difficulties it is very useful to see the changes |
156 |
that you yourself have made since obtaining the code. From within |
157 |
your working directory:</p> |
158 |
|
159 |
<pre> |
160 |
cvs diff |
161 |
</pre> |
162 |
|
163 |
|
164 |
<p>will show the differences between your version and the version that you |
165 |
checked out. It acts recursively on all directories below your current |
166 |
directory. You can limit the operation to just one file or directory by |
167 |
specifying those as arguments:</p> |
168 |
|
169 |
<pre> |
170 |
cvs diff <i>file</i> |
171 |
</pre> |
172 |
|
173 |
|
174 |
<h4>Show changes to the repository that you don't have</h4> |
175 |
|
176 |
<p>The source code evolves continuously and you should try to stay up to |
177 |
date. To see what needs to be updated:</p> |
178 |
|
179 |
<pre> |
180 |
cvs -n update |
181 |
</pre> |
182 |
|
183 |
<p>behaves just as "cvs update" but doesn't actually change anything. This |
184 |
is a useful way of summarizing the state of your code. The meaning of the |
185 |
output is summarized in the next topic.</p> |
186 |
|
187 |
<h4>Getting updates from the repository</h4> |
188 |
|
189 |
<p>You can download and merge updates from the repository to bring you |
190 |
working code up to date:</p> |
191 |
|
192 |
<pre> |
193 |
cvs update -d -P |
194 |
</pre> |
195 |
|
196 |
<p>will work recursively on all files in the current directory and below. |
197 |
To update just a specific file or directory:</p> |
198 |
|
199 |
<pre> |
200 |
cvs update <i>file</i> |
201 |
</pre> |
202 |
|
203 |
<p>You can also update to a specific version, just as you could check out |
204 |
a specific version.</p> |
205 |
|
206 |
<pre> |
207 |
cvs update -d -P -r release1_p5 |
208 |
</pre> |
209 |
|
210 |
<p>If you checked out a specific version and want to update to the very |
211 |
latest use the -A option will remove associated with a specific version as |
212 |
follows:</p> |
213 |
|
214 |
<pre> |
215 |
cvs update -d -P -A |
216 |
</pre> |
217 |
|
218 |
<p>"cvs update" produces output to the terminal with the following |
219 |
meanings:</p> |
220 |
|
221 |
<table align="center" border="0" cellpadding="10" width="90%" summary="CVS |
222 |
update codes"> |
223 |
<tr bgcolor="#00cccc"> |
224 |
<td width="20%">Return Code</td> |
225 |
<td>Description</td> |
226 |
</tr> |
227 |
<tr bgcolor="#bbffdd"> |
228 |
<td width="20%">U <i>file</i></td> |
229 |
<td>indicates that <i>file</i> was brought up to date with the |
230 |
repository or that it exists in the repository but not in your work |
231 |
space</td> |
232 |
</tr> |
233 |
<tr bgcolor="#bbddff"> |
234 |
<td width="20%">P <i>file</td> |
235 |
<td>does exactly as above but uses the "patch" method</td> |
236 |
</tr> |
237 |
<tr bgcolor="#bbffdd"> |
238 |
<td width="20%">M <i>file</i></td> |
239 |
<td>means the <i>file</i> was modified in your work space. Any |
240 |
additional changes from the repository were merged in |
241 |
successfully</td> |
242 |
</tr> |
243 |
</tr> |
244 |
<tr bgcolor="#bbddff"> |
245 |
<td width="20%">C <i>file</i></td> |
246 |
<td>means a merge is necessary because both the your copy and the |
247 |
repository have changed <b>but</b> there is a conflict between the |
248 |
changes</td> |
249 |
</tr> |
250 |
<tr bgcolor="#bbffdd"> |
251 |
<td width="20%">? <i>file</i></td> |
252 |
<td>means the file exists in your work space but not on the |
253 |
repository</td> |
254 |
</tr> |
255 |
</table> |
256 |
|
257 |
<p>When conflicts arise, the sections of code are both kept and surrounded |
258 |
by <<<<<, ===== and >>>>> indicators. You need to examine |
259 |
these lines of the files and resolve the conflict.</p> |
260 |
|
261 |
<h4>Wow! CVS is so good, where can I learn more?</h4> |
262 |
|
263 |
<p>The <a href="http://www.loria.fr/~molli/cvs/doc/cvs_toc.html">basic |
264 |
manual</a> is a good reference. There is also an <a |
265 |
href="http://web.mit.edu/afs/athena.mit.edu/project/gnu/doc/html/cvs_toc.html">online |
266 |
tutorial</a> as well as an <a |
267 |
href="http://www.loria.fr/~molli/cvs/cvstrain/cvstrain.html">training |
268 |
manual</a>. For those who prefer the good old fashioned book there's <a |
269 |
href="http://cvsbook.red-bean.com/">"Open Source Development With |
270 |
CVS"</a>.</p> |
271 |
|
272 |
</body> |
273 |
</html> |
274 |
|