1 | <html> |
---|
2 | <head> |
---|
3 | <title>CVS to SVN Crossover Guide</title> |
---|
4 | <style> |
---|
5 | body { |
---|
6 | font-family: sans-serif; |
---|
7 | } |
---|
8 | h1 { |
---|
9 | text-align: center; |
---|
10 | } |
---|
11 | h2 { |
---|
12 | background: #b0c0f0; |
---|
13 | margin: 0; |
---|
14 | } |
---|
15 | .h2 { |
---|
16 | border-left: 4px #b0c0f0 solid; |
---|
17 | margin-bottom: 2em; |
---|
18 | } |
---|
19 | hr { |
---|
20 | height: 1px; |
---|
21 | width: 80%; |
---|
22 | } |
---|
23 | p, h3, dl { |
---|
24 | padding-left: 1em; |
---|
25 | } |
---|
26 | dd { |
---|
27 | margin-left: 2em; |
---|
28 | } |
---|
29 | .sidebyside { |
---|
30 | padding: 0 2em; |
---|
31 | width: 100%; |
---|
32 | font-size: 80%; |
---|
33 | } |
---|
34 | .sidebyside th, .sidebyside td { |
---|
35 | width: 50%; |
---|
36 | border-width: 0 1px 2px 0; |
---|
37 | border-style: solid; |
---|
38 | border-color: black; |
---|
39 | background: #b0c0f0; |
---|
40 | vertical-align: top; |
---|
41 | } |
---|
42 | .sidebyside th { |
---|
43 | text-align: center; |
---|
44 | background: #90a0d0; |
---|
45 | } |
---|
46 | .bookref { |
---|
47 | font-size: 80%; |
---|
48 | } |
---|
49 | </style> |
---|
50 | </head> |
---|
51 | |
---|
52 | <body> |
---|
53 | |
---|
54 | <h1>CVS to SVN Crossover Guide</h1> |
---|
55 | |
---|
56 | <!-- ==================================================================== --> |
---|
57 | <div class="h2"> |
---|
58 | <h2>Purpose</h2> |
---|
59 | |
---|
60 | <p>This document provides an alternate method of learning Subversion. |
---|
61 | Many users dislike learning new technology via a theoretical "top |
---|
62 | down" approach, as provided by the <a |
---|
63 | href="http://svnbook.red-bean.com">Subversion Book</a>. Instead, |
---|
64 | this document presents Subversion from the "bottom up": it shows a |
---|
65 | CVS command or task, and then shows the equivalent task in |
---|
66 | Subversion (along with relevant book links.) It's essentially a |
---|
67 | re-indexing of topics covered by the book, keyed on CVS tasks.</p> |
---|
68 | |
---|
69 | </div> |
---|
70 | |
---|
71 | <!-- ==================================================================== --> |
---|
72 | <div class="h2"> |
---|
73 | <h2>Table of Contents</h2> |
---|
74 | |
---|
75 | <h3>Setup</h3> |
---|
76 | <ul> |
---|
77 | <li><a href="#repos_creation">Repository creation</a></li> |
---|
78 | <li><a href="#import">Importing data</a></li> |
---|
79 | <li><a href="#installing">Installing a server</a></li> |
---|
80 | <li><a href="#authenticating">Authenticating to a server</a></li> |
---|
81 | <li><a href="#browsing">Browsing a repository</a></li> |
---|
82 | <li><a href="#checkingout">Checking out a working copy</a></li> |
---|
83 | </ul> |
---|
84 | |
---|
85 | <h3>Basic Work Cycle</h3> |
---|
86 | <ul> |
---|
87 | <li><a href="#changeditems">Seeing locally changed items</a></li> |
---|
88 | <li><a href="#outofdate">Seeing out-of-date items</a></li> |
---|
89 | <li><a href="#scheduling">Scheduling additions or deletions</a></li> |
---|
90 | <li><a href="#copying">Copying and moving</a></li> |
---|
91 | <li>Undoing local changes</li> |
---|
92 | <li>Updating and committing</li> |
---|
93 | <li>Resolving conflicts</li> |
---|
94 | <li>Adding a binary file</li> |
---|
95 | <li>Using native line-endings</li> |
---|
96 | </ul> |
---|
97 | |
---|
98 | <h3>Examining history</h3> |
---|
99 | <ul> |
---|
100 | <li>Seeing history of an item</li> |
---|
101 | <li>Comparing two versions of an item</li> |
---|
102 | </ul> |
---|
103 | |
---|
104 | <h3>Branching/Tagging/Merging</h3> |
---|
105 | <ul> |
---|
106 | <li>Creating a branch</li> |
---|
107 | <li>Moving a working copy to a branch</li> |
---|
108 | <li>Finding the beginning of a branch</li> |
---|
109 | <li>Porting a single change</li> |
---|
110 | <li>Merging a whole branch</li> |
---|
111 | <li>Reverting a committed change</li> |
---|
112 | <li>Resurrecting deleted items</li> |
---|
113 | <li>Creating a tag</li> |
---|
114 | <li>Tweaking a tag</li> |
---|
115 | <li>Seeing all tags</li> |
---|
116 | <li>Comparing two tags</li> |
---|
117 | <li>Seeing logs between two tags</li> |
---|
118 | </ul> |
---|
119 | |
---|
120 | <h3>Other tasks</h3> |
---|
121 | <ul> |
---|
122 | <li>Using modules</li> |
---|
123 | <li>Line endings and keywords</li> |
---|
124 | </ul> |
---|
125 | |
---|
126 | </div> |
---|
127 | |
---|
128 | <!-- ==================================================================== --> |
---|
129 | <div class="h2"> |
---|
130 | <h2 id="repos_creation">Repository creation</h2> |
---|
131 | |
---|
132 | <p>Create a new repository for holding versioned data.</p> |
---|
133 | |
---|
134 | <table class="sidebyside"> |
---|
135 | <tr> |
---|
136 | <th>CVS</th> |
---|
137 | <th>Subversion</th> |
---|
138 | </tr> |
---|
139 | <tr> |
---|
140 | <td> |
---|
141 | <dl> |
---|
142 | <dt>Commands:</dt> |
---|
143 | <dd><tt>$ cvs -d /usr/local/repos init</tt></dd> |
---|
144 | |
---|
145 | <dt>Explanation:</dt> |
---|
146 | <dd>Creates a new directory <tt>repos</tt> ready to hold RCS |
---|
147 | files and config scripts.</dd> |
---|
148 | </dl> |
---|
149 | </td> |
---|
150 | <td> |
---|
151 | <dl> |
---|
152 | <dt>Commands:</dt> |
---|
153 | <dd><tt>$ svnadmin create /usr/local/repos</tt></dd> |
---|
154 | |
---|
155 | <dt>Explanation:</dt> |
---|
156 | <dd>Creates a new directory <tt>repos</tt> containing BerkeleyDB |
---|
157 | files and config scripts.</dd> |
---|
158 | </dl> |
---|
159 | </td> |
---|
160 | </tr> |
---|
161 | </table> |
---|
162 | |
---|
163 | <dl class="bookref"> |
---|
164 | <dt>Book References:</dt> |
---|
165 | <dd><a href="http://svnbook.red-bean.com/svnbook/ch05s02.html">Repository Creation and Configuration</a></dd> |
---|
166 | </dl> |
---|
167 | |
---|
168 | </div> |
---|
169 | |
---|
170 | <!-- ==================================================================== --> |
---|
171 | <div class="h2"> |
---|
172 | <h2 id="import">Importing data</h2> |
---|
173 | |
---|
174 | <p>Populate a new repository with initial data. Assuming that you |
---|
175 | have a tree of code in the local directory <tt>myproj/</tt>, and |
---|
176 | you want to move this tree into the repository.</p> |
---|
177 | |
---|
178 | <table class="sidebyside"> |
---|
179 | <tr> |
---|
180 | <th>CVS</th> |
---|
181 | <th>Subversion</th> |
---|
182 | </tr> |
---|
183 | <tr> |
---|
184 | <td> |
---|
185 | <dl> |
---|
186 | <dt>Commands:</dt> |
---|
187 | <dd><tt>$ cd myproj</tt></dd> |
---|
188 | <dd><tt>$ cvs -d /usr/local/repos import myproj/ none start</tt></dd> |
---|
189 | |
---|
190 | <dt>Explanation:</dt> |
---|
191 | |
---|
192 | <dd>This copies the contents of the current working directory to |
---|
193 | a new directory (<tt>myproj</tt>) in the CVS repository. The |
---|
194 | CVS repository now contains a directory <tt>/myproj/</tt> at the |
---|
195 | top level.</dd> |
---|
196 | |
---|
197 | </dl> |
---|
198 | </td> |
---|
199 | <td> |
---|
200 | <dl> |
---|
201 | <dt>Commands:</dt> |
---|
202 | <dd><tt>$ svn mkdir file:///usr/local/repos/tags</tt></dd> |
---|
203 | <dd><tt>$ svn mkdir file:///usr/local/repos/branches</tt></dd> |
---|
204 | <dd><tt>$ svn import myproj/ file:///usr/local/repos/trunk</tt></dd> |
---|
205 | |
---|
206 | <dt>Explanation:</dt> |
---|
207 | |
---|
208 | <dd>Though not strictly required, we deliberately create |
---|
209 | <tt>/tags</tt> and <tt>/branches</tt> top-level directories in |
---|
210 | the repository, to hold tags and branches later on. Then we |
---|
211 | import the contents of the local <tt>myproj/</tt> directory into |
---|
212 | a newly created <tt>/trunk</tt> directory in the |
---|
213 | repository.</tt> |
---|
214 | </dl> |
---|
215 | </td> |
---|
216 | </tr> |
---|
217 | <tr> |
---|
218 | </table> |
---|
219 | |
---|
220 | <dl class="bookref"> |
---|
221 | <dt>Book References:</dt> |
---|
222 | <dd><a href="http://svnbook.red-bean.com/svnbook/ch05s04.html#svn-ch-5-sect-6.1">Choosing a repository layout</a></dd> |
---|
223 | <dd><a href="http://svnbook.red-bean.com/svnbook/re12.html">svn import</a></dd> |
---|
224 | </dl> |
---|
225 | </div> |
---|
226 | |
---|
227 | <!-- ==================================================================== --> |
---|
228 | <div class="h2"> |
---|
229 | <h2 id="installing">Installing a server</h2> |
---|
230 | |
---|
231 | <p>Make the repository available to clients via a network.</p> |
---|
232 | |
---|
233 | <table class="sidebyside"> |
---|
234 | <tr> |
---|
235 | <th>CVS</th> |
---|
236 | <th>Subversion</th> |
---|
237 | </tr> |
---|
238 | <tr> |
---|
239 | <td> |
---|
240 | <dl> |
---|
241 | <dt>Commands:</dt> |
---|
242 | <dd>(too complex to demonstrate here)</dd> |
---|
243 | |
---|
244 | <dt>Explanation:</dt> |
---|
245 | <dd>Export the repository via the cvs <em>pserver</em> program. |
---|
246 | It can be launched by either <strong>inetd</strong> or a |
---|
247 | client's <strong>ssh</strong> remote request.</dd> |
---|
248 | |
---|
249 | </dl> |
---|
250 | </td> |
---|
251 | <td> |
---|
252 | <dl> |
---|
253 | <dt>Commands:</dt> |
---|
254 | <dd>(too complex to demonstrate here)</dd> |
---|
255 | |
---|
256 | <dt>Explanation:</dt> |
---|
257 | <dd>Export the repository with the <em>Apache 2.0.x</em> server, |
---|
258 | or via the <em>svnserve</em> program. The latter can run as a |
---|
259 | standalone daemon, can be launched by <strong>inetd</strong>, or |
---|
260 | invoked by a client's <strong>ssh</strong> remote request.</dd> |
---|
261 | |
---|
262 | </dl> |
---|
263 | </td> |
---|
264 | </tr> |
---|
265 | </table> |
---|
266 | |
---|
267 | <dl class="bookref"> |
---|
268 | <dt>Book References:</dt> |
---|
269 | <dd><a href="http://svnbook.red-bean.com/svnbook/ch06.html">Server configuration</a></dd> |
---|
270 | </dl> |
---|
271 | |
---|
272 | </div> |
---|
273 | |
---|
274 | <!-- ==================================================================== --> |
---|
275 | <div class="h2"> |
---|
276 | <h2 id="authenticating">Authenticating to a server</h2> |
---|
277 | |
---|
278 | <p>Have a network client prove its identity to a version |
---|
279 | control server.</p> |
---|
280 | |
---|
281 | <table class="sidebyside"> |
---|
282 | <tr> |
---|
283 | <th>CVS</th> |
---|
284 | <th>Subversion</th> |
---|
285 | </tr> |
---|
286 | <tr> |
---|
287 | <td> |
---|
288 | <dl> |
---|
289 | <dt>Commands:</dt> |
---|
290 | <dd><tt>$ cvs -d :pserver:user@host:/repos <em>command</em>…</tt></dd> |
---|
291 | |
---|
292 | <dt>Explanation:</dt> |
---|
293 | |
---|
294 | <dd>When contacting a repository, the client pre-emptively |
---|
295 | "pushes" its authentication credentials at the server.</dd> |
---|
296 | |
---|
297 | </dl> |
---|
298 | </td> |
---|
299 | <td> |
---|
300 | <dl> |
---|
301 | <dt>Commands:</dt> |
---|
302 | <dd><tt>$ svn <em>command</em> <em>URL</em>…</tt></dd> |
---|
303 | <dd><tt>Password for 'user': XXXXXXX</tt></dd> |
---|
304 | |
---|
305 | <dt>Explanation:</dt> |
---|
306 | |
---|
307 | <dd>The client's authentication credentials are "pulled" from |
---|
308 | the user interactively, and only when the server deems that a |
---|
309 | challenge needs to be made. (And contrary to popular belief, |
---|
310 | the <tt>--username</tt> and <tt>--password</tt> options are |
---|
311 | merely values to be used <em>if</em> the server issues a |
---|
312 | challenge; they do not "push" the credentials at the |
---|
313 | server.)</tt> </dd> |
---|
314 | |
---|
315 | </dl> |
---|
316 | </td> |
---|
317 | </tr> |
---|
318 | </table> |
---|
319 | |
---|
320 | <dl class="bookref"> |
---|
321 | <dt>Book References:</dt> |
---|
322 | <dd><a href="http://svnbook.red-bean.com/svnbook/ch06s02.html">Network Model</a></dd> |
---|
323 | </dl> |
---|
324 | |
---|
325 | </div> |
---|
326 | |
---|
327 | <!-- ==================================================================== --> |
---|
328 | <div class="h2"> |
---|
329 | <h2 id="browsing">Browsing a repository</h2> |
---|
330 | |
---|
331 | <p>Browse the repository as a filesystem, perusing file |
---|
332 | contents and history as well (older versions of files or |
---|
333 | trees.)</p> |
---|
334 | |
---|
335 | <table class="sidebyside"> |
---|
336 | <tr> |
---|
337 | <th>CVS</th> |
---|
338 | <th>Subversion</th> |
---|
339 | </tr> |
---|
340 | <tr> |
---|
341 | <td> |
---|
342 | <dl> |
---|
343 | <dt>Commands:</dt> |
---|
344 | <dd>(not possible with commandline client)</dd> |
---|
345 | |
---|
346 | <dt>Explanation:</dt> |
---|
347 | |
---|
348 | <dd>Not possible with commandline client. A third-party web |
---|
349 | server tool such as ViewCVS must be used.</dd> |
---|
350 | |
---|
351 | </dl> |
---|
352 | </td> |
---|
353 | <td> |
---|
354 | <dl> |
---|
355 | <dt>Commands:</dt> |
---|
356 | <dd><tt>$ svn list <em>URL</em> [-r <em>rev</em>] [-v]</tt></dd> |
---|
357 | <dd><tt>$ svn cat <em>URL</em> [-r <em>rev</em>]</tt></dd> |
---|
358 | |
---|
359 | <dt>Explanation:</dt> |
---|
360 | |
---|
361 | <dd>The <tt>svn list</tt> and <tt>svn cat</tt> commands allow |
---|
362 | interactive browsing of a repository (and all previous states of |
---|
363 | a repository) from the commandline. (The <tt>--verbose [-v]</tt> |
---|
364 | switch displays full listing information.) If Apache is being |
---|
365 | used as a Subversion server process (i.e. clients access via |
---|
366 | <strong>http://</strong>), then the latest version of the |
---|
367 | repository can be directly browsed by entering <em>URL</em> into |
---|
368 | any web browser. Additionally, a third-party web server tool |
---|
369 | (such as ViewCVS) can be used with Subversion.</dd> |
---|
370 | |
---|
371 | </dl> |
---|
372 | </td> |
---|
373 | </tr> |
---|
374 | </table> |
---|
375 | |
---|
376 | <dl class="bookref"> |
---|
377 | <dt>Book References:</dt> |
---|
378 | <dd><a href="http://svnbook.red-bean.com/svnbook/re14.html">svn list</a></dd> |
---|
379 | </dl> |
---|
380 | |
---|
381 | </div> |
---|
382 | |
---|
383 | <!-- ==================================================================== --> |
---|
384 | <div class="h2"> |
---|
385 | <h2 id="checkingout">Checking out a working copy</h2> |
---|
386 | |
---|
387 | <p>Create a workspace on local disk which mirrors a directory |
---|
388 | in the repository.</p> |
---|
389 | |
---|
390 | <table class="sidebyside"> |
---|
391 | <tr> |
---|
392 | <th>CVS</th> |
---|
393 | <th>Subversion</th> |
---|
394 | </tr> |
---|
395 | <tr> |
---|
396 | <td> |
---|
397 | <dl> |
---|
398 | <dt>Commands:</dt> |
---|
399 | <dd><tt>$ cvs -d /usr/local/repos checkout myproj</tt></dd> |
---|
400 | <dd><tt>U myproj/foo.c</tt></dd> |
---|
401 | <dd><tt>U myproj/bar.c</tt></dd> |
---|
402 | <dd><tt>…</tt></dd> |
---|
403 | |
---|
404 | <dt>Explanation:</dt> |
---|
405 | |
---|
406 | <dd>Creates a local directory <tt>myproj</tt> which is a mirror |
---|
407 | of the repository directory <tt>/myproj</tt>.</dd> |
---|
408 | |
---|
409 | </dl> |
---|
410 | </td> |
---|
411 | <td> |
---|
412 | <dl> |
---|
413 | <dt>Commands:</dt> |
---|
414 | <dd><tt>$ svn checkout file:///usr/local/repos/trunk myproj</tt></dd> |
---|
415 | <dd><tt>A myproj/foo.c</tt></dd> |
---|
416 | <dd><tt>A myproj/bar.c</tt></dd> |
---|
417 | <dd><tt>…</tt></dd> |
---|
418 | |
---|
419 | <dt>Explanation:</dt> |
---|
420 | |
---|
421 | <dd>Assuming that the original project data was imported into |
---|
422 | the repository <tt>/trunk</tt> directory, this creates a local |
---|
423 | directory <tt>myproj</tt> which is a mirror of the repository |
---|
424 | directory <tt>/trunk</tt>. Standard Subversion convention is to |
---|
425 | do "mainline" development in <tt>/trunk</tt>. See branching and |
---|
426 | tagging sections for more details.</dd> |
---|
427 | |
---|
428 | </dl> |
---|
429 | </td> |
---|
430 | </tr> |
---|
431 | </table> |
---|
432 | |
---|
433 | <dl class="bookref"> |
---|
434 | <dt>Book References:</dt> |
---|
435 | <dd><a href="http://svnbook.red-bean.com/svnbook/ch03s04.html">Initial Checkout</a></dd> |
---|
436 | <dd><a href="http://svnbook.red-bean.com/svnbook/re04.html">svn checkout</a></dd> |
---|
437 | </dl> |
---|
438 | |
---|
439 | </div> |
---|
440 | |
---|
441 | <!-- ==================================================================== --> |
---|
442 | <div class="h2"> |
---|
443 | <h2 id="changeditems">Seeing locally changed items</h2> |
---|
444 | |
---|
445 | <p>Discover which items in the working copy have local |
---|
446 | modifications or are scheduled for addition/deletion.</p> |
---|
447 | |
---|
448 | <table class="sidebyside"> |
---|
449 | <tr> |
---|
450 | <th>CVS</th> |
---|
451 | <th>Subversion</th> |
---|
452 | </tr> |
---|
453 | <tr> |
---|
454 | <td> |
---|
455 | <dl> |
---|
456 | <dt>Commands:</dt> |
---|
457 | <dd><tt>$ cvs status</tt></dd> |
---|
458 | <dd><tt>…</tt></dd> |
---|
459 | <dd><tt>File: baz.c Status: Up-to-date</tt></dd> |
---|
460 | <dd><tt>…</tt></dd> |
---|
461 | <dd><tt>$ cvs update</tt></dd> |
---|
462 | <dd><tt>M foo.c</tt></dd> |
---|
463 | <dd><tt>U bar.c</tt></dd> |
---|
464 | <dd><tt>…</tt></dd> |
---|
465 | |
---|
466 | <dt>Explanation:</dt> |
---|
467 | |
---|
468 | <dd>The <tt>cvs status</tt> command shows whether a file is |
---|
469 | locally modified or out of date, including information about |
---|
470 | working revision and branch info. Unfortunately, because the |
---|
471 | output is so verbose and hard to read, many users run <tt>cvs |
---|
472 | update</tt> instead, which shows a more compact listing of |
---|
473 | modified files (and of course, it also causes the server to |
---|
474 | merge changes into your working copy.)</dd> |
---|
475 | |
---|
476 | </dl> |
---|
477 | </td> |
---|
478 | <td> |
---|
479 | <dl> |
---|
480 | <dt>Commands:</dt> |
---|
481 | <dd><tt>$ svn status</tt></dd> |
---|
482 | <dd><tt>M foo.c</tt></dd> |
---|
483 | <dd><tt>…</tt></dd> |
---|
484 | |
---|
485 | <dt>Explanation:</dt> |
---|
486 | |
---|
487 | <dd>Shows modified files only. Very fast, as it does not use |
---|
488 | the network. Does not update your working copy, yet still shows |
---|
489 | a single-line display, much like <tt>svn update</tt>. To see |
---|
490 | working revision and branch information, run <tt>svn info</tt>.</dd> |
---|
491 | |
---|
492 | </dl> |
---|
493 | </td> |
---|
494 | </tr> |
---|
495 | </table> |
---|
496 | |
---|
497 | <dl class="bookref"> |
---|
498 | <dt>Book References:</dt> |
---|
499 | <dd><a href="http://svnbook.red-bean.com/svnbook/ch03s05.html#svn-ch-3-sect-4.3.1">Examine Your Changes</a></dd> |
---|
500 | <dd><a href="http://svnbook.red-bean.com/svnbook/re26.html">svn status</a></dd> |
---|
501 | </dl> |
---|
502 | |
---|
503 | </div> |
---|
504 | |
---|
505 | <!-- ==================================================================== --> |
---|
506 | <div class="h2"> |
---|
507 | <h2 id="outofdate">Seeing out-of-date items</h2> |
---|
508 | |
---|
509 | <p>Discover which items in the working copy are out-of-date |
---|
510 | (i.e. newer versions exist in the repository.)</p> |
---|
511 | |
---|
512 | <table class="sidebyside"> |
---|
513 | <tr> |
---|
514 | <th>CVS</th> |
---|
515 | <th>Subversion</th> |
---|
516 | </tr> |
---|
517 | <tr> |
---|
518 | <td> |
---|
519 | <dl> |
---|
520 | <dt>Commands:</dt> |
---|
521 | <dd><tt>$ cvs status</tt></dd> |
---|
522 | <dd><tt>…</tt></dd> |
---|
523 | <dd><tt>File: baz.c Status: Needs Patch</tt></dd> |
---|
524 | <dd><tt>…</tt></dd> |
---|
525 | <dd><tt>$ cvs -n update</tt></dd> |
---|
526 | <dd><tt>M foo.c</tt></dd> |
---|
527 | <dd><tt>U bar.c</tt></dd> |
---|
528 | <dd><tt>…</tt></dd> |
---|
529 | |
---|
530 | <dt>Explanation:</dt> |
---|
531 | |
---|
532 | <dd>The <tt>cvs status</tt> command shows whether a file is |
---|
533 | locally modified or out of date, including information about |
---|
534 | working revision and branch info. A less verbose option is to |
---|
535 | run <tt>cvs -n update</tt> instead, which shows a compact |
---|
536 | listing of both out-of-date and locally modified files, without |
---|
537 | actually updating the working copy.</dd> |
---|
538 | |
---|
539 | </dl> |
---|
540 | </td> |
---|
541 | <td> |
---|
542 | <dl> |
---|
543 | <dt>Commands:</dt> |
---|
544 | <dd><tt>$ svn status -u</tt></dd> |
---|
545 | <dd><tt>M 46 foo.c</tt></dd> |
---|
546 | <dd><tt>M * 46 bar.c</tt></dd> |
---|
547 | <dd><tt> * 46 baz.c</tt></dd> |
---|
548 | <dd><tt>…</tt></dd> |
---|
549 | |
---|
550 | <dt>Explanation:</dt> |
---|
551 | |
---|
552 | <dd>Shows modified files (<tt>M</tt>) as well as out-of-date |
---|
553 | files (<tt>*</tt>). Contacts repository, but doesn't modify the |
---|
554 | working copy. To see working revision and branch information, |
---|
555 | run <tt>svn info</tt>.</dd> |
---|
556 | |
---|
557 | </dl> |
---|
558 | </td> |
---|
559 | </tr> |
---|
560 | </table> |
---|
561 | |
---|
562 | <dl class="bookref"> |
---|
563 | <dt>Book References:</dt> |
---|
564 | <dd><a href="http://svnbook.red-bean.com/svnbook/ch03s05.html#svn-ch-3-sect-4.3.1">Examine Your Changes</a></dd> |
---|
565 | <dd><a href="http://svnbook.red-bean.com/svnbook/re26.html">svn status</a></dd> |
---|
566 | </dl> |
---|
567 | |
---|
568 | </div> |
---|
569 | |
---|
570 | <!-- ==================================================================== --> |
---|
571 | <div class="h2"> |
---|
572 | <h2 id="scheduling">Scheduling additions or deletions</h2> |
---|
573 | |
---|
574 | <p>Schedule a working-copy file or directory to be added or |
---|
575 | removed from the repository.</p> |
---|
576 | |
---|
577 | <table class="sidebyside"> |
---|
578 | <tr> |
---|
579 | <th>CVS</th> |
---|
580 | <th>Subversion</th> |
---|
581 | </tr> |
---|
582 | <tr> |
---|
583 | <td> |
---|
584 | <dl> |
---|
585 | <dt>Commands:</dt> |
---|
586 | <dd><tt>$ touch foo.c</tt></dd> |
---|
587 | <dd><tt>$ cvs add foo.c</tt></dd> |
---|
588 | <dd><tt>cvs server: scheduling file `blah' for addition</tt></dd> |
---|
589 | <dd><tt>cvs server: use 'cvs commit' to add this file permanently</tt></dd> |
---|
590 | <dd><tt> </tt></dd> |
---|
591 | <dd><tt>$ mkdir new-dir</tt></dd> |
---|
592 | <dd><tt>$ cvs add new-dir</tt></dd> |
---|
593 | <dd><tt>Directory new-dir added to the repository</tt></dd> |
---|
594 | <dd><tt> </tt></dd> |
---|
595 | <dd><tt>$ rm bar.c</tt></dd> |
---|
596 | <dd><tt>$ cvs rm bar.c</tt></dd> |
---|
597 | <dd><tt>cvs remove: scheduling `bar.c' for removal</tt></dd> |
---|
598 | <dd><tt>cvs remove: use 'cvs commit' to remove this file permanently</tt></dd> |
---|
599 | <dd><tt> </tt></dd> |
---|
600 | <dd><tt>$ rm -rf old-dir/*</tt></dd> |
---|
601 | <dd><tt>$ cvs rm old-dir</tt></dd> |
---|
602 | <dd><tt>cvs remove: Removing 3bits</tt></dd> |
---|
603 | <dd><tt>…</tt></dd> |
---|
604 | |
---|
605 | |
---|
606 | <dt>Explanation:</dt> |
---|
607 | |
---|
608 | <dd>Schedules a file or directory for addition or removal |
---|
609 | to/from the repository. The repository will not be changed |
---|
610 | until the user runs <tt>cvs commit</tt>, except for the case of |
---|
611 | adding a directory, which immediately changes the repository. |
---|
612 | Also, directories cannot be truly removed from the repository, |
---|
613 | just emptied out. (<tt>cvs update -P</tt> will prune empty |
---|
614 | directories from your working copy.)</dd> |
---|
615 | |
---|
616 | </dl> |
---|
617 | </td> |
---|
618 | <td> |
---|
619 | <dl> |
---|
620 | <dt>Commands:</dt> |
---|
621 | <dd><tt>$ touch foo.c</tt></dd> |
---|
622 | <dd><tt>$ svn add foo.c</tt></dd> |
---|
623 | <dd><tt>A foo.c</tt></dd> |
---|
624 | <dd><tt> </tt></dd> |
---|
625 | <dd><tt>$ mkdir new-dir</tt></dd> |
---|
626 | <dd><tt>$ svn add new-dir</tt></dd> |
---|
627 | <dd><tt>A new-dir</tt></dd> |
---|
628 | <dd><tt> </tt></dd> |
---|
629 | <dd><tt>$ svn rm bar.c</tt></dd> |
---|
630 | <dd><tt>D bar.c</tt></dd> |
---|
631 | <dd><tt> </tt></dd> |
---|
632 | <dd><tt>$ svn rm old-dir</tt></dd> |
---|
633 | <dd><tt>D old-dir/file1</tt></dd> |
---|
634 | <dd><tt>D old-dir/file2</tt></dd> |
---|
635 | <dd><tt>…</tt></dd> |
---|
636 | |
---|
637 | <dt>Explanation:</dt> |
---|
638 | |
---|
639 | <dd>Schedules a file or directory for addition or removal |
---|
640 | to/from the repository. The repository will not be changed |
---|
641 | until the user runs <tt>svn commit</tt>. The scheduled |
---|
642 | operations are shown as <tt>A</tt> or <tt>D</tt> by <tt>svn |
---|
643 | status</tt>, and <tt>svn revert</tt> can un-do the scheduling. |
---|
644 | Directories really can be deleted (though as with all deleted |
---|
645 | items, continues to exist in history.)</dd> |
---|
646 | |
---|
647 | </dl> |
---|
648 | </td> |
---|
649 | </tr> |
---|
650 | </table> |
---|
651 | |
---|
652 | <dl class="bookref"> |
---|
653 | <dt>Book References:</dt> |
---|
654 | <dd><a href="http://svnbook.red-bean.com/svnbook/ch03s05.html#svn-ch-3-sect-4.2">Make Changes to Your Working Copy</a></dd> |
---|
655 | <dd><a href="http://svnbook.red-bean.com/svnbook/re01.html">svn add</a></dd> |
---|
656 | <dd><a href="http://svnbook.red-bean.com/svnbook/re08.html">svn delete</a></dd> |
---|
657 | </dl> |
---|
658 | |
---|
659 | </div> |
---|
660 | |
---|
661 | <!-- ==================================================================== --> |
---|
662 | <div class="h2"> |
---|
663 | <h2 id="copying">Copying and moving</h2> |
---|
664 | |
---|
665 | <p>Copy or move/rename a file or directory.</p> |
---|
666 | |
---|
667 | <table class="sidebyside"> |
---|
668 | <tr> |
---|
669 | <th>CVS</th> |
---|
670 | <th>Subversion</th> |
---|
671 | </tr> |
---|
672 | <tr> |
---|
673 | <td> |
---|
674 | <dl> |
---|
675 | <dt>Commands:</dt> |
---|
676 | <dd>(not possible.)</dd> |
---|
677 | |
---|
678 | |
---|
679 | <dt>Explanation:</dt> |
---|
680 | |
---|
681 | <dd>Not possible, unless an administrator directly mucks with |
---|
682 | RCS files in the repository. (And in that case, no history |
---|
683 | records the act of copying or renaming.)</dd> |
---|
684 | |
---|
685 | </dl> |
---|
686 | </td> |
---|
687 | <td> |
---|
688 | <dl> |
---|
689 | <dt>Commands:</dt> |
---|
690 | <dd><tt>$ svn copy foo.c foo2.c</tt></dd> |
---|
691 | <dd><tt>A foo2.c</tt></dd> |
---|
692 | <dd><tt> </tt></dd> |
---|
693 | <dd><tt>$ svn copy dir dir2</tt></dd> |
---|
694 | <dd><tt>A dir2</tt></dd> |
---|
695 | <dd><tt> </tt></dd> |
---|
696 | <dd><tt>$ svn move bar.c baz.c</tt></dd> |
---|
697 | <dd><tt>A baz.c</tt></dd> |
---|
698 | <dd><tt>D bar.c</tt></dd> |
---|
699 | <dd><tt> </tt></dd> |
---|
700 | <dd><tt>$ svn move dirA dirB</tt></dd> |
---|
701 | <dd><tt>A dirB</tt></dd> |
---|
702 | <dd><tt>D dirA/file1</tt></dd> |
---|
703 | <dd><tt>D dirA/file2</tt></dd> |
---|
704 | <dd><tt>…</tt></dd> |
---|
705 | |
---|
706 | <dt>Explanation:</dt> |
---|
707 | |
---|
708 | <dd>The <tt>svn copy</tt> command schedules a file or directory |
---|
709 | for addition to the repository, recording the "source" of the |
---|
710 | copy. After committing, <tt>svn log</tt> on the copied item |
---|
711 | will trace history back through the original copy-source. The |
---|
712 | <tt>svn move</tt> command is exactly equivalent to running |
---|
713 | <tt>svn copy</tt>, followed by an <tt>svn delete</tt> on the |
---|
714 | copy-source: the result is a new item scheduled for addition |
---|
715 | (with copy-history attached) and the original item scheduled for |
---|
716 | deletion.</dd> |
---|
717 | |
---|
718 | </dl> |
---|
719 | </td> |
---|
720 | </tr> |
---|
721 | </table> |
---|
722 | |
---|
723 | <dl class="bookref"> |
---|
724 | <dt>Book References:</dt> |
---|
725 | <dd><a href="http://svnbook.red-bean.com/svnbook/ch03s05.html#svn-ch-3-sect-4.2">Make Changes to Your Working Copy</a></dd> |
---|
726 | <dd><a href="http://svnbook.red-bean.com/svnbook/re07.html">svn copy</a></dd> |
---|
727 | <dd><a href="http://svnbook.red-bean.com/svnbook/re18.html">svn move</a></dd> |
---|
728 | </dl> |
---|
729 | |
---|
730 | |
---|
731 | </div> |
---|
732 | |
---|
733 | <!-- ==================================================================== --> |
---|
734 | <div class="h2"> |
---|
735 | <h2>Finding the beginning of a branch</h2> |
---|
736 | |
---|
737 | <p>If you're attempting to merge an entire branch into another, you |
---|
738 | need to compare the "root" and "tip" of the source branch, and then |
---|
739 | merge those differences into a working copy of the target branch. |
---|
740 | Obviously the "tip" of the branch can be represented by using the |
---|
741 | <tt>HEAD</tt> keyword. But how do you find the "birth" revision of |
---|
742 | the source branch?</p> |
---|
743 | |
---|
744 | <p>The easiest solution is to run</p> |
---|
745 | |
---|
746 | <pre> |
---|
747 | $ svn log -v --stop-on-copy source-branch-URL |
---|
748 | … |
---|
749 | </pre> |
---|
750 | |
---|
751 | <p>This command will display every change ever made to the branch, but |
---|
752 | <tt>--stop-on-copy</tt> option will cause the output to stop as soon |
---|
753 | as detects a copy operation in the branch's history. By definition, |
---|
754 | then, the very last log entry printed will show the copy being made. |
---|
755 | It will look something like:</p> |
---|
756 | |
---|
757 | <pre> |
---|
758 | r9189 | joe | 2004-03-22 10:10:47 -0600 (Mon, 22 Mar 2004) | 1 line |
---|
759 | Changed paths: |
---|
760 | A /branches/mybranch (from /trunk:9188) |
---|
761 | </pre> |
---|
762 | |
---|
763 | <p>In this case, you would then know to compare revisions 9189 and |
---|
764 | HEAD of the branch in order to perform the merge:</p> |
---|
765 | |
---|
766 | <pre> |
---|
767 | $ svn merge -r9189:HEAD source-branch-URL target-branch-WC |
---|
768 | … |
---|
769 | </pre> |
---|
770 | |
---|
771 | </div> |
---|
772 | |
---|
773 | <!-- ==================================================================== --> |
---|
774 | <div class="h2"> |
---|
775 | <h2>Seeing all of a project's tags</h2> |
---|
776 | |
---|
777 | <p>Assuming you've been following a consistent policy for creating |
---|
778 | tag-copies, then this is just a matter of running <tt>svn ls</tt> on a |
---|
779 | directory containing your tags. Typically you would run it on the |
---|
780 | <tt>/tags</tt> directory in your repository, although you're certainly |
---|
781 | free to organize this directory in a more complex way, or invent a |
---|
782 | different convention altogether.</p> |
---|
783 | |
---|
784 | <p>As an example, you can see all of Subversion's tags by running:</p> |
---|
785 | |
---|
786 | <pre> |
---|
787 | $ svn ls --verbose http://svn.collab.net/repos/svn/tags |
---|
788 | … |
---|
789 | 7739 kfogel Nov 13 22:05 0.33.0/ |
---|
790 | 7796 josander Nov 18 12:15 0.33.1/ |
---|
791 | 7932 josander Dec 03 17:54 0.34.0/ |
---|
792 | 8045 josander Dec 19 15:13 0.35.0/ |
---|
793 | 8063 josander Dec 20 11:20 0.35.1/ |
---|
794 | 8282 josander Jan 13 14:15 0.36.0/ |
---|
795 | 8512 josander Jan 24 17:31 0.37.0/ |
---|
796 | 8810 kfogel Feb 23 03:44 1.0.0/ |
---|
797 | … |
---|
798 | </pre> |
---|
799 | |
---|
800 | </div> |
---|
801 | |
---|
802 | <!-- ==================================================================== --> |
---|
803 | <div class="h2"> |
---|
804 | <h2>Seeing the differences between two tags</h2> |
---|
805 | |
---|
806 | <p>Just use <tt>svn diff</tt> in its fully expanded form, which |
---|
807 | compares any two URLs:</p> |
---|
808 | |
---|
809 | <pre> |
---|
810 | $ svn diff tagURL1 tagURL2 |
---|
811 | … |
---|
812 | </pre> |
---|
813 | |
---|
814 | </div> |
---|
815 | |
---|
816 | <!-- ==================================================================== --> |
---|
817 | <div class="h2"> |
---|
818 | <h2>Seeing logs between two tags</h2> |
---|
819 | |
---|
820 | <p>This is a somewhat common practice in CVS, and is doable in Subversion, |
---|
821 | but requires a little bit more work. Assuming that you've made two |
---|
822 | tags of <tt>/trunk</tt> at different points in time, the ultimate goal |
---|
823 | here is to run </p> |
---|
824 | |
---|
825 | <pre> |
---|
826 | $ svn log -rX:Y trunkURL |
---|
827 | </pre> |
---|
828 | |
---|
829 | <p>…where X and Y are the revisions from which the two tags were |
---|
830 | copied. To discover X and Y, you can use the same technique |
---|
831 | described in the previous section ("finding the beginning of a |
---|
832 | branch".) Just use the <tt>--stop-on-copy</tt> option when logging the |
---|
833 | history of each tag. No commits happen on tag directories, so the |
---|
834 | following commands should each produce exactly <em>one</em> log |
---|
835 | entry:</p> |
---|
836 | |
---|
837 | <pre> |
---|
838 | $ svn log -v --stop-on-copy tag1-URL |
---|
839 | |
---|
840 | r3520 | joe | 2004-03-12 15:28:43 -0600 (Fri, 12 Mar 2004) | 1 line |
---|
841 | … |
---|
842 | |
---|
843 | $ svn log -v --stop-on-copy tag2-URL |
---|
844 | a |
---|
845 | r4177 | joe | 2004-03-12 15:28:43 -0600 (Fri, 12 Mar 2004) | 1 line |
---|
846 | … |
---|
847 | </pre> |
---|
848 | |
---|
849 | <p>So in this example, the values of X and Y are 3520 and 4177. Now |
---|
850 | you can view all <tt>/trunk</tt> changes between those two points in time:</p> |
---|
851 | |
---|
852 | <pre> |
---|
853 | $ svn log -r3520:4177 trunkURL |
---|
854 | … |
---|
855 | </pre> |
---|
856 | |
---|
857 | </div> |
---|
858 | |
---|
859 | <!-- ==================================================================== --> |
---|
860 | <div class="h2"> |
---|
861 | <h2>Fixing an incorrect tag</h2> |
---|
862 | |
---|
863 | <p>If your tag is a bit off, you can "adjust" it just as people often |
---|
864 | do in CVS. Simply check out a working copy of the tag directory, make |
---|
865 | any changes you wish, and commit.</p> |
---|
866 | |
---|
867 | <p>Remember, because branches and tags are directories, they can also |
---|
868 | be deleted when they're no longer of any use to your project. They'll |
---|
869 | continue to exist in the repository's history.</p> |
---|
870 | |
---|
871 | |
---|
872 | </div> |
---|
873 | |
---|
874 | <!-- ==================================================================== --> |
---|
875 | <div class="h2"> |
---|
876 | <h2>Creating/using "modules"</h2> |
---|
877 | |
---|
878 | <p>Compare CVS Modules vs. svn:externals.</p> |
---|
879 | |
---|
880 | </div> |
---|
881 | |
---|
882 | <!-- ==================================================================== --> |
---|
883 | </body> |
---|
884 | </html> |
---|