View | Details | Raw Unified | Return to bug 169772
Collapse All | Expand All

(-)en_US.ISO8859-1/articles/committers-guide/article.sgml (-868 / +113 lines)
Lines 95-105 Link Here
95
	  </row>
95
	  </row>
96
96
97
	  <row>
97
	  <row>
98
	    <entry><emphasis><literal>ports/</literal> CVS Root</emphasis></entry>
98
	    <entry><emphasis><literal>ports/</literal> Subversion
99
		Root</emphasis></entry>
99
	    <entry>
100
	    <entry>
100
	      <hostid
101
	      <literal>svn+ssh://</literal><hostid
101
		  role="fqdn">pcvs.FreeBSD.org</hostid><literal>:</literal><filename>/home/pcvs</filename>
102
		role="fqdn">svn.FreeBSD.org</hostid><filename>/ports</filename>
102
	      (see also <xref linkend="vcs.operations">).</entry>
103
	      (see also <xref linkend="subversion-primer">).</entry>
103
	  </row>
104
	  </row>
104
105
105
	  <row>
106
	  <row>
Lines 264-1091 Link Here
264
265
265
  </sect1>
266
  </sect1>
266
267
267
  <sect1 id="vcs.operations">
268
  <sect1 id="subversion-primer">
268
    <title>Version Control System Operations</title>
269
    <title>Subversion Primer</title>
269
270
270
    <para>It is assumed that you are already familiar with the basic
271
    <para>It is assumed that you are already familiar with the basic
271
      operation of the version control systems in use.  Traditionally
272
      operation of the version control systems in use.  Traditionally
272
      this was CVS.  Subversion is used for the <literal>src</literal>
273
      this was CVS.  Subversion is used for the <literal>src</literal>
273
      tree as of May 2008 and the <literal>doc/www</literal> tree as
274
      tree as of May 2008, the <literal>doc/www</literal> tree as of
274
      of May 2012.  Subversion is covered in <xref
275
      May 2012 and the <literal>ports</literal> tree as of July 2012.
275
	linkend="subversion-primer">.</para>
276
      </para>
276
277
277
    <para>The &a.cvsadm; are the <quote>owners</quote> of the
278
    <para><ulink url="http://wiki.freebsd.org/SubversionMissing">There
278
      repository and are responsible for direct modification of it for
279
      is a list of things missing in Subversion when compared to CVS
279
      the purposes of cleanup or fixing some unfortunate abuse of the
280
      </ulink>.  The notes at <ulink
280
      version control system by a committer.  Should you cause some
281
      url="http://people.freebsd.org/~peter/svn_notes.txt"></ulink>
281
      repository accident, say a bad import or a bad tag creation,
282
      might also be useful.</para>
282
      mail the responsible part of &a.cvsadm;, as stated in the table
283
      below, (or call one of them) and report the problem.  For very
284
      important issues affecting the entire tree&mdash;not just a
285
      specific area&mdash;you can contact the &a.cvsadm;.  Please do
286
      <emphasis>not</emphasis> contact the &a.cvsadm; for repocopies
287
      or other things that the more specific teams can handle.</para>
288
283
289
    <para><anchor id="repomeisters">The only ones able to directly
290
      fiddle the repository bits on the repository hosts are the
291
      repomeisters.  To enforce this, there are no login shells
292
      available on the repository machines, except to the
293
      repomeisters.</para>
294
295
    <note>
296
      <para>Depending on the affected area of the repository, you
297
	should send your request for a repocopy to one of the
298
	following email addresses.  Email sent to these addresses will
299
	be forwarded to the appropriate repomeisters.</para>
300
301
      <itemizedlist>
302
	<listitem><para>pcvs@ - regarding <filename class="directory">
303
	    /home/pcvs</filename>, the ports
304
	  repository</para></listitem>
305
306
	<listitem><para>projcvs@ - regarding <filename
307
	      class="directory"> /home/projcvs</filename>, the
308
	  third party projects repository</para></listitem>
309
      </itemizedlist>
310
    </note>
311
312
    <para>The &os; repositories are currently split into two distinct
313
      parts, namely <literal>ports</literal> and
314
      <literal>projects</literal>.  These are combined under a single
315
      <literal>CVSROOT</literal> when distributed via
316
      <application>CVSup</application> for the convenience of our
317
      users.  The <literal>src</literal> tree is automatically
318
      exported to CVS for compatibility reasons only (e.g.,
319
      <application>CVSup</application>).  The <quote>official</quote>
320
      <literal>src</literal> repository is not stored in
321
      <application>CVS</application> but in Subversion.  The official
322
      and exported trees are not necessarily equal.</para>
323
324
    <para>The CVS repositories are hosted on the repository machines.
325
      Currently, each of the repositories above reside on the same
326
      physical machine, <hostid
327
	role="hostname">ncvs.FreeBSD.org</hostid>, but to allow for
328
      the possibility of placing each on a separate machine in the
329
      future, there is a separate hostname for each that committers
330
      should use.  Additionally, each repository is stored in a
331
      separate directory.  The following table summarizes the
332
      situation.</para>
333
334
    <table frame="none" id="cvs-repositories-and-hosts">
335
      <title>&os; CVS Repositories, Hosts and Directories</title>
336
337
      <tgroup cols="3">
338
	<thead>
339
	  <row>
340
	    <entry>Repository</entry>
341
	    <entry>Host</entry>
342
	    <entry>Directory</entry>
343
	  </row>
344
	</thead>
345
346
	<tbody>
347
	  <row>
348
	    <entry>ports</entry>
349
	    <entry>pcvs.FreeBSD.org</entry>
350
	    <entry>/home/pcvs</entry>
351
	  </row>
352
353
	  <row>
354
	    <entry>projects</entry>
355
	    <entry>projcvs.FreeBSD.org</entry>
356
	    <entry>/home/projcvs</entry>
357
	  </row>
358
	</tbody>
359
      </tgroup>
360
    </table>
361
362
    <para>CVS operations are done remotely by setting the
363
      <envar>CVSROOT</envar> environment variable to the appropriate
364
      host and top-level directory (for example, <hostid
365
	role="fqdn">pcvs.FreeBSD.org</hostid><literal>:</literal><filename>/home/pcvs</filename>),
