Fix compiler warning due to missing function prototype.
[svn.git] / doc / user / cvs-crossover-guide.html
blob08e01af592570c0904663cf76b9d00271391590d
1 <html>
2 <head>
3 <title>CVS to SVN Crossover Guide</title>
4 <style>
5 body {
6 font-family: sans-serif;
8 h1 {
9 text-align: center;
11 h2 {
12 background: #b0c0f0;
13 margin: 0;
15 .h2 {
16 border-left: 4px #b0c0f0 solid;
17 margin-bottom: 2em;
19 hr {
20 height: 1px;
21 width: 80%;
23 p, h3, dl {
24 padding-left: 1em;
26 dd {
27 margin-left: 2em;
29 .sidebyside {
30 padding: 0 2em;
31 width: 100%;
32 font-size: 80%;
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;
42 .sidebyside th {
43 text-align: center;
44 background: #90a0d0;
46 .bookref {
47 font-size: 80%;
49 </style>
50 </head>
52 <body>
54 <h1>CVS to SVN Crossover Guide</h1>
56 <!-- ==================================================================== -->
57 <div class="h2">
58 <h2>Purpose</h2>
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>
69 </div>
71 <!-- ==================================================================== -->
72 <div class="h2">
73 <h2>Table of Contents</h2>
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>
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>
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>
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>
120 <h3>Other tasks</h3>
121 <ul>
122 <li>Using modules</li>
123 <li>Line endings and keywords</li>
124 </ul>
126 </div>
128 <!-- ==================================================================== -->
129 <div class="h2">
130 <h2 id="repos_creation">Repository creation</h2>
132 <p>Create a new repository for holding versioned data.</p>
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>$&nbsp;cvs&nbsp;-d&nbsp;/usr/local/repos&nbsp;init</tt></dd>
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>$&nbsp;svnadmin&nbsp;create&nbsp;/usr/local/repos</tt></dd>
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>
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>
168 </div>
170 <!-- ==================================================================== -->
171 <div class="h2">
172 <h2 id="import">Importing data</h2>
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>
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>$&nbsp;cd&nbsp;myproj</tt></dd>
188 <dd><tt>$&nbsp;cvs&nbsp;-d&nbsp;/usr/local/repos&nbsp;import&nbsp;myproj/&nbsp;none&nbsp;start</tt></dd>
190 <dt>Explanation:</dt>
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>
197 </dl>
198 </td>
199 <td>
200 <dl>
201 <dt>Commands:</dt>
202 <dd><tt>$&nbsp;svn&nbsp;mkdir&nbsp;file:///usr/local/repos/tags</tt></dd>
203 <dd><tt>$&nbsp;svn&nbsp;mkdir&nbsp;file:///usr/local/repos/branches</tt></dd>
204 <dd><tt>$&nbsp;svn&nbsp;import&nbsp;myproj/&nbsp;file:///usr/local/repos/trunk</tt></dd>
206 <dt>Explanation:</dt>
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>
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>
227 <!-- ==================================================================== -->
228 <div class="h2">
229 <h2 id="installing">Installing a server</h2>
231 <p>Make the repository available to clients via a network.</p>
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>
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>
249 </dl>
250 </td>
251 <td>
252 <dl>
253 <dt>Commands:</dt>
254 <dd>(too complex to demonstrate here)</dd>
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>
262 </dl>
263 </td>
264 </tr>
265 </table>
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>
272 </div>
274 <!-- ==================================================================== -->
275 <div class="h2">
276 <h2 id="authenticating">Authenticating to a server</h2>
278 <p>Have a network client prove its identity to a version
279 control server.</p>
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>$&nbsp;cvs&nbsp;-d&nbsp;:pserver:user@host:/repos&nbsp;<em>command</em>&hellip;</tt></dd>
292 <dt>Explanation:</dt>
294 <dd>When contacting a repository, the client pre-emptively
295 "pushes" its authentication credentials at the server.</dd>
297 </dl>
298 </td>
299 <td>
300 <dl>
301 <dt>Commands:</dt>
302 <dd><tt>$&nbsp;svn&nbsp;<em>command</em>&nbsp;<em>URL</em>&hellip;</tt></dd>
303 <dd><tt>Password&nbsp;for&nbsp;'user':&nbsp;&nbsp;XXXXXXX</tt></dd>
305 <dt>Explanation:</dt>
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>
315 </dl>
316 </td>
317 </tr>
318 </table>
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>
325 </div>
327 <!-- ==================================================================== -->
328 <div class="h2">
329 <h2 id="browsing">Browsing a repository</h2>
331 <p>Browse the repository as a filesystem, perusing file
332 contents and history as well (older versions of files or
333 trees.)</p>
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>
346 <dt>Explanation:</dt>
348 <dd>Not possible with commandline client. A third-party web
349 server tool such as ViewCVS must be used.</dd>
351 </dl>
352 </td>
353 <td>
354 <dl>
355 <dt>Commands:</dt>
356 <dd><tt>$&nbsp;svn&nbsp;list&nbsp;<em>URL</em>&nbsp;[-r&nbsp;<em>rev</em>]&nbsp;[-v]</tt></dd>
357 <dd><tt>$&nbsp;svn&nbsp;cat&nbsp;<em>URL</em>&nbsp;[-r&nbsp;<em>rev</em>]</tt></dd>
359 <dt>Explanation:</dt>
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>
371 </dl>
372 </td>
373 </tr>
374 </table>
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>
381 </div>
383 <!-- ==================================================================== -->
384 <div class="h2">
385 <h2 id="checkingout">Checking out a working copy</h2>
387 <p>Create a workspace on local disk which mirrors a directory
388 in the repository.</p>
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>$&nbsp;cvs&nbsp;-d&nbsp;/usr/local/repos&nbsp;checkout&nbsp;myproj</tt></dd>
400 <dd><tt>U&nbsp;myproj/foo.c</tt></dd>
401 <dd><tt>U&nbsp;myproj/bar.c</tt></dd>
402 <dd><tt>&hellip;</tt></dd>
404 <dt>Explanation:</dt>
406 <dd>Creates a local directory <tt>myproj</tt> which is a mirror
407 of the repository directory <tt>/myproj</tt>.</dd>
409 </dl>
410 </td>
411 <td>
412 <dl>
413 <dt>Commands:</dt>
414 <dd><tt>$&nbsp;svn&nbsp;checkout&nbsp;file:///usr/local/repos/trunk&nbsp;myproj</tt></dd>
415 <dd><tt>A&nbsp;&nbsp;myproj/foo.c</tt></dd>
416 <dd><tt>A&nbsp;&nbsp;myproj/bar.c</tt></dd>
417 <dd><tt>&hellip;</tt></dd>
419 <dt>Explanation:</dt>
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>
428 </dl>
429 </td>
430 </tr>
431 </table>
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>
439 </div>
441 <!-- ==================================================================== -->
442 <div class="h2">
443 <h2 id="changeditems">Seeing locally changed items</h2>
445 <p>Discover which items in the working copy have local
446 modifications or are scheduled for addition/deletion.</p>
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>$&nbsp;cvs&nbsp;status</tt></dd>
458 <dd><tt>&hellip;</tt></dd>
459 <dd><tt>File: baz.c&nbsp;&nbsp;&nbsp;Status:&nbsp;Up-to-date</tt></dd>
460 <dd><tt>&hellip;</tt></dd>
461 <dd><tt>$&nbsp;cvs&nbsp;update</tt></dd>
462 <dd><tt>M foo.c</tt></dd>
463 <dd><tt>U bar.c</tt></dd>
464 <dd><tt>&hellip;</tt></dd>
466 <dt>Explanation:</dt>
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>
476 </dl>
477 </td>
478 <td>
479 <dl>
480 <dt>Commands:</dt>
481 <dd><tt>$&nbsp;svn&nbsp;status</tt></dd>
482 <dd><tt>M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foo.c</tt></dd>
483 <dd><tt>&hellip;</tt></dd>
485 <dt>Explanation:</dt>
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>
492 </dl>
493 </td>
494 </tr>
495 </table>
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>
503 </div>
505 <!-- ==================================================================== -->
506 <div class="h2">
507 <h2 id="outofdate">Seeing out-of-date items</h2>
509 <p>Discover which items in the working copy are out-of-date
510 (i.e. newer versions exist in the repository.)</p>
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>$&nbsp;cvs&nbsp;status</tt></dd>
522 <dd><tt>&hellip;</tt></dd>
523 <dd><tt>File: baz.c&nbsp;&nbsp;&nbsp;Status:&nbsp;Needs&nbsp;Patch</tt></dd>
524 <dd><tt>&hellip;</tt></dd>
525 <dd><tt>$&nbsp;cvs&nbsp;-n&nbsp;update</tt></dd>
526 <dd><tt>M foo.c</tt></dd>
527 <dd><tt>U bar.c</tt></dd>
528 <dd><tt>&hellip;</tt></dd>
530 <dt>Explanation:</dt>
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>
539 </dl>
540 </td>
541 <td>
542 <dl>
543 <dt>Commands:</dt>
544 <dd><tt>$&nbsp;svn&nbsp;status&nbsp;-u</tt></dd>
545 <dd><tt>M&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;46&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foo.c</tt></dd>
546 <dd><tt>M&nbsp;&nbsp;*&nbsp;&nbsp;46&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bar.c</tt></dd>
547 <dd><tt>&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;46&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baz.c</tt></dd>
548 <dd><tt>&hellip;</tt></dd>
550 <dt>Explanation:</dt>
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>
557 </dl>
558 </td>
559 </tr>
560 </table>
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>
568 </div>
570 <!-- ==================================================================== -->
571 <div class="h2">
572 <h2 id="scheduling">Scheduling additions or deletions</h2>
574 <p>Schedule a working-copy file or directory to be added or
575 removed from the repository.</p>
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>$&nbsp;touch&nbsp;foo.c</tt></dd>
587 <dd><tt>$&nbsp;cvs&nbsp;add&nbsp;foo.c</tt></dd>
588 <dd><tt>cvs&nbsp;server:&nbsp;scheduling&nbsp;file&nbsp;`blah'&nbsp;for&nbsp;addition</tt></dd>
589 <dd><tt>cvs&nbsp;server:&nbsp;use&nbsp;'cvs&nbsp;commit'&nbsp;to&nbsp;add&nbsp;this&nbsp;file&nbsp;permanently</tt></dd>
590 <dd><tt>&nbsp;</tt></dd>
591 <dd><tt>$&nbsp;mkdir&nbsp;new-dir</tt></dd>
592 <dd><tt>$&nbsp;cvs&nbsp;add&nbsp;new-dir</tt></dd>
593 <dd><tt>Directory&nbsp;new-dir&nbsp;added&nbsp;to&nbsp;the&nbsp;repository</tt></dd>
594 <dd><tt>&nbsp;</tt></dd>
595 <dd><tt>$&nbsp;rm&nbsp;bar.c</tt></dd>
596 <dd><tt>$&nbsp;cvs&nbsp;rm&nbsp;bar.c</tt></dd>
597 <dd><tt>cvs&nbsp;remove:&nbsp;scheduling&nbsp;`bar.c'&nbsp;for&nbsp;removal</tt></dd>
598 <dd><tt>cvs&nbsp;remove:&nbsp;use&nbsp;'cvs&nbsp;commit'&nbsp;to&nbsp;remove&nbsp;this&nbsp;file&nbsp;permanently</tt></dd>
599 <dd><tt>&nbsp;</tt></dd>
600 <dd><tt>$&nbsp;rm&nbsp;-rf&nbsp;old-dir/*</tt></dd>
601 <dd><tt>$&nbsp;cvs&nbsp;rm&nbsp;old-dir</tt></dd>
602 <dd><tt>cvs&nbsp;remove:&nbsp;Removing&nbsp;3bits</tt></dd>
603 <dd><tt>&hellip;</tt></dd>
606 <dt>Explanation:</dt>
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>
616 </dl>
617 </td>
618 <td>
619 <dl>
620 <dt>Commands:</dt>
621 <dd><tt>$&nbsp;touch&nbsp;foo.c</tt></dd>
622 <dd><tt>$&nbsp;svn&nbsp;add&nbsp;foo.c</tt></dd>
623 <dd><tt>A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foo.c</tt></dd>
624 <dd><tt>&nbsp;</tt></dd>
625 <dd><tt>$&nbsp;mkdir&nbsp;new-dir</tt></dd>
626 <dd><tt>$&nbsp;svn&nbsp;add&nbsp;new-dir</tt></dd>
627 <dd><tt>A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new-dir</tt></dd>
628 <dd><tt>&nbsp;</tt></dd>
629 <dd><tt>$&nbsp;svn&nbsp;rm&nbsp;bar.c</tt></dd>
630 <dd><tt>D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bar.c</tt></dd>
631 <dd><tt>&nbsp;</tt></dd>
632 <dd><tt>$&nbsp;svn&nbsp;rm&nbsp;old-dir</tt></dd>
633 <dd><tt>D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;old-dir/file1</tt></dd>
634 <dd><tt>D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;old-dir/file2</tt></dd>
635 <dd><tt>&hellip;</tt></dd>
637 <dt>Explanation:</dt>
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>
647 </dl>
648 </td>
649 </tr>
650 </table>
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>
659 </div>
661 <!-- ==================================================================== -->
662 <div class="h2">
663 <h2 id="copying">Copying and moving</h2>
665 <p>Copy or move/rename a file or directory.</p>
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>
679 <dt>Explanation:</dt>
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>
685 </dl>
686 </td>
687 <td>
688 <dl>
689 <dt>Commands:</dt>
690 <dd><tt>$&nbsp;svn&nbsp;copy&nbsp;foo.c&nbsp;foo2.c</tt></dd>
691 <dd><tt>A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;foo2.c</tt></dd>
692 <dd><tt>&nbsp;</tt></dd>
693 <dd><tt>$&nbsp;svn&nbsp;copy&nbsp;dir&nbsp;dir2</tt></dd>
694 <dd><tt>A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dir2</tt></dd>
695 <dd><tt>&nbsp;</tt></dd>
696 <dd><tt>$&nbsp;svn&nbsp;move&nbsp;bar.c&nbsp;baz.c</tt></dd>
697 <dd><tt>A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;baz.c</tt></dd>
698 <dd><tt>D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bar.c</tt></dd>
699 <dd><tt>&nbsp;</tt></dd>
700 <dd><tt>$&nbsp;svn&nbsp;move&nbsp;dirA&nbsp;dirB</tt></dd>
701 <dd><tt>A&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dirB</tt></dd>
702 <dd><tt>D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dirA/file1</tt></dd>
703 <dd><tt>D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dirA/file2</tt></dd>
704 <dd><tt>&hellip;</tt></dd>
706 <dt>Explanation:</dt>
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>
718 </dl>
719 </td>
720 </tr>
721 </table>
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>
731 </div>
733 <!-- ==================================================================== -->
734 <div class="h2">
735 <h2>Finding the beginning of a branch</h2>
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>
744 <p>The easiest solution is to run</p>
746 <pre>
747 $ svn log -v --stop-on-copy source-branch-URL
748 &hellip;
749 </pre>
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>
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>
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>
766 <pre>
767 $ svn merge -r9189:HEAD source-branch-URL target-branch-WC
768 &hellip;
769 </pre>
771 </div>
773 <!-- ==================================================================== -->
774 <div class="h2">
775 <h2>Seeing all of a project's tags</h2>
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>
784 <p>As an example, you can see all of Subversion's tags by running:</p>
786 <pre>
787 $ svn ls --verbose http://svn.collab.net/repos/svn/tags
788 &hellip;
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 &hellip;
798 </pre>
800 </div>
802 <!-- ==================================================================== -->
803 <div class="h2">
804 <h2>Seeing the differences between two tags</h2>
806 <p>Just use <tt>svn diff</tt> in its fully expanded form, which
807 compares any two URLs:</p>
809 <pre>
810 $ svn diff tagURL1 tagURL2
811 &hellip;
812 </pre>
814 </div>
816 <!-- ==================================================================== -->
817 <div class="h2">
818 <h2>Seeing logs between two tags</h2>
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>
825 <pre>
826 $ svn log -rX:Y trunkURL
827 </pre>
829 <p>&hellip;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>
837 <pre>
838 $ svn log -v --stop-on-copy tag1-URL
840 r3520 | joe | 2004-03-12 15:28:43 -0600 (Fri, 12 Mar 2004) | 1 line
841 &hellip;
843 $ svn log -v --stop-on-copy tag2-URL
845 r4177 | joe | 2004-03-12 15:28:43 -0600 (Fri, 12 Mar 2004) | 1 line
846 &hellip;
847 </pre>
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>
852 <pre>
853 $ svn log -r3520:4177 trunkURL
854 &hellip;
855 </pre>
857 </div>
859 <!-- ==================================================================== -->
860 <div class="h2">
861 <h2>Fixing an incorrect tag</h2>
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>
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>
872 </div>
874 <!-- ==================================================================== -->
875 <div class="h2">
876 <h2>Creating/using "modules"</h2>
878 <p>Compare CVS Modules vs. svn:externals.</p>
880 </div>
882 <!-- ==================================================================== -->
883 </body>
884 </html>