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