366
      and doing the appropriate check-out/check-in operations.  Many
367
      committers define aliases which expand to the correct
368
      <application>cvs</application> invocation for the appropriate
369
      repository.  For example, a &man.tcsh.1; user may add the
370
      following to their <filename>.cshrc</filename> for this
371
      purpose:</para>
372
373
    <programlisting>alias pcvs cvs -d <replaceable>user</replaceable>@pcvs.FreeBSD.org:/home/pcvs
374
alias projcvs cvs -d <replaceable>user</replaceable>@projcvs.FreeBSD.org:/home/projcvs</programlisting>
375
376
    <para>This way they can do all CVS operations locally and use
377
      <command><replaceable>X</replaceable>cvs commit</command> for
378
      committing to the official CVS repository.
379
      Refer to the &man.cvs.1; manual page for usage.</para>
380
381
    <note>
382
      <para>Please do <emphasis>not</emphasis> use <command>cvs
383
	  checkout</command> or <command>update</command> with the
384
	official repository machine set as the CVS Root for keeping
385
	your source tree up to date.  Remote CVS is not optimized for
386
	network distribution and requires a big work/administrative
387
	overhead on the server side.  Please use our advanced
388
	<command>cvsup</command> distribution method for obtaining the
389
	repository bits, and only do the actual
390
	<command>commit</command> operation on the repository host.
391
	We provide an extensive cvsup replication network for this
392
	purpose, as well as give access to
393
	<hostid>cvsup-master</hostid> if you really need to stay
394
	current to the latest changes.  <hostid>cvsup-master</hostid>
395
	has got the horsepower to deal with this, the repository
396
	master server does not.  &a.kuriyama; is in charge of
397
	<hostid>cvsup-master</hostid>.</para>
398
    </note>
399
400
    <para>If you need to use CVS <command>add</command> and
401
      <command>delete</command> operations in a manner that is
402
      effectively a &man.mv.1; operation, then a repository copy is in
403
      order rather than using CVS <command>add</command> and
404
      <command>delete</command>.  In a repository copy, a <link
405
	linkend="repomeisters">repomeister</link> will copy the
406
      file(s) to their new name and/or location and let you know when
407
      it is done.  The purpose of a repository copy is to preserve
408
      file change history, or logs.  We in the FreeBSD Project greatly
409
      value the change history that a version control system gives to
410
      the project.</para>
411
412
    <para>CVS reference information, tutorials, and FAQs can be found
413
      at: <ulink url="http://www.cvshome.org/docs/"></ulink>.  The
414
      information in <ulink
415
	url="http://cvsbook.red-bean.com/cvsbook.html">Karl Fogel's
416
	chapters from <quote>Open Source Development with
417
	  CVS</quote></ulink> is also very useful.</para>
418
419
    <para>&a.des; also supplied the following <quote>mini
420
	primer</quote> for CVS.</para>
421
422
    <orderedlist>
423
      <listitem>
424
	<para>Check out a module with the <command>co</command> or
425
	  <command>checkout</command> command.</para>
426
427
	<screen>&prompt.user; <userinput>cvs checkout shazam</userinput></screen>
428
429
	<para>This checks out a copy of the
430
	  <filename>shazam</filename> module. If there is no
431
	  <filename>shazam</filename> module in the modules file, it
432
	  looks for a top-level directory named
433
	  <filename>shazam</filename> instead.</para>
434
435
	<table frame="none">
436
	  <title>Useful <command>cvs checkout</command>
437
	    options</title>
438
439
	  <tgroup cols=2>
440
	    <tbody>
441
	      <row>
442
		<entry><option>-P</option></entry>
443
		<entry>Do not create empty directories</entry>
444
	      </row>
445
446
	      <row>
447
		<entry><option>-l</option></entry>
448
		<entry>Check out a single level, no
449
		  subdirectories</entry>
450
	      </row>
451
452
	      <row>
453
		<entry><option>-r<replaceable>rev</replaceable></option></entry>
454
		<entry>Check out revision, branch or tag
455
		  <replaceable>rev</replaceable></entry>
456
	      </row>
457
458
	      <row>
459
		<entry><option>-D<replaceable>date</replaceable></option></entry>
460
		<entry>Check out the sources as they were on date
461
		  <replaceable>date</replaceable></entry>
462
	      </row>
463
	    </tbody>
464
	  </tgroup>
465
	</table>
466
467
	<para>Practical FreeBSD examples:</para>
468
469
	<itemizedlist>
470
	  <listitem>
471
	    <para>Check out the <filename>Tools</filename> module,
472
	      which corresponds to
473
	      <filename>ports/Tools</filename>:</para>
474
475
	    <screen>&prompt.user; <userinput>cvs co Tools</userinput></screen>
476
477
	    <para>You now have a directory named
478
	      <filename>ports/Tools</filename> with subdirectories
479
	      <filename>portbuild</filename>,
480
	      <filename>scripts</filename>, and
481
	      <filename>CVS</filename>.</para>
482
	  </listitem>
483
484
	  <listitem>
485
	    <para>Check out the same files, but with full path:</para>
486
487
	    <screen>&prompt.user; <userinput>cvs co ports/Tools</userinput></screen>
488
489
	    <para>You now have a directory named
490
	      <filename>ports</filename>, with subdirectories
491
	      <filename>CVS</filename> and <filename>Tools</filename>.
492
	      The <filename>ports/Tools</filename> directory has
493
	      subdirectories <filename>CVS</filename> and
494
	      <filename>scripts</filename>, etc.</para>
495
	  </listitem>
496
497
	  <listitem>
498
	    <para>Check out the directory <filename>Tools</filename>,
499
	      but none of the subdirectories:</para>
500
501
	    <screen>&prompt.user; <userinput>cvs co -l Tools</userinput></screen>
502
503
	    <para>You now have a directory named
504
	      <filename>Tools</filename> with just one subdirectory
505
	      named <filename>CVS</filename>.</para>
506
	  </listitem>
507
508
	  <listitem>
509
	    <para>Check out the <filename>Tools</filename> module as
510
	      it was when support for &os;&nbsp;5.X was
511
	      dropped:</para>
512
513
	    <screen>&prompt.user; <userinput>cvs co -rRELEASE_5_EOL Tools</userinput></screen>
514
515
	    <para>You will not be able to commit modifications, since
516
	      <literal>RELEASE_5_EOL</literal> is a point in time, not
517
	      a branch.</para>
518
	  </listitem>
519
520
	  <listitem>
521
	    <para>Check out the <filename>Tools</filename> module as
522
	      it was on March 25th, 2009:</para>
523
524
	    <screen>&prompt.user; <userinput>cvs co -D'2009-03-25' Tools</userinput></screen>
525
526
	    <para>You will not be able to commit modifications.</para>
527
	  </listitem>
528
529
	  <listitem>
530
	    <para>Check out the <filename>Tools</filename> module as
531
	      it was one week ago:</para>
532
533
	    <screen>&prompt.user; <userinput>cvs co -D'last week' Tools</userinput></screen>
534
535
	    <para>You will not be able to commit modifications.</para>
536
	  </listitem>
537
	</itemizedlist>
538
539
	<para>Note that cvs stores metadata in subdirectories named
540
	  <filename>CVS</filename>.  Similarly, Subversion stores
541
	  metadata in subdirectories named
542
	  <filename>.svn</filename>.</para>
543
544
	<para>Arguments to <option>-D</option> and <option>-r</option>
545
	  are sticky, which means cvs will remember them later, e.g.,
546
	  when you do a <command>cvs update</command>.</para>
547
      </listitem>
548
549
      <listitem>
550
	<para>Check the status of checked-out files with the
551
	  <command>status</command> command.</para>
552
553
	<screen>&prompt.user; <userinput>cvs status shazam</userinput></screen>
554
555
	<para>This displays the status of the file
556
	  <filename>shazam</filename> or of every file in the
557
	  <filename>shazam</filename> directory. For every file, the
558
	  status is given as one of:</para>
559
560
	<informaltable frame="none" pgwide="1">
561
	  <tgroup cols=2>
562
	    <tbody>
563
	      <row>
564
		<entry>Up-to-date</entry>
565
		<entry>File is up-to-date and unmodified.</entry>
566
	      </row>
567
568
	      <row>
569
		<entry>Needs Patch</entry>
570
		<entry>File is unmodified, but there is a newer
571
		  revision in the repository.</entry>
572
	      </row>
573
574
	      <row>
575
		<entry>Locally Modified</entry>
576
		<entry>File is up-to-date, but modified.</entry>
577
	      </row>
578
579
	      <row>
580
		<entry>Needs Merge</entry>
581
		<entry>File is modified, and there is a newer revision
582
		  in the repository.</entry>
583
	      </row>
584
585
	      <row>
586
		<entry>File had conflicts on merge</entry>
587
		<entry>There were conflicts the last time this file
588
		  was updated, and they have not been resolved
589
		  yet.</entry>
590
	      </row>
591
	    </tbody>
592
	  </tgroup>
593
	</informaltable>
594
595
	<para>You will also see the local revision and date,
596
	  the revision number of the newest applicable version
597
	  (<quote>newest applicable</quote> because if you have a
598
	  sticky date, tag or branch, it may not be the actual newest
599
	  revision), and any sticky tags, dates or options.</para>
600
      </listitem>
601
602
      <listitem>
603
	<para>Once you have checked something out, you can update it
604
	  with the <command>update</command> command.</para>
605
606
	<screen>&prompt.user; <userinput>cvs update shazam</userinput></screen>
607
608
	<para>This updates the file <filename>shazam</filename> or the
609
	  contents of the <filename>shazam</filename> directory to the
610
	  latest version along the branch you checked out.  If you
611
	  checked out a <quote>point in time</quote>, it does nothing
612
	  unless the tags have moved in the repository or some other
613
	  weird stuff is going on.</para>
614
615
	<para>Useful options, in addition to those listed above for
616
	  <command>checkout</command>:</para>
617
618
	<informaltable frame="none" pgwide="1">
619
	  <tgroup cols=2>
620
	    <tbody>
621
	      <row>
622
		<entry><option>-d</option></entry>
623
		<entry>Check out any additional missing
624
		  directories.</entry>
625
	      </row>
626
627
	      <row>
628
		<entry><option>-A</option></entry>
629
		<entry>Update to head of main branch.</entry>
630
	      </row>
631
	    </tbody>
632
	  </tgroup>
633
	</informaltable>
634
635
	<para>If you checked out a module with <option>-r</option> or
636
	  <option>-D</option>, running <command>cvs update</command>
637
	  with a different <option>-r</option> or <option>-D</option>
638
	  argument or with <option>-A</option> will select a new
639
	  branch, revision or date. The <option>-A</option> option
640
	  clears all sticky tags, dates or revisions whereas
641
	  <option>-r</option> and <option>-D</option> set new
642
	  ones.</para>
643
644
	<para>Theoretically, specifying <literal>HEAD</literal> as the
645
	  argument to <option>-r</option> will give you the same
646
	  result as <option>-A</option>, but that is just
647
	  theory.</para>
648
649
	<para>The <option>-d</option> option is useful if:</para>
650
651
	<itemizedlist>
652
	  <listitem>
653
	    <para>somebody has added subdirectories to the module
654
	      you have checked out after you checked it out.</para>
655
	  </listitem>
656
657
	  <listitem>
658
	    <para>you checked out with <option>-l</option>, and later
659
	      change your mind and want to check out the
660
	      subdirectories as well.</para>
661
	  </listitem>
662
663
	  <listitem>
664
	    <para>you deleted some subdirectories and want to check
665
	      them all back out.</para>
666
	  </listitem>
667
	</itemizedlist>
668
669
	<para><emphasis>Watch the output of the <command>cvs
670
	      update</command> with care.</emphasis> The letter in
671
	  front of each filename indicates what was done with
672
	  it:</para>
673
674
	<informaltable frame="none" pgwide="1">
675
	  <tgroup cols=2>
676
	    <tbody>
677
	      <row>
678
		<entry><literal>U</literal></entry>
679
		<entry>The file was updated without trouble.</entry>
680
	      </row>
681
682
	      <row>
683
		<entry><literal>P</literal></entry>
684
		<entry>The file was updated without trouble (you will
685
		  only see this when working against a remote
686
		  repository).</entry>
687
	      </row>
688
689
	      <row>
690
		<entry><literal>M</literal></entry>
691
		<entry>The file had been modified, and was merged
692
		  without conflicts.</entry>
693
	      </row>
694
695
	      <row>
696
		<entry><literal>C</literal></entry>
697
		<entry>The file had been modified, and was merged with
698
		  conflicts.</entry>
699
	      </row>
700
	    </tbody>
701
	  </tgroup>
702
	</informaltable>
703
704
	<para>Merging is what happens if you check out a copy of some
705
	  file, modify it, then someone else commits a change, and you
706
	  run <command>cvs update</command>. CVS notices that you have
707
	  made local changes, and tries to merge your changes with the
708
	  changes between the version you originally checked out and
709
	  the one you updated to. If the changes are to separate
710
	  portions of the file, it will almost always work fine
711
	  (though the result might not be syntactically or
712
	  semantically correct).</para>
713
714
	<para>CVS will print an <literal>M</literal> in front of every
715
	  locally modified file even if there is no newer version in
716
	  the repository, so <command>cvs update</command> is handy
717
	  for getting a summary of what you have changed
718
	  locally.</para>
719
720
	<para>If you get a <literal>C</literal>, then your changes
721
	  conflicted with the changes in the repository (the changes
722
	  were to the same lines, or neighboring lines, or you changed
723
	  the local file so much that <command>cvs</command> can not
724
	  figure out how to apply the repository's changes). You will
725
	  have to go through the file manually and resolve the
726
	  conflicts; they will be marked with rows of
727
	  <literal>&lt;</literal>, <literal>=</literal> and
728
	  <literal>&gt;</literal> signs. For every conflict, there
729
	  will be a marker line with seven <literal>&lt;</literal>
730
	  signs and the name of the file, followed by a chunk of what
731
	  your local file contained, followed by a separator line with
732
	  seven <literal>=</literal> signs, followed by the
733
	  corresponding chunk in the repository version, followed by a
734
	  marker line with seven <literal>&gt;</literal> signs and the
735
	  revision number you updated to.</para>
736
      </listitem>
737
738
      <listitem>
739
	<para>View differences between the local version and the
740
	  repository version with the <command>diff</command>
741
	  command.</para>
742
743
	<screen>&prompt.user; <userinput>cvs diff shazam</userinput></screen>
744
745
	<para>shows you every modification you have made to the
746
	  <filename>shazam</filename> file or module.</para>
747
748
	<table frame="none">
749
	  <title>Useful <command>cvs diff</command> options</title>
750
751
	  <tgroup cols=2>
752
	    <tbody>
753
	      <row>
754
		<entry><option>-u</option></entry>
755
		<entry>Uses the unified diff format.</entry>
756
	      </row>
757
758
	      <row>
759
		<entry><option>-c</option></entry>
760
		<entry>Uses the context diff format.</entry>
761
	      </row>
762
763
	      <row>
764
		<entry><option>-N</option></entry>
765
		<entry>Shows missing or added files.</entry>
766
	      </row>
767
	    </tbody>
768
	  </tgroup>
769
	</table>
770
771
	<para>You always want to use <option>-u</option>, since
772
	  unified diffs are much easier to read than almost any other
773
	  diff format (in some circumstances, context diffs generated
774
	  with the <option>-c</option> option may be better, but they
775
	  are much bulkier). A unified diff consists of a series of
776
	  hunks. Each hunk begins with a line that starts with two
777
	  <literal>@</literal> signs and specifies where in the file
778
	  the differences are and how many lines they span. This is
779
	  followed by a number of lines; some (preceded by a blank)
780
	  are context; some (preceded by a <literal>-</literal> sign)
781
	  are outtakes and some (preceded by a <literal>+</literal>)
782
	  are additions.</para>
783
784
	<para>You can also diff against a different version than the
785
	  one you checked out by specifying a version with
786
	  <option>-r</option> or <option>-D</option> as in
787
	  <command>checkout</command> or <command>update</command>, or
788
	  even view the diffs between two arbitrary versions (without
789
	  regard for what you have locally) by specifying
790
	  <emphasis>two</emphasis> versions with <option>-r</option>
791
	  or <option>-D</option>.</para>
792
      </listitem>
793
794
      <listitem>
795
	<para>View log entries with the <command>log</command>
796
	  command.</para>
797
798
	<screen>&prompt.user; <userinput>cvs log shazam</userinput></screen>
799
800
	<para>If <filename>shazam</filename> is a file, this will
801
	  print a <emphasis>header</emphasis> with information about
802
	  this file, such as where in the repository this file is
803
	  stored, which revision is the <literal>HEAD</literal> for
804
	  this file, what branches this file is in, and any tags that
805
	  are valid for this file.  Then, for each revision of this
806
	  file, a log message is printed.  This includes the date and
807
	  time of the commit, who did the commit, how many lines were
808
	  added and/or deleted, and finally the log message that the
809
	  committer who did the change wrote.</para>
810
811
	<para>If <filename>shazam</filename> is a directory, then the
812
	  log information described above is printed for each file in
813
	  the directory in turn.  Unless you give the
814
	  <option>-l</option> to <command>log</command>, the log for
815
	  all subdirectories of <filename>shazam</filename> is printed
816
	  too, in a recursive manner.</para>
817
818
	<para>Use the <command>log</command> command to view the
819
	  history of one or more files, as it is stored in the CVS
820
	  repository.  You can even use it to view the log message of
821
	  a specific revision, if you add the
822
	  <option>-r<replaceable>rev</replaceable></option> to the
823
	  <command>log</command> command:</para>
824
825
	<screen>&prompt.user; <userinput>cvs log -r1.2 shazam</userinput></screen>
826
827
	<para>This will print only the log message for revision
828
	  <literal>1.2</literal> of file <filename>shazam</filename>
829
	  if it is a file, or the log message for revision
830
	  <literal>1.2</literal> of each file under
831
	  <filename>shazam</filename> if it is a directory.</para>
832
      </listitem>
833
834
      <listitem>
835
	<para>See who did what with the <command>annotate</command>
836
	  command.  This command shows you each line of the specified
837
	  file or files, along with which user most recently changed
838
	  that line.</para>
839
840
	<screen>&prompt.user; <userinput>cvs annotate shazam</userinput></screen>
841
      </listitem>
842
843
      <listitem>
844
	<para>Add new files with the <command>add</command>
845
	  command.</para>
846
847
	<para>Create the file, <command>cvs add</command> it, then
848
	  <command>cvs commit</command> it.</para>
849
850
	<para>Similarly, you can add new directories by creating them
851
	  and then <command>cvs add</command>ing them. Note that you
852
	  do not need to commit directories.</para>
853
      </listitem>
854
855
      <listitem>
856
	<para>Remove obsolete files with the <command>remove</command>
857
	  command.</para>
858
859
	<para>Remove the file, then <command>cvs rm</command> it, then
860
	  <command>cvs commit</command> it.</para>
861
      </listitem>
862
863
      <listitem>
864
	<para>Commit with the <command>commit</command> or
865
	  <command>checkin</command> command.</para>
866
867
	<table frame="none">
868
	  <title>Useful <command>cvs commit</command> options</title>
869
870
	  <tgroup cols=2>
871
	    <tbody>
872
	      <row>
873
		<entry><option>-f</option></entry>
874
		<entry>Force a commit of an unmodified file.</entry>
875
	      </row>
876
877
	      <row>
878
		<entry><option>-m<replaceable>msg</replaceable></option></entry>
879
		<entry>Specify a commit message on the command line
880
		  rather than invoking an editor.</entry>
881
	      </row>
882
	    </tbody>
883
	  </tgroup>
884
	</table>
885
886
	<para>The following are some Subversion examples related to
887
	  the src repository.  More (in-depth) information can be
888
	  found in the Subversion Primer at <xref
889
	    linkend="subversion-primer"> and <ulink
890
	     url="http://wiki.freebsd.org/SubversionMissing">List of
891
	   things missing in Subversion when compared to CVS</ulink>.
892
	  The notes at <ulink
893
	    url="http://people.freebsd.org/~peter/svn_notes.txt"></ulink>
894
	  might also be useful.  Subversion is also described in-depth
895
	  in <ulink url="http://svnbook-red-bean.com/">Version Control
896
	    with Subversion</ulink>.</para>
897
898
	<itemizedlist>
899
	  <listitem>
900
	    <para>Check out the <literal>head</literal> branch:</para>
901
902
	    <screen>&prompt.user; <userinput>svn co svn+ssh://svn.freebsd.org/base/head /usr/src</userinput></screen>
903
	  </listitem>
904
	</itemizedlist>
905
906
	<para>Good commit messages are important. They tell others why
907
	  you did the changes you did, not just right here and now,
908
	  but months or years from now when someone wonders why some
909
	  seemingly illogical or inefficient piece of code sneaked
910
	  into your source file. It is also an invaluable aid to
911
	  deciding which changes to MFC and which not to MFC.</para>
912
913
	<para>Commit messages should be clear, concise and provide
914
	  a reasonable summary to give an indication of what was
915
	  changed and why.</para>
916
917
	<para>Commit messages should provide enough information to
918
	  enable a third party to decide if the change is relevant to
919
	  them and if they need to read the change itself.</para>
920
921
	<para>Avoid committing several unrelated changes in one go. It
922
	  makes merging difficult, and also makes it harder to
923
	  determine which change is the culprit if a bug crops
924
	  up.</para>
925
926
	<para>Avoid committing style or whitespace fixes and
927
	  functionality fixes in one go. It makes merging difficult,
928
	  and also makes it harder to understand just what functional
929
	  changes were made.  In the case of documentation files, it
930
	  can make the job of the translation teams more complicated,
931
	  as it becomes difficult for them to determine exactly what
932
	  content changes need to be translated.</para>
933
934
	<para>Avoid committing changes to multiple files in one go
935
	  with a generic, vague message. Instead, commit each file (or
936
	  small, related groups of files) with tailored commit
937
	  messages.</para>
938
939
	<para>Before committing, <emphasis>always</emphasis>:</para>
940
941
	<itemizedlist>
942
	  <listitem>
943
	    <para>verify which branch you are committing to, using
944
	      <command>svn status</command>.  This is only needed for
945
	      the src tree, as the other trees are not branched.</para>
946
	  </listitem>
947
948
	  <listitem>
949
	    <para>review your diffs, using the diff command of the
950
	      version control system.</para>
951
	  </listitem>
952
	</itemizedlist>
953
954
	<para>Also, ALWAYS specify which files to commit explicitly on
955
	  the command line, so you do not accidentally commit other
956
	  files than the ones you intended &mdash; a commit operation
957
	  without any arguments usually will commit every modification
958
	  in your current working directory and every
959
	  subdirectory.</para>
960
      </listitem>
961
    </orderedlist>
962
963
    <para>Additional tips and tricks:</para>
964
965
    <orderedlist>
966
      <listitem>
967
968
	<para>You can place commonly used options in your
969
	  <filename>~/.cvsrc</filename>, like this:</para>
970
971
	<programlisting>cvs -z3
972
diff -Nu
973
update -Pd
974
checkout -P</programlisting>
975
976
	<para>This example says:</para>
977
978
	<itemizedlist>
979
	  <listitem>
980
	    <para>always use compression level 3 when talking to a
981
	      remote server. This is a life-saver when working over a
982
	      slow connection.</para>
983
	  </listitem>
984
985
	  <listitem>
986
	    <para>always use the <option>-N</option> (show added or
987
	      removed files) and <option>-u</option> (unified diff
988
	      format) options to &man.diff.1;.</para>
989
	  </listitem>
990
991
	  <listitem>
992
	    <para>always use the <option>-P</option> (prune empty
993
	      directories) and <option>-d</option> (check out new
994
	      directories) options when updating.</para>
995
	  </listitem>
996
997
	  <listitem>
998
	    <para>always use the <option>-P</option> (prune empty
999
	      directories) option when checking out.</para>
1000
	  </listitem>
1001
	</itemizedlist>
1002
      </listitem>
1003
1004
      <listitem>
1005
	<para>Use Eivind Eklund's <command>cdiff</command> script to
1006
	  view unidiffs.  It is a wrapper for &man.less.1; that adds
1007
	  ANSI color codes to make hunk headers, outtakes and
1008
	  additions stand out; context and garbage are unmodified.  It
1009
	  also expands tabs properly (tabs often look wrong in diffs
1010
	  because of the extra character in front of each
1011
	  line).</para>
1012
1013
	<para><filename
1014
	    role="package">textproc/cdiff</filename></para>
1015
1016
	<para>Simply use it instead of &man.more.1; or
1017
	  &man.less.1;:</para>
1018
1019
	<screen>&prompt.user; <userinput>cvs diff -Nu shazam | cdiff</userinput></screen>
1020
1021
	<para>Alternatively some editors like &man.vim.1; (<filename
1022
	    role="package">editors/vim</filename>) have color support
1023
	  and when used as a pager with color syntax highlighting
1024
	  switched on will highlight many types of file, including
1025
	  diffs, patches, and CVS/RCS logs.</para>
1026
1027
	<screen>&prompt.user; <userinput>echo "syn on" &gt;&gt; ~/.vimrc </userinput>
1028
&prompt.user; <userinput>cvs diff -Nu shazam | vim -</userinput>
1029
&prompt.user; <userinput>cvs log shazam | vim -</userinput> </screen>
1030
      </listitem>
1031
1032
      <listitem>
1033
	<para>CVS is old, arcane, crufty and buggy, and sometimes
1034
	  exhibits non-deterministic behavior which some claim as
1035
	  proof that it is actually merely the Newtonian manifestation
1036
	  of a sentient transdimensional entity.  It is not humanly
1037
	  possible to know its every quirk inside out, so do not be
1038
	  afraid to ask the resident AI (&a.cvsadm;) for help.</para>
1039
      </listitem>
1040
1041
      <listitem>
1042
	<para>Do not leave the <command>cvs commit</command> command
1043
	  in commit message editing mode for too long (more than
1044
	  2&ndash;3 minutes).  It locks the directory you are working
1045
	  with and will prevent other developers from committing into
1046
	  the same directory.  If you have to type a long commit
1047
	  message, type it before executing <command>cvs
1048
	    commit</command> and insert it into the commit message or
1049
	  save it in a file before committing and use the
1050
	  <option>-F</option> option of CVS to read the commit message
1051
	  from that file, i.e.,</para>
1052
1053
	  <screen>&prompt.user; <userinput>vi logmsg</userinput>
1054
&prompt.user; <userinput>cvs ci -F logmsg shazam</userinput></screen>
1055
1056
	<para>This is the fastest way of passing a commit message to
1057
	  CVS but you should be careful when editing the
1058
	  <filename>logmsg</filename> file before the commit, because
1059
	  CVS will not give you a chance to edit the message when you
1060
	  do the actual commit.</para>
1061
      </listitem>
1062
1063
      <listitem>
1064
	<para>Speed up your CVS operation considerably by using a
1065
	  persistent ssh connection to the repository machine.  First,
1066
	  put this configuration into your
1067
	  <filename>~/.ssh/config</filename>:</para>
1068
1069
	<programlisting>Host pcvs.FreeBSD.org
1070
      ControlPath /home/<replaceable>user</replaceable>/.ssh/cvs.cpath
1071
Host projcvs.FreeBSD.org
1072
      ControlPath /home/<replaceable>user</replaceable>/.ssh/cvs.cpath</programlisting>
1073
1074
	<para>Now open the persistent connection to the
1075
	  repoman:</para>
1076
1077
	<screen>&prompt.user; <userinput>ssh -fNM ncvs.FreeBSD.org</userinput></screen>
1078
1079
	<para>The CVS commands should now respond faster, as they are
1080
	  reusing existing connection with the repository.  Note that
1081
	  all the hostnames are case sensitive.</para>
1082
      </listitem>
1083
    </orderedlist>
1084
  </sect1>
1085
1086
  <sect1 id="subversion-primer">
1087
    <title>Subversion Primer</title>
1088
1089
    <sect2 id="svn-intro">
284
    <sect2 id="svn-intro">
1090
      <title>Introduction</title>
285
      <title>Introduction</title>
1091
286
Lines 1110-1115 Link Here
1110
	  <literal>head/<replaceable>lang</replaceable>/htdocs/</literal>.</para>
305
	  <literal>head/<replaceable>lang</replaceable>/htdocs/</literal>.</para>
1111
      </note>
306
      </note>
1112
307
308
      <para>The &os; <literal>ports</literal> repository switched
309
	from <acronym>CVS</acronym> to Subversion on July 14th, 2012.
310
	The first real <acronym>SVN</acronym> commit is
311
	<emphasis>rxxxxxx</emphasis>.</para>
312
1113
      <para>There are mechanisms in place to automatically merge
313
      <para>There are mechanisms in place to automatically merge
1114
	changes back from the Subversion repository to the
314
	changes back from the Subversion repository to the
1115
	<acronym>CVS</acronym> one, so regular users should not notice
315
	<acronym>CVS</acronym> one, so regular users should not notice
Lines 1182-1193 Link Here
1182
382
1183
	<screen>&prompt.user; <userinput>svn checkout svn+ssh://svn.freebsd.org/doc/head /usr/doc</userinput></screen>
383
	<screen>&prompt.user; <userinput>svn checkout svn+ssh://svn.freebsd.org/doc/head /usr/doc</userinput></screen>
1184
384
385
	<para>For the <literal>ports</literal> tree, use:</para>
386
387
	<screen>&prompt.user; <userinput>svn checkout svn+ssh://svn.freebsd.org/ports/head /usr/ports</userinput></screen>
388
1185
	<note>
389
	<note>
1186
	  <para>Though the remaining examples in this document are
390
	  <para>Though the remaining examples in this document are
1187
	    written with the workflow of working with the
391
	    written with the workflow of working with the
1188
	    <literal>src</literal> tree in mind, the underlying
392
	    <literal>src</literal> tree in mind, the underlying
1189
	    concepts are the same for working with the
393
	    concepts are the same for working with the
1190
	    <literal>doc</literal> tree.</para>
394
	    <literal>doc</literal> and the <literal>ports</literal>
395
	    tree.
396
	    Ports related Subversion operations are listed in the
397
	    <xref linkend="ports"></para>
1191
	</note>
398
	</note>
1192
399
1193
	<para>The above command will check out a
400
	<para>The above command will check out a
Lines 1456-1461 Link Here
1456
	  </listitem>
663
	  </listitem>
1457
	</itemizedlist>
664
	</itemizedlist>
1458
      </sect3>
665
      </sect3>
666
667
      <sect3>
668
	<title>&os; Ports Tree Branches and Layout</title>
669
670
	<para>In <literal>svn+ssh://svn.freebsd.org/ports</literal>,
671
	  <emphasis>ports</emphasis> refers repository root of the
672
	  ports tree.</para>
673
674
	<para>In general, most &os; port work will be done within
675
	  the <filename>head/</filename> branch of the ports tree
676
	  which is the actual ports tree used to install software.
677
	  Some other key locations are:</para>
678
679
	<itemizedlist>
680
	  <listitem>
681
	    <para><emphasis>/branches/RELENG_<replaceable>n_n_n
682
	      </replaceable></emphasis> which corresponds to <literal>
683
	      RELENG_<replaceable>n_n_n</replaceable></literal> is used
684
	      to merge back security updates in preparation for a release.
685
	      </para>
686
	  </listitem>
687
	  <listitem>
688
	    <para><emphasis>/tags/RELEASE_<replaceable>n_n_n</replaceable>
689
	      </emphasis> which corresponds to <literal>
690
	      RELEASE_<replaceable>n_n_n</replaceable></literal>
691
	      represents a release tag of the ports tree.</para>
692
	  </listitem>
693
	  <listitem>
694
	    <para><emphasis>/tags/RELEASE_<replaceable>n</replaceable>
695
	      _EOL</emphasis> represents the end of life tag of a 
696
	      specific &os; branch.</para>
697
	  </listitem>
698
	</itemizedlist>
699
      </sect3>
1459
    </sect2>
700
    </sect2>
1460
701
1461
    <sect2 id="svn-daily-use">
702
    <sect2 id="svn-daily-use">
Lines 1609-1614 Link Here
1609
	  in a single operation:</para>
850
	  in a single operation:</para>
1610
851
1611
	<screen>&prompt.user; <userinput>svn commit <replaceable>lib/libfetch</replaceable> <replaceable>usr/bin/fetch</replaceable></userinput></screen>
852
	<screen>&prompt.user; <userinput>svn commit <replaceable>lib/libfetch</replaceable> <replaceable>usr/bin/fetch</replaceable></userinput></screen>
853
854
	<para>There is also a commit wrapper for the ports tree
855
	  to handle the properties and sanity checking your
856
	  changes:</para>
857
858
	<screen>&prompt.user; <userinput>/usr/ports/Tools/scripts/psvn commit
859
	  </userinput></screen>
1612
      </sect3>
860
      </sect3>
1613
861
1614
      <sect3 id="subversion-primer-add-remove">
862
      <sect3 id="subversion-primer-add-remove">
Lines 1617-1630 Link Here
1617
	<note>
865
	<note>
1618
	  <para>Before adding files, get a copy of <ulink
866
	  <para>Before adding files, get a copy of <ulink
1619
	      url="http://people.freebsd.org/~peter/auto-props.txt">auto-props.txt</ulink>
867
	      url="http://people.freebsd.org/~peter/auto-props.txt">auto-props.txt</ulink>
1620
	    and add it to <filename>~/.subversion/config</filename>
868
	    (there is also a <ulink
1621
	    according to the instructions in the file.  If you added
869
	    url="http://people.freebsd.org/~beat/cvs2svn/auto-props.txt">
1622
	    something before you've read this, you may use
870
	    ports tree specific version</ulink>) and add it to
1623
	    <command>svn rm --keep-local</command> for just added
871
	    <filename>~/.subversion/config</filename> according to
1624
	    files, fix your config file and re-add them again.  The
872
	    the instructions in the file.  If you added something
1625
	    initial config file is created when you first run a svn
873
	    before you've read this, you may use <command>svn rm
1626
	    command, even something as simple as <command>svn
874
	    --keep-local</command> for just added files, fix your
1627
	      help</command>.</para>
875
	    config file and re-add them again.  The initial config
876
	    file is created when you first run a svn command, even
877
	    something as simple as <command>svn help</command>.
878
	    </para>
1628
	</note>
879
	</note>
1629
880
1630
	<para>As with <acronym>CVS</acronym>, files are added to a
881
	<para>As with <acronym>CVS</acronym>, files are added to a
Lines 2724-2729 Link Here
2724
      <para>In commit logs etc., <quote>rev 179872</quote> should be
1975
      <para>In commit logs etc., <quote>rev 179872</quote> should be
2725
	spelled <quote>r179872</quote> as per convention.</para>
1976
	spelled <quote>r179872</quote> as per convention.</para>
2726
1977
1978
      <para>Don't remove and re-add the same file in a single commit
1979
	as this will break the CVS exporter.</para>
1980
2727
      <para>Speeding up checkouts and minimising network traffic is
1981
      <para>Speeding up checkouts and minimising network traffic is
2728
	possible with the following recipe:</para>
1982
	possible with the following recipe:</para>
2729
1983
Lines 4287-4293 Link Here
4287
3541
4288
	        <procedure>
3542
	        <procedure>
4289
	          <step>
3543
	          <step>
4290
	            <para>Remove the port's files via <command>cvs remove</command>.</para>
3544
	            <para>Remove the port's files via <command>svn remove</command>.</para>
4291
	          </step>
3545
	          </step>
4292
3546
4293
	          <step>
3547
	          <step>
Lines 4329-4348 Link Here
4329
	    <para>This is essentially the reverse of deleting a port.</para>
3583
	    <para>This is essentially the reverse of deleting a port.</para>
4330
	    <procedure>
3584
	    <procedure>
4331
              <step>
3585
              <step>
4332
	        <para>Figure out when the port was removed.  Use the ports
3586
	        <para>Figure out when the port was removed.  Use this
4333
		  <ulink url="http://www.freebsd.org/cgi/cvsweb.cgi/ports/">cvsweb</ulink>
3587
		  <ulink url="http://people.freebsd.org/~crees/removed_ports/index.xml">list</ulink>
4334
		  and then navigate to
3588
		  and then copy the last living revision of the port:
4335
		  <replaceable>category</replaceable>/<replaceable>portname</replaceable>/<filename>Attic</filename>/ .
3589
3590
		  <screen>&prompt.user; <userinput>cd /usr/ports/<replaceable>category
3591
		  </replaceable></userinput></screen>
3592
		  <screen>&prompt.user; <userinput>svn cp 'svn+ssh://svn.freebsd.org/ports/<replaceable>category</replaceable>/<replaceable>portname</replaceable>/@{<replaceable>YYYY-MM-DD</replaceable>}' <replaceable>portname</replaceable>
3593
		  </userinput></screen>
3594
4336
		  Pick a date that is before the removal but after the last true
3595
		  Pick a date that is before the removal but after the last true
4337
		   commit.</para>
3596
		   commit.</para>
4338
              </step>
3597
              </step>
4339
3598
4340
              <step>
3599
              <step>
4341
	        <para>In the proper directory:
4342
<command>cvs update -D <replaceable>datespec</replaceable></command>.</para>
4343
              </step>
4344
4345
              <step>
4346
	        <para>Perform whatever changes are necessary to make the port
3600
	        <para>Perform whatever changes are necessary to make the port
4347
		  work again.  If it was deleted because the distfiles are
3601
		  work again.  If it was deleted because the distfiles are
4348
		  no longer available you will need to volunteer to host them
3602
		  no longer available you will need to volunteer to host them
Lines 4350-4356 Link Here
4350
              </step>
3604
              </step>
4351
3605
4352
              <step>
3606
              <step>
4353
	        <para><command>cvs add</command> the updated files.</para>
3607
	        <para><command>svn add</command> or <command>svn remove</command>
3608
		  any appropriate files.</para>
4354
              </step>
3609
              </step>
4355
3610
4356
	      <step>
3611
	      <step>
Lines 4365-4371 Link Here
4365
	      </step>
3620
	      </step>
4366
3621
4367
	      <step>
3622
	      <step>
4368
	        <para><command>cvs commit</command> these changes, preferably in
3623
	        <para><command>svn commit</command> these changes, preferably in
4369
		    one step.</para>
3624
		    one step.</para>
4370
              </step>
3625
              </step>
4371
	    </procedure>
3626
	    </procedure>
Lines 4402-4446 Link Here
4402
3657
4403
	<qandaentry>
3658
	<qandaentry>
4404
	  <question>
3659
	  <question>
4405
	    <para>When do we <emphasis>not</emphasis> need a
4406
	      repository copy?</para>
4407
	  </question>
4408
4409
	  <answer>
4410
	    <para>When there is no history to preserve.  If a port is
4411
	      added into a wrong category and is moved immediately,
4412
	      it suffices to simply <command>cvs remove</command> the
4413
	      old one and <command>addport</command> the new
4414
	      one.</para>
4415
	  </answer>
4416
	</qandaentry>
4417
4418
	<qandaentry>
4419
	  <question>
4420
	    <para>What do I need to do?</para>
3660
	    <para>What do I need to do?</para>
4421
	  </question>
3661
	  </question>
4422
3662
4423
	  <answer>
3663
	  <answer>
4424
	    <para>File a PR in <application>GNATS</application>, listing the
3664
	    <para>Unlike with CVS a repo copy can be done by a committer
4425
	      reasons for the repository copy request.  Assign it to
3665
	      itself:</para>
4426
	      <literal>portmgr</literal> and set <varname>state</varname> to
4427
	      <literal>repocopy</literal>.  In a few days,
4428
	      <literal>portmgr</literal> will do
4429
	      a repository copy from the old to the new location, and
4430
	      reassign the PR back to you.  Once everything is done, perform the
4431
	      following:</para>
4432
3666
4433
	    <itemizedlist>
3667
	    <itemizedlist>
4434
	      <listitem>
3668
	      <listitem>
4435
		<para>When a port has been repo copied:</para>
3669
		<para>Doing a repo copy:</para>
4436
3670
4437
		<procedure>
3671
		<procedure>
4438
		  <step>
3672
		  <step>
4439
		    <para>Do a force commit on the files of the copied port,
3673
		    <para>First make sure that you were using an up to
4440
		      stating repository copy was performed.</para>
3674
		      date portstree and the target directory does not
3675
		      exist.</para>
4441
		  </step>
3676
		  </step>
4442
3677
4443
		  <step>
3678
		  <step>
3679
		    <para>Use <command>svn move</command> or <command>svn
3680
		      copy</command> to do the repo copy.</para>
3681
		  </step>
3682
3683
		  <step>
4444
		    <para>Upgrade the copied port to the new version.
3684
		    <para>Upgrade the copied port to the new version.
4445
		      Remember to change the <makevar>LATEST_LINK</makevar>
3685
		      Remember to change the <makevar>LATEST_LINK</makevar>
4446
		      so there are no duplicate ports with the same name.
3686
		      so there are no duplicate ports with the same name.
Lines 4477-4482 Link Here
4477
		      <filename>ports/MOVED</filename>, if you remove the
3717
		      <filename>ports/MOVED</filename>, if you remove the
4478
		      original port.</para>
3718
		      original port.</para>
4479
		  </step>
3719
		  </step>
3720
3721
		  <step>
3722
		    <para>Commit all changes on one commit.  A forced commit
3723
		      is no longer needed with Subversion.</para>
3724
		  </step>
4480
		</procedure>
3725
		</procedure>
4481
	      </listitem>
3726
	      </listitem>
4482
3727
Lines 4954-4960 Link Here
4954
4199
4955
	  <answer>
4200
	  <answer>
4956
	    <para>No, <filename>INDEX</filename> is no longer stored
4201
	    <para>No, <filename>INDEX</filename> is no longer stored
4957
	      in the CVS repository.  The file can either be generated
4202
	      in the SVN repository.  The file can either be generated
4958
	      by running <command>make index</command>, or a pre-generated
4203
	      by running <command>make index</command>, or a pre-generated
4959
	      version can be downloaded with <command>make
4204
	      version can be downloaded with <command>make
4960
	      fetchindex</command>.</para>
4205
	      fetchindex</command>.</para>

Return to bug 169